Re-add face culling as required for instanced shadow caps
This commit is contained in:
@@ -16,9 +16,9 @@ vec4 projNear (vec4 pos)
|
|||||||
// note we project to a specific height
|
// note we project to a specific height
|
||||||
// this is quite brittle, not ideal
|
// this is quite brittle, not ideal
|
||||||
vec3 dir = pos.xyz - lightPos ;
|
vec3 dir = pos.xyz - lightPos ;
|
||||||
float a = (140 - pos.z) / dir.z ;
|
float a = (100 - pos.z) / dir.z ;
|
||||||
vec2 xy = (pos.xyz + a * dir).xy ;
|
vec2 xy = (pos.xyz + a * dir).xy ;
|
||||||
return vec4 ( xy, 140 , 1) ;
|
return vec4 ( xy, 100 , 1) ;
|
||||||
}
|
}
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ vec4 projNear(vec4 pos) {
|
|||||||
// note we project to a specific height
|
// note we project to a specific height
|
||||||
// this is quite brittle, not ideal
|
// this is quite brittle, not ideal
|
||||||
vec3 dir = pos.xyz - lightPos;
|
vec3 dir = pos.xyz - lightPos;
|
||||||
float a = (140 - pos.z) / dir.z;
|
float a = (100 - pos.z) / dir.z;
|
||||||
vec2 xy = (pos.xyz + a * dir).xy;
|
vec2 xy = (pos.xyz + a * dir).xy;
|
||||||
return vec4(xy, 140, 1);
|
return vec4(xy, 100, 1);
|
||||||
};
|
};
|
||||||
vec4 shiftNear(vec4 pos) {
|
vec4 shiftNear(vec4 pos) {
|
||||||
vec4 sp = shift(pos);
|
vec4 sp = shift(pos);
|
||||||
if (sp.z > 140) {
|
if (sp.z > 100) {
|
||||||
return projNear(pos);
|
return projNear(pos);
|
||||||
} else {
|
} else {
|
||||||
return sp;
|
return sp;
|
||||||
|
|||||||
+1
-1
@@ -261,7 +261,7 @@ instanceLightMap cfig pdata lightPoints nWalls nSils nCaps toPos = do
|
|||||||
GL_UNSIGNED_SHORT
|
GL_UNSIGNED_SHORT
|
||||||
nullPtr
|
nullPtr
|
||||||
--draw caps on the near plane as required
|
--draw caps on the near plane as required
|
||||||
--glEnable GL_CULL_FACE
|
glEnable GL_CULL_FACE
|
||||||
glCullFace GL_BACK
|
glCullFace GL_BACK
|
||||||
--glCullFace GL_FRONT
|
--glCullFace GL_FRONT
|
||||||
glUseProgram (_shadName lcapShad)
|
glUseProgram (_shadName lcapShad)
|
||||||
|
|||||||
Reference in New Issue
Block a user