Skip to content

Commit

Permalink
use fixed AT for now
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Dec 9, 2016
1 parent 403f6cb commit 0717fd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
25 changes: 12 additions & 13 deletions cont/base/springcontent/shaders/GLSL/ShadowGenFragProg.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ uniform sampler2D alphaMaskTex;
varying vec4 vertexShadowClipPos;

void main() {
if (texture2D(alphaMaskTex, gl_TexCoord[0].st).a <= 0.5)
discard;

#if 0
#if 0
float nearDepth = gl_DepthRange.near;
float farDepth = gl_DepthRange.far;
float depthRange = gl_DepthRange.diff; // far - near
float clipDepth = vertexShadowClipPos.z / vertexShadowClipPos.w;
float nearDepth = gl_DepthRange.near;
float farDepth = gl_DepthRange.far;
float depthRange = gl_DepthRange.diff; // far - near
float clipDepth = vertexShadowClipPos.z / vertexShadowClipPos.w;

// useful to keep around
gl_FragDepth = ((depthRange * clipDepth) + nearDepth + farDepth) / 2.0;
// useful to keep around
gl_FragDepth = ((depthRange * clipDepth) + nearDepth + farDepth) * 0.5;

#else
#else

// no-op, but would break early-z
// gl_FragDepth = gl_FragCoord.z;
#endif
// no-op, but breaks early-z
gl_FragDepth = gl_FragCoord.z;
#endif

gl_FragColor = texture2D(alphaMaskTex, gl_TexCoord[0].st);
}

4 changes: 2 additions & 2 deletions rts/Rendering/ShadowHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ void CShadowHandler::LoadShadowGenShaderProgs()
for (int i = 0; i < SHADOWGEN_PROGRAM_LAST; i++) {
Shader::IProgramObject* po = sh->CreateProgramObject("[ShadowHandler]", shadowGenProgHandles[i] + "GLSL", false);
Shader::IShaderObject* vso = sh->CreateShaderObject("GLSL/ShadowGenVertProg.glsl", shadowGenProgDefines[i] + extraDef, GL_VERTEX_SHADER);
Shader::IShaderObject* fso = sh->CreateShaderObject("GLSL/ShadowGenFragProg.glsl", shadowGenProgDefines[i] + extraDef, GL_FRAGMENT_SHADER);
// Shader::IShaderObject* fso = sh->CreateShaderObject("GLSL/ShadowGenFragProg.glsl", shadowGenProgDefines[i] + extraDef, GL_FRAGMENT_SHADER);

po->AttachShaderObject(vso);
po->AttachShaderObject(fso);
// po->AttachShaderObject(fso);
po->Link();
po->SetUniformLocation("shadowParams"); // idx 0
po->SetUniformLocation("cameraDirX"); // idx 1, used by SHADOWGEN_PROGRAM_TREE_NEAR
Expand Down

0 comments on commit 0717fd7

Please sign in to comment.