Commit before attempting to implement immutable buffer storage (openGL)
This commit is contained in:
+14
-9
@@ -4,14 +4,14 @@ module Dodge.Render (
|
||||
getWindowSize
|
||||
) where
|
||||
|
||||
--import qualified Data.Vector as V
|
||||
import qualified Data.Vector as V
|
||||
|
||||
import Dodge.Shadows
|
||||
import Dodge.WindowSize
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import qualified Control.Monad.Parallel as MP
|
||||
import Data.List (sortOn)
|
||||
--import Data.List (sortOn)
|
||||
import qualified Data.Map.Strict as M
|
||||
import Data.Preload.Render
|
||||
import qualified Data.Vector.Unboxed.Mutable as UMV
|
||||
@@ -85,10 +85,12 @@ doDrawing' win pdata u = do
|
||||
ws
|
||||
)
|
||||
(nCloudVs, nCloudIs) <-
|
||||
foldM
|
||||
-- Might want to sort the clouds based on z depth, not sure
|
||||
V.foldM'
|
||||
(pokeCloud (pdata ^. cloudVBO . vboPtr) (pdata ^. cloudEBO . eboPtr))
|
||||
(0, 0)
|
||||
(sortOn (^. clPos . _3) $ w ^. cWorld . lWorld . clouds)
|
||||
(V.fromList $ w ^. cWorld . lWorld . clouds)
|
||||
--(sortOn (^. clPos . _3) $ w ^. cWorld . lWorld . clouds)
|
||||
-- bind wall points, silhouette data, surface geometry
|
||||
bufferShaderLayers shadV layerCounts
|
||||
mapM_
|
||||
@@ -226,8 +228,11 @@ doDrawing' win pdata u = do
|
||||
glBindTextureUnit 0 (pdata ^. fboBloom . _2 . unTO)
|
||||
glDisable GL_BLEND
|
||||
drawShader (_bloomBlurShader pdata) 4
|
||||
replicateM_ 2 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
||||
glEnable GL_BLEND
|
||||
if cfig ^. graphics_bloom
|
||||
then do
|
||||
replicateM_ 2 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
||||
glEnable GL_BLEND
|
||||
else return ()
|
||||
setViewport _graphics_world_resolution cfig
|
||||
--draw clouds onto cloud buffer
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
|
||||
@@ -341,12 +346,12 @@ doDrawing' win pdata u = do
|
||||
glBlendFunc GL_ONE GL_ZERO
|
||||
-- perform any radial distortion
|
||||
-- this is hideous
|
||||
case getDistortions cfig w of
|
||||
[] -> do
|
||||
case (getDistortions cfig w, cfig ^. graphics_distortions) of
|
||||
(rds, x) | null rds || not x -> do
|
||||
glBindTextureUnit 0 $ pdata ^. fboBase . _2 . _1 . unTO
|
||||
glBindFramebuffer GL_FRAMEBUFFER 0
|
||||
drawShader (_fullscreenShader pdata) 4
|
||||
rds -> do
|
||||
(rds,_) -> do
|
||||
let bindDrawDist :: Distortion -> IO ()
|
||||
bindDrawDist (RadialDistortion (V2 a b) (V2 c d) (V2 e f) g) = do
|
||||
pokeArray (shadVBOptr $ _barrelShader pdata) [a, b, c, d, e, f, g]
|
||||
|
||||
Reference in New Issue
Block a user