From bc32da74ca5463ede944e2212f21a124329061f8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 3 Mar 2015 23:10:47 -0600 Subject: [PATCH 1/2] https://github.com/GarageGames/Torque3D/issues/770 resolution suggested by @LuisAntonRebollo --- .../source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp | 5 +++++ .../source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp b/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp index 9a76d471b..4f430ae64 100644 --- a/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp @@ -92,6 +92,11 @@ void GBufferConditionerGLSL::processVert( Vector &componentLis // grab incoming vert normal Var *inNormal = (Var*) LangElement::find( "normal" ); + if (!inNormal) + { + inNormal = new Var("normal", "vec3"); + meta->addStatement(new GenOp(" @ = vec3( 0.0, 0.0, 1.0 );\r\n", new DecOp(inNormal))); + } AssertFatal( inNormal, "Something went bad with ShaderGen. The normal should be already defined." ); // grab output for gbuffer normal diff --git a/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp b/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp index ed946e944..1a5b896a9 100644 --- a/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp @@ -92,6 +92,11 @@ void GBufferConditionerHLSL::processVert( Vector &componentLis // grab incoming vert normal Var *inNormal = (Var*) LangElement::find( "normal" ); + if (!inNormal) + { + inNormal = new Var("normal", "float3"); + meta->addStatement(new GenOp(" @ = float3( 0.0, 0.0, 1.0 );\r\n", new DecOp(inNormal))); + } AssertFatal( inNormal, "Something went bad with ShaderGen. The normal should be already defined." ); // grab output for gbuffer normal From 1067da284f60b9c9f28fb6211ef7cfbced349183 Mon Sep 17 00:00:00 2001 From: LuisAntonRebollo Date: Sun, 8 Mar 2015 22:10:22 +0100 Subject: [PATCH 2/2] Add error msg to Shadergen when GBufferConditioner?LSL::processVert don't have normals defined. --- Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp | 1 + Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp b/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp index 4f430ae64..6e5795e83 100644 --- a/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/gBufferConditionerGLSL.cpp @@ -96,6 +96,7 @@ void GBufferConditionerGLSL::processVert( Vector &componentLis { inNormal = new Var("normal", "vec3"); meta->addStatement(new GenOp(" @ = vec3( 0.0, 0.0, 1.0 );\r\n", new DecOp(inNormal))); + Con::errorf("ShagerGen: Something went bad with ShaderGen. The normal should be already defined."); } AssertFatal( inNormal, "Something went bad with ShaderGen. The normal should be already defined." ); diff --git a/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp b/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp index 1a5b896a9..93f9477e9 100644 --- a/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/gBufferConditionerHLSL.cpp @@ -96,6 +96,7 @@ void GBufferConditionerHLSL::processVert( Vector &componentLis { inNormal = new Var("normal", "float3"); meta->addStatement(new GenOp(" @ = float3( 0.0, 0.0, 1.0 );\r\n", new DecOp(inNormal))); + Con::errorf("ShagerGen: Something went bad with ShaderGen. The normal should be already defined."); } AssertFatal( inNormal, "Something went bad with ShaderGen. The normal should be already defined." );