Work on geometry shader based shadows

This commit is contained in:
2023-03-11 22:59:19 +00:00
parent 5724a0543e
commit 7ee3f6581d
18 changed files with 235 additions and 144 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ data Input = Input
, _rSelect :: Point2
, _clickMousePos :: Point2
, _textInput :: String
, _scrollTestValue :: Float
, _scrollTestFloat :: Float
, _scrollTestInt :: Int
}
makeLenses ''Input
+2 -1
View File
@@ -26,7 +26,8 @@ defaultInput =
, _rLine = (0, 0)
, _lSelect = 0
, _rSelect = 0
, _scrollTestValue = 1
, _scrollTestFloat = 1
, _scrollTestInt = 0
}
defaultWorld :: World
+20 -1
View File
@@ -3,6 +3,7 @@ module Dodge.Render (
doDrawing,
) where
import qualified Data.Map.Strict as M
import Picture.Base
import qualified SDL
import qualified Data.Vector as V
@@ -31,8 +32,18 @@ import Shader.Parameters
import Shader.Poke
doDrawing :: SDL.Window -> RenderData -> Universe -> IO ()
doDrawing win pdata u = do
doDrawing window rdata u
| SDL.ScancodeT `M.member` (u ^. uvWorld . input . pressedKeys) = doTestDrawing rdata u
| otherwise = doDrawing' window rdata u
doTestDrawing :: RenderData -> Universe -> IO ()
doTestDrawing _ _ = do
return ()
doDrawing' :: SDL.Window -> RenderData -> Universe -> IO ()
doDrawing' win pdata u = do
--sTicks <- SDL.ticks
checkGLError
let w = _uvWorld u
cfig = _uvConfig u
rot = w ^. cWorld . camPos . camRot
@@ -139,6 +150,7 @@ doDrawing win pdata u = do
--bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
createLightMap
cfig
pdata
lightPoints
nWalls
@@ -212,6 +224,7 @@ doDrawing win pdata u = do
--bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
createLightMap
cfig
pdata
lightPoints
nWalls
@@ -352,3 +365,9 @@ renderTextureWalls pdata nWalls = do
glDisable GL_CULL_FACE
--cullFace $= Nothing
checkGLError :: IO ()
checkGLError = do
err <- glGetError
case err of
0 -> return ()
i -> error $ "OpenGL error: " ++ show i
+4 -2
View File
@@ -4,6 +4,8 @@ import Dodge.Data.Input
import LensHelp
updateScrollTestValue :: Input -> Input
updateScrollTestValue theinput = theinput & scrollTestValue +~ theamount
updateScrollTestValue theinput = theinput & scrollTestFloat +~ theamount
& scrollTestInt +~ i
where
theamount = fromIntegral (theinput ^. scrollAmount) / 100
i = theinput ^. scrollAmount
theamount = fromIntegral i / 100
+3 -1
View File
@@ -15,7 +15,9 @@ testStringInit :: Universe -> [String]
testStringInit u = [show $ length $ lightsToRender (u ^. uvConfig) (u ^. uvWorld . cWorld . camPos)
(u ^. uvWorld . cWorld . lWorld)
, show $ length $ fst $ worldSPic (u ^. uvConfig) (u ^. uvWorld)
, show $ length $ snd $ worldSPic (u ^. uvConfig) (u ^. uvWorld) ]
, show $ length $ snd $ worldSPic (u ^. uvConfig) (u ^. uvWorld)
, show $ u ^. uvWorld . input . scrollTestInt
]
--[show $ u ^? uvWorld . hud . hudElement . diSections . sssExtra . sssSelPos . _Just]
-- [show $ fmap IM.keys $ u ^? uvWorld . hud . hudElement . subInventory . ciSections . sssSections]