diff options
Diffstat (limited to 'res/effectlib/vertexFragmentBase.glsllib')
-rw-r--r-- | res/effectlib/vertexFragmentBase.glsllib | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/res/effectlib/vertexFragmentBase.glsllib b/res/effectlib/vertexFragmentBase.glsllib new file mode 100644 index 0000000..02d4f5b --- /dev/null +++ b/res/effectlib/vertexFragmentBase.glsllib @@ -0,0 +1,31 @@ +#ifndef VERTEX_FRAGMENT_BASE_GLSLLIB +#define VERTEX_FRAGMENT_BASE_GLSLLIB + + //FRAGMENT_SHADER + uniform vec3 eyePosition; //position in world space of the camera + +// add global variables +vec3 normal; +vec3 surfNormal; +vec3 texCoord0; +vec3 tangent; +vec3 binormal; +vec3 viewDir; + + +// add shader input + +void initializeBaseFragmentVariables() +{ + normal = normalize( varNormal ); + surfNormal = normalize( varNormal ); + + texCoord0 = vec3( varTexCoord0.xy, 1.0 ); + tangent = normalize( varTangent ); + + binormal = normalize( varBinormal ); + + viewDir = normalize( eyePosition - varWorldPos ); +} + +#endif |