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