Setup multiple target basic shaders
This commit is contained in:
@@ -35,9 +35,11 @@ data RenderData = RenderData
|
||||
, _fboBase :: (FramebufferObject, TextureObject)
|
||||
, _fboBloom :: (FramebufferObject, TextureObject)
|
||||
, _fboColor :: (FramebufferObject, TextureObject)
|
||||
, _fboPos :: (FramebufferObject, TextureObject)
|
||||
, _rboBaseBloom :: RenderbufferObject
|
||||
, _fboLighting :: (FramebufferObject, TextureObject)
|
||||
, _rboLighting :: RenderbufferObject
|
||||
, _fboLightingHigh :: (FramebufferObject, TextureObject)
|
||||
--, _rboLighting :: RenderbufferObject
|
||||
, _matUBO :: BufferObject
|
||||
}
|
||||
makeLenses ''RenderData
|
||||
|
||||
@@ -358,30 +358,30 @@ miniGun = defaultAutoGun
|
||||
[ ammoCheckI
|
||||
, withWarmUpI 26
|
||||
, useTimeCheckI
|
||||
, withRecoilI recoilAmount
|
||||
--, afterRecoil recoilAmount
|
||||
, withSoundForI 28 2
|
||||
--, withThinSmokeI
|
||||
, torqueAfterI 0.05
|
||||
, withSidePushI 53
|
||||
, withRecoilI recoilAmount
|
||||
, afterRecoil recoilAmount
|
||||
, withRandomOffsetI 12
|
||||
, trigDoAlso (useAmmoParamsVelMod vm1)
|
||||
--, torqueBeforeForcedI 0.001
|
||||
, withSidePushI 52
|
||||
, withRecoilI recoilAmount
|
||||
, afterRecoil recoilAmount
|
||||
, withRandomOffsetI 11
|
||||
, withOldDir od1
|
||||
, trigDoAlso (useAmmoParamsVelMod vm2)
|
||||
--, torqueBeforeForcedI 0.001
|
||||
, withSidePushI 51
|
||||
, withRecoilI recoilAmount
|
||||
, afterRecoil recoilAmount
|
||||
, withRandomOffsetI 10
|
||||
, withOldDir od2
|
||||
, trigDoAlso (useAmmoParamsVelMod vm3)
|
||||
, useAmmo 4
|
||||
--, torqueBeforeForcedI 0.001
|
||||
, withSidePushI 50
|
||||
, withRecoilI recoilAmount
|
||||
, afterRecoil recoilAmount
|
||||
, withRandomOffsetI 9
|
||||
, withMuzFlareI
|
||||
, withOldDir od3
|
||||
|
||||
@@ -23,11 +23,14 @@ sizeFBOs
|
||||
-> IO RenderData
|
||||
sizeFBOs xsize ysize xfull yfull rdata = do
|
||||
resizeRBO (_rboBaseBloom rdata) xsize ysize
|
||||
resizeRBO (_rboLighting rdata) xsize ysize
|
||||
rdata' <- foldM (updateFBOTO xsize ysize minMagFilter GL_RGBA8) rdata [fboBase, fboColor,fboLighting]
|
||||
rdata'' <- updateFBOTO xsize ysize linMinMagFilter GL_RGBA16F rdata' fboBloom
|
||||
rdata''' <- foldM (updateFBOTO xfull yfull minMagFilter GL_RGBA8) rdata'' [fbo2, fbo3]
|
||||
foldM (updateFBOTO (xsize `div` 2) (ysize `div` 2) linMinMagFilter GL_RGBA16F) rdata''' [fboFourth1,fboFourth2]
|
||||
rdata' <- foldM (updateFBOTO xsize ysize minMagFilter GL_RGBA8) rdata
|
||||
[fboBase, fboColor,fboLighting,fboLightingHigh]
|
||||
rdata'' <- foldM (updateFBOTO xsize ysize linMinMagFilter GL_RGBA16F) rdata'
|
||||
[fboBloom, fboPos]
|
||||
rdata''' <- foldM (updateFBOTO xfull yfull minMagFilter GL_RGBA8) rdata''
|
||||
[fbo2, fbo3]
|
||||
foldM (updateFBOTO (xsize `div` 2) (ysize `div` 2) linMinMagFilter GL_RGBA16F) rdata'''
|
||||
[fboFourth1,fboFourth2]
|
||||
|
||||
resizeRBO
|
||||
:: RenderbufferObject
|
||||
|
||||
@@ -68,7 +68,7 @@ preloadRender = do
|
||||
<- makeShader "lighting/lineShadow" [vert,geom,frag] [3] ELinesAdjacency
|
||||
>>= addUniforms ["lightPos"]
|
||||
-- 2D draw shaders
|
||||
bslist <- makeShader "twoD/basic" [vert,frag] [3,4] ETriangles
|
||||
bslist <- makeShader "dualTwoD/basic" [vert,frag] [3,4] ETriangles
|
||||
aslist <- makeShader "twoD/arc" [vert,frag] [3,4,3] ETriangles
|
||||
eslist <- makeShader "twoD/ellipse" [vert,geom,frag] [3,4] ETriangles
|
||||
bezierQuadShader <- makeShader "twoD/bezierQuad" [vert,frag] [3,4,4] ETriangleStrip
|
||||
@@ -104,7 +104,7 @@ preloadRender = do
|
||||
rboLightingName <- genObjectName
|
||||
bindRenderbuffer Renderbuffer $= rboLightingName
|
||||
renderbufferStorage Renderbuffer Depth24Stencil8 (RenderbufferSize 800 600)
|
||||
fboLightingName <- setupFramebufferGivenStencil rboLightingName
|
||||
--fboLightingName <- setupFramebufferGivenStencil rboLightingName
|
||||
|
||||
rboBaseBloomName <- genObjectName
|
||||
bindRenderbuffer Renderbuffer $= rboBaseBloomName
|
||||
@@ -113,6 +113,9 @@ preloadRender = do
|
||||
fboBaseName <- setupFramebufferGivenStencil rboBaseBloomName
|
||||
fboBloomName <- setupFramebufferGivenStencil rboBaseBloomName
|
||||
fboColorName <- setupFramebufferGivenStencil rboBaseBloomName
|
||||
fboPosName <- setupFramebufferGivenStencil rboBaseBloomName
|
||||
fboLightingName <- setupFramebufferGivenStencil rboBaseBloomName
|
||||
fboLightingHighName <- setupFramebufferGivenStencil rboBaseBloomName
|
||||
|
||||
fboFourth1Name <- setupTextureFramebuffer 300 300
|
||||
fboFourth2Name <- setupTextureFramebuffer 300 300
|
||||
@@ -154,10 +157,12 @@ preloadRender = do
|
||||
, _fboFourth1 = fboFourth1Name
|
||||
, _fboFourth2 = fboFourth2Name
|
||||
, _fboLighting = fboLightingName
|
||||
, _rboLighting = rboLightingName
|
||||
, _fboLightingHigh = fboLightingHighName
|
||||
--, _rboLighting = rboLightingName
|
||||
, _fboBase = fboBaseName
|
||||
, _fboBloom = fboBloomName
|
||||
, _fboColor = fboColorName
|
||||
, _fboPos = fboPosName
|
||||
, _rboBaseBloom = rboBaseBloomName
|
||||
, _matUBO = theUBO
|
||||
}
|
||||
|
||||
+16
-14
@@ -35,20 +35,22 @@ createLightMap pdata lightPoints nWalls nSils nsurfVs = do
|
||||
-- clear buffer to full alpha and furthest depth
|
||||
-- clearColor is specified in preloadRender
|
||||
clearColor $= Color4 1 1 1 1
|
||||
clear [ColorBuffer,DepthBuffer]
|
||||
--colorMask $= Color4 Disabled Disabled Disabled Disabled
|
||||
cullFace $= Just Back
|
||||
cullFace $= Nothing
|
||||
-- we assume that the camera position uniforms have been correctly set elsewhere
|
||||
-- draw wall surfaces from the camera's point of view in order to set z buffer
|
||||
drawShader (_lightingWallShader pdata) nWalls
|
||||
-- draw foreground elements the camera's your point of view to set z buffer
|
||||
drawShader (_lightingSurfaceShader pdata) nsurfVs
|
||||
-- draw wall occlusions from the camera's point of view
|
||||
drawShader (_lightingOccludeShader pdata) nWalls
|
||||
--hypothesis: the above three draw calls only work because the
|
||||
--uniform was set to your position, that being the last light source in the list
|
||||
--if this hypothesis is correct, then the code is brittle and should be changed
|
||||
clear [ColorBuffer]
|
||||
-- we assume that the renderbuffer's depth has been correctly set elsewhere
|
||||
-- clear [ColorBuffer,DepthBuffer]
|
||||
-- --colorMask $= Color4 Disabled Disabled Disabled Disabled
|
||||
-- cullFace $= Just Back
|
||||
-- cullFace $= Nothing
|
||||
-- -- we assume that the camera position uniforms have been correctly set elsewhere
|
||||
-- -- draw wall surfaces from the camera's point of view in order to set z buffer
|
||||
-- drawShader (_lightingWallShader pdata) nWalls
|
||||
-- -- draw foreground elements the camera's your point of view to set z buffer
|
||||
-- drawShader (_lightingSurfaceShader pdata) nsurfVs
|
||||
-- -- draw wall occlusions from the camera's point of view
|
||||
-- drawShader (_lightingOccludeShader pdata) nWalls
|
||||
-- --hypothesis: the above three draw calls only work because the
|
||||
-- --uniform was set to your position, that being the last light source in the list
|
||||
-- --if this hypothesis is correct, then the code is brittle and should be changed
|
||||
|
||||
-- for each of the lights:
|
||||
-- stencil out the walls from this light's point of view
|
||||
|
||||
Reference in New Issue
Block a user