Reogranise drawing in main
This commit is contained in:
+52
-9
@@ -85,15 +85,58 @@ doTheRender :: PreloadData a -> World -> IO (Word32)
|
||||
doTheRender preData w = do
|
||||
sTicks <- SDL.ticks
|
||||
clear [ColorBuffer,DepthBuffer]
|
||||
renderPicture' (_renderData preData)
|
||||
(_cameraRot w) (_cameraZoom w)
|
||||
(_cameraCenter w)
|
||||
(_windowX w,_windowY w)
|
||||
(wallsPointsAndCols w)
|
||||
(wallsWindows w)
|
||||
(lightsForGloom' w)
|
||||
(_cameraViewFrom w)
|
||||
(worldPictures w)
|
||||
let pdata = _renderData preData
|
||||
rot = _cameraRot w
|
||||
zoom = _cameraZoom w
|
||||
trans@(tranx,trany) = _cameraCenter w
|
||||
wins@(winx,winy) = (_windowX w,_windowY w)
|
||||
wallPointsCol = wallsPointsAndCols w
|
||||
windowPoints = wallsWindows w
|
||||
lightPoints = lightsForGloom' w
|
||||
viewFroms@(viewFromx,viewFromy) = _cameraViewFrom w
|
||||
pic = worldPictures w
|
||||
let wallPoints = map fst wallPointsCol
|
||||
|
||||
setCommonUniforms pdata rot zoom trans wins
|
||||
|
||||
depthFunc $= Just Less
|
||||
|
||||
pmat <- (newMatrix RowMajor
|
||||
$ perspectiveMatrix rot zoom (tranx,trany) (winx,winy) (viewFromx,viewFromy)
|
||||
) :: IO (GLmatrix GLfloat)
|
||||
|
||||
createLightMap pdata rot zoom trans wins wallPoints lightPoints viewFroms pmat
|
||||
|
||||
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||
clear [DepthBuffer]
|
||||
|
||||
renderBackground pdata rot zoom trans wins
|
||||
|
||||
renderWalls pdata wallPointsCol pmat
|
||||
|
||||
setWallDepth pdata wallPoints (viewFromx,viewFromy) pmat
|
||||
|
||||
depthFunc $= Just Lequal
|
||||
|
||||
renderFoldable pdata $ picToLTree (Just 0) pic
|
||||
|
||||
-- reset blend so that light map doesn't apply
|
||||
-- blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
|
||||
blendFuncSeparate $= ((SrcAlpha,OneMinusSrcAlpha) , (Zero,One))
|
||||
-- blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
|
||||
renderFoldable pdata $ picToLTree (Just 1) pic
|
||||
|
||||
-- set drawing for on top
|
||||
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||
|
||||
renderFoldable pdata $ picToLTree (Just 2) pic
|
||||
|
||||
depthMask $= Disabled
|
||||
renderWalls pdata windowPoints pmat
|
||||
depthMask $= Enabled
|
||||
|
||||
resetShaderUniforms (map extractProgAndUnis $ _listShaders pdata)
|
||||
----------------------
|
||||
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
|
||||
renderFoldable (_renderData preData) (picToLTree Nothing $ fixedCoordPictures w)
|
||||
eTicks <- SDL.ticks
|
||||
|
||||
Reference in New Issue
Block a user