Allow to change menu options with rclick, move towards shader experiment

This commit is contained in:
2023-02-24 15:03:06 +00:00
parent 774316372f
commit ed9a46a18d
9 changed files with 71 additions and 42 deletions
+29 -24
View File
@@ -7,6 +7,7 @@ module Render
, bindTO
, bindFBO
) where
import Dodge.Data.Config
import Shader
import Shader.ExtraPrimitive
import Shader.Data
@@ -20,7 +21,7 @@ import qualified Data.Vector.Unboxed.Mutable as UMV
import qualified Data.Vector.Mutable as MV
import Control.Monad.Primitive
import Graphics.GL.Core43
import Control.Monad
--import Control.Monad
import qualified Data.Vector.Fusion.Stream.Monadic as VFSM
divideSize :: Int -> Size -> Size
@@ -33,7 +34,7 @@ createLightMap
-> Int -- ^ number of walls
-> Int -- ^ number of silhoutte lines to draw
-> Int -- ^ number of "caps" to attempt to draw
-> Bool -- ^ whether to draw object shadows or not
-> ObjectShadows -- ^ whether to draw object shadows or not
-> TextureObject -- ^ the texture object giving positions
-> IO ()
createLightMap pdata lightPoints nWalls nSils nCaps drawObjShads toPos = do
@@ -71,28 +72,32 @@ createLightMap pdata lightPoints nWalls nSils nCaps drawObjShads toPos = do
(marshalEPrimitiveMode $ _shadPrim lwShad)
0
(fromIntegral nWalls)
when drawObjShads $ do
--draw silhouette shadows
currentProgram $= Just (_shadProg llsShad)
uniform (head $ _shadUnis $ _lightingLineShadowShader pdata)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO llsShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim llsShad)
(fromIntegral nSils)
GL_UNSIGNED_SHORT
nullPtr
cullFace $= Just Back
--draw caps on the near plane as required
currentProgram $= Just (_shadProg lcShad)
uniform (head $ _shadUnis lcShad)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO lcShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim lcShad)
(fromIntegral nCaps)
GL_UNSIGNED_SHORT
nullPtr
case drawObjShads of
GeoObjShads -> do
--draw silhouette shadows
currentProgram $= Just (_shadProg llsShad)
uniform (head $ _shadUnis $ _lightingLineShadowShader pdata)
$= Vector3 x y z
uniform (_shadUnis ltShad !! 1)
$= Vector4 r g b rad
bindVertexArrayObject $= Just (_vao $ _shadVAO llsShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim llsShad)
(fromIntegral nSils)
GL_UNSIGNED_SHORT
nullPtr
--draw caps on the near plane as required
cullFace $= Just Back
currentProgram $= Just (_shadProg lcShad)
uniform (head $ _shadUnis lcShad)
$= Vector3 x y z
bindVertexArrayObject $= Just (_vao $ _shadVAO lcShad)
glDrawElements
(marshalEPrimitiveMode $ _shadPrim lcShad)
(fromIntegral nCaps)
GL_UNSIGNED_SHORT
nullPtr
_ -> return ()
--draw lightmap itself
depthFunc $= Just Always
-- bind world position texture