Moving to a simpler lighting shader

This commit is contained in:
samcake 2016-09-01 12:10:15 -07:00
parent 354cbbc927
commit a537f40158
3 changed files with 9 additions and 9 deletions

View file

@ -218,10 +218,10 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo
state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP)); state->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::NOT_EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
if (lightVolume) { if (lightVolume) {
state->setCullMode(gpu::State::CULL_BACK); state->setCullMode(gpu::State::CULL_FRONT);
state->setDepthTest(true, true, gpu::LESS_EQUAL); state->setDepthTest(true, false, gpu::GREATER_EQUAL);
state->setDepthClampEnable(true); //state->setDepthClampEnable(true);
// TODO: We should use DepthClamp and avoid changing geometry for inside /outside cases // TODO: We should use DepthClamp and avoid changing geometry for inside /outside cases
// additive blending // additive blending
state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE); state->setBlendFunction(true, gpu::State::ONE, gpu::State::BLEND_OP_ADD, gpu::State::ONE);

View file

@ -46,10 +46,10 @@ void main(void) {
} }
// Kill if in front of the light volume // Kill if in front of the light volume
float depth = frag.depthVal; /* float depth = frag.depthVal;
if (depth < gl_FragCoord.z) { if (depth < gl_FragCoord.z) {
discard; discard;
} }*/
// Need the light now // Need the light now
Light light = getLight(); Light light = getLight();

View file

@ -31,8 +31,8 @@ in vec4 _texCoord0;
out vec4 _fragColor; out vec4 _fragColor;
void main(void) { void main(void) {
_fragColor = vec4(1.0, 0.0, 0.0, 1.0);// /* _fragColor = vec4(1.0, 0.0, 0.0, 1.0);//
return; return;*/
DeferredFrameTransform deferredTransform = getDeferredFrameTransform(); DeferredFrameTransform deferredTransform = getDeferredFrameTransform();
// Grab the fragment data from the uv // Grab the fragment data from the uv
@ -47,9 +47,9 @@ void main(void) {
// Kill if in front of the light volume // Kill if in front of the light volume
float depth = frag.depthVal; float depth = frag.depthVal;
if (depth < gl_FragCoord.z) { /* if (depth < gl_FragCoord.z) {
discard; discard;
} }*/
// Need the light now // Need the light now
Light light = getLight(); Light light = getLight();