Separate cloud & surface lighting
This commit is contained in:
@@ -12,5 +12,6 @@ void main()
|
||||
//float d = min(dot(vControls,vControls),1);
|
||||
fCol = vec4(vCol.xyz,vCol.w*(1-d));
|
||||
fPos = vec4(vPos, fCol.w);
|
||||
fNorm = vec4(-vControls, -0.1 + 0.2 * d ,fCol.w);
|
||||
//fNorm = vec4(-vControls, -0.1 + 0.2 * d ,fCol.w);
|
||||
fNorm = vec4(-vControls, -0.1 + 0.3 * d ,fCol.w);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ data RenderData = RenderData
|
||||
, _lightingLineShadowShader :: GLuint
|
||||
, _lightingCapShader :: GLuint
|
||||
, _lightingTextureShader :: GLuint
|
||||
, _lightingCloudShader :: GLuint
|
||||
, _ceilingStencilShader :: GLuint
|
||||
, _alphaDivideShader :: GLuint
|
||||
, _windowPullShader :: GLuint
|
||||
|
||||
@@ -160,6 +160,7 @@ doDrawing' win pdata u = do
|
||||
glEnable GL_BLEND
|
||||
--draw lightmap into its own buffer
|
||||
createLightMap
|
||||
False
|
||||
(w ^. wCam)
|
||||
cfig
|
||||
(cfig ^. gr_shadow_rendering)
|
||||
@@ -284,6 +285,7 @@ doDrawing' win pdata u = do
|
||||
glEnable GL_BLEND
|
||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
||||
createLightMap
|
||||
True
|
||||
(w ^. wCam)
|
||||
cfig
|
||||
(cfig ^. gr_shadows_on_clouds)
|
||||
|
||||
@@ -127,6 +127,7 @@ preloadRender = do
|
||||
-- transcompshader <- makeSourcedShader "fullscreen/transparencyComp" [vert, frag]
|
||||
bloomBlurShad <- makeSourcedShader "texture/bloomBlur" [vert, frag]
|
||||
lightingTextureShad <- makeSourcedShader "lighting/texture" [vert, frag]
|
||||
lightingCloudShad <- makeSourcedShader "lighting/cloud" [vert, frag]
|
||||
|
||||
distbo <- mglCreate glCreateBuffers
|
||||
let distbosize = sizeOf (0 :: Float) * 8 * 1024
|
||||
@@ -189,6 +190,7 @@ preloadRender = do
|
||||
-- , _transparencyCompShader = transcompshader
|
||||
, _alphaDivideShader = alphadivideshader
|
||||
, _lightingTextureShader = lightingTextureShad
|
||||
, _lightingCloudShader = lightingCloudShad
|
||||
, _bloomBlurShader = bloomBlurShad
|
||||
, _barrelShader = (barrelShad,distvbo)
|
||||
, _fbo2 = framebuf2
|
||||
|
||||
+8
-6
@@ -26,6 +26,7 @@ import Shader.Data
|
||||
away" from the shape colors.
|
||||
-}
|
||||
createLightMap ::
|
||||
Bool -> -- True if it is for clouds
|
||||
Camera ->
|
||||
Config ->
|
||||
ShadowRendering ->
|
||||
@@ -42,12 +43,10 @@ createLightMap ::
|
||||
[(Point3, Float, Point3)] -> -- Lights
|
||||
RenderData ->
|
||||
IO ()
|
||||
createLightMap cam cfig shadrendertype = case shadrendertype of
|
||||
createLightMap t cam cfig shadrendertype = case shadrendertype of
|
||||
NoShadows -> const . const . const renderLightingNoShadows
|
||||
NoLighting -> const . const . const . const . const . const renderFlatLighting
|
||||
_ -> renderShadows cam cfig shadrendertype
|
||||
-- where
|
||||
-- shadrendertype = cfig ^. gr_shadow_rendering
|
||||
_ -> renderShadows t cam cfig shadrendertype
|
||||
|
||||
renderLightingNoShadows ::
|
||||
TO ->
|
||||
@@ -118,6 +117,7 @@ renderFlatLighting pdata = do
|
||||
glStencilOp GL_KEEP GL_KEEP GL_KEEP
|
||||
|
||||
renderShadows ::
|
||||
Bool -> -- True if it is for clouds
|
||||
Camera ->
|
||||
Config ->
|
||||
ShadowRendering ->
|
||||
@@ -129,12 +129,14 @@ renderShadows ::
|
||||
[(Point3, Float, Point3)] ->
|
||||
RenderData ->
|
||||
IO ()
|
||||
renderShadows cam cfig shadrendertype nWalls nSils nCaps positiontexture normaltexture lightPoints pdata = do
|
||||
renderShadows isclouds cam cfig shadrendertype nWalls nSils nCaps positiontexture normaltexture lightPoints pdata = do
|
||||
glBindFramebuffer GL_FRAMEBUFFER $ pdata ^. fboLighting . _1 . unFBO
|
||||
let llinesShad = _lightingLineShadowShader pdata
|
||||
lcapShad = _lightingCapShader pdata
|
||||
shadwall = _shadWallShader pdata
|
||||
ltextShad = _lightingTextureShader pdata
|
||||
ltextShad
|
||||
| isclouds = pdata ^. lightingCloudShader
|
||||
| otherwise = _lightingTextureShader pdata
|
||||
-- we assume that the renderbuffer's depth has been correctly set elsewhere
|
||||
-- we will not be changing that here
|
||||
glDepthMask GL_FALSE
|
||||
|
||||
Reference in New Issue
Block a user