Add shading for shapes and the floor

This commit is contained in:
2023-03-15 18:24:09 +00:00
parent 21f87b96d8
commit 989140d46e
16 changed files with 158 additions and 69 deletions
+50 -1
View File
@@ -29,8 +29,9 @@ sizeFBOs ::
IO RenderData
sizeFBOs xsize ysize xfull yfull rdata = do
resizeRBO (_rboBaseBloom rdata) xsize ysize
rdata1 <- updateFBOTO3 xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F GL_RGBA16F rdata fboBase
rdata' <-
foldM (updateFBOTO2 xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F) rdata [fboBase, fboCloud]
foldM (updateFBOTO2 xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8 GL_RGBA16F) rdata1 [fboCloud]
>>= flip
(foldM (updateFBOTO xsize ysize GL_NEAREST GL_NEAREST GL_RGBA8))
[fboColor, fboLighting]
@@ -101,6 +102,26 @@ updateFBOTO2 xsize ysize minfilt magfilt inFormat1 inFormat2 pdata target = do
newfbo2 <- resizeFBOTO2 (pdata ^# target) xsize ysize minfilt magfilt inFormat1 inFormat2
return $ storing target newfbo2 pdata
updateFBOTO3 ::
Int ->
Int ->
-- | minification filter
GLenum ->
-- | magnification filter
GLenum ->
-- | internal color format texture1
GLenum ->
-- | internal color format texture2
GLenum ->
-- | internal color format texture3
GLenum ->
RenderData ->
ALens' RenderData (FBO, (TO, TO, TO)) ->
IO RenderData
updateFBOTO3 xsize ysize minfilt magfilt inFormat1 inFormat2 inFormat3 pdata target = do
newfbo2 <- resizeFBOTO3 (pdata ^# target) xsize ysize minfilt magfilt inFormat1 inFormat2 inFormat3
return $ storing target newfbo2 pdata
-- note we only really "change" the texture objects
resizeShadowFBO ::
(FBO, (TO, TO)) ->
@@ -141,6 +162,34 @@ resizeFBOTO2 (fbo, (toOld1, toOld2)) xsize ysize minfilt magfilt inFormat1 inFor
checkFBO fbo
return (fbo, (TO to1, TO to2))
resizeFBOTO3 ::
(FBO, (TO, TO,TO)) ->
Int ->
Int ->
-- | minification filter
GLenum ->
-- | magnification filter
GLenum ->
-- | internal color format1
GLenum ->
-- | internal color format2
GLenum ->
-- | internal color format3
GLenum ->
IO (FBO, (TO, TO,TO))
resizeFBOTO3 (fbo, (toOld1, toOld2,told3)) xsize ysize minfilt magfilt inFormat1 inFormat2 inform3 = do
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fbo)
mglDelete glDeleteTextures $ _unTO toOld1
mglDelete glDeleteTextures $ _unTO toOld2
mglDelete glDeleteTextures $ _unTO told3
to1 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT0 xsize ysize minfilt magfilt inFormat1
to2 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT1 xsize ysize minfilt magfilt inFormat2
to3 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT2 xsize ysize minfilt magfilt inform3
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr ->
glNamedFramebufferDrawBuffers (_unFBO fbo) 3 ptr
checkFBO fbo
return (fbo, (TO to1, TO to2,TO to3))
resizeFBOTO ::
(FBO, TO) ->
Int ->