summaryrefslogtreecommitdiffstats
path: root/res/effectlib/vertexFragmentBase.glsllib
blob: 02d4f5bd36db212cf67efcaa831ed54ee267197d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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