2 uniform int uTDInstanceIDOffset;
\r
3 uniform int uTDNumInstances;
\r
4 uniform float uTDAlphaTestVal;
\r
5 #define TD_NUM_COLOR_BUFFERS 1
\r
6 #define TD_NUM_LIGHTS 0
\r
7 #define TD_NUM_SHADOWED_LIGHTS 0
\r
8 #define TD_NUM_ENV_LIGHTS 0
\r
9 #define TD_LIGHTS_ARRAY_SIZE 1
\r
10 #define TD_ENV_LIGHTS_ARRAY_SIZE 1
\r
11 #define TD_NUM_CAMERAS 1
\r
12 struct TDPhongResult
\r
17 float shadowStrength;
\r
23 float shadowStrength;
\r
30 mat4 worldCamInverse;
\r
34 mat4 camProjInverse;
\r
38 mat4 worldCamProjInverse;
\r
40 mat3 worldForNormals;
\r
42 mat3 worldCamForNormals;
\r
44 layout(std140) uniform TDMatricesBlock {
\r
45 TDMatrix uTDMats[TD_NUM_CAMERAS];
\r
52 int renderTOPCameraIndex;
\r
54 layout(std140) uniform TDCameraInfoBlock {
\r
55 TDCameraInfo uTDCamInfos[TD_NUM_CAMERAS];
\r
66 layout(std140) uniform TDGeneralBlock {
\r
67 TDGeneral uTDGeneral;
\r
69 layout(location = 0) in vec3 P;
\r
70 layout(location = 1) in vec3 N;
\r
71 layout(location = 2) in vec4 Cd;
\r
72 layout(location = 3) in vec3 uv[8];
\r
73 vec4 TDWorldToProj(vec4 v);
\r
74 vec4 TDWorldToProj(vec3 v);
\r
75 vec4 TDWorldToProj(vec4 v, vec3 uv);
\r
76 vec4 TDWorldToProj(vec3 v, vec3 uv);
\r
78 int TDCameraIndex();
\r
79 vec3 TDUVUnwrapCoord();
\r
80 /*********TOUCHDEFORMPREFIX**********/
\r
81 #define TD_NUM_BONES 0
\r
83 vec3 TDInstanceTexCoord(int instanceID, vec3 t);
\r
84 vec4 TDInstanceColor(int instanceID, vec4 curColor);
\r
86 vec4 TDDeform(vec4 pos);
\r
87 vec4 TDDeform(vec3 pos);
\r
88 vec3 TDInstanceTexCoord(vec3 t);
\r
89 vec4 TDInstanceColor(vec4 curColor);
\r
97 flat int cameraIndex;
\r
104 { // Avoid duplicate variable defs
\r
105 vec3 texcoord = TDInstanceTexCoord(uv[0]);
\r
106 oVert.texCoord0.stp = texcoord.stp;
\r
108 // First deform the vertex and normal
\r
109 // TDDeform always returns values in world space
\r
110 oVert.instance = TDInstanceID();
\r
111 vec4 worldSpacePos = TDDeform(P);
\r
112 vec3 uvUnwrapCoord = TDInstanceTexCoord(TDUVUnwrapCoord());
\r
113 gl_Position = TDWorldToProj(worldSpacePos, uvUnwrapCoord);
\r
116 // This is here to ensure we only execute lighting etc. code
\r
117 // when we need it. If picking is active we don't need lighting, so
\r
118 // this entire block of code will be ommited from the compile.
\r
119 // The TD_PICKING_ACTIVE define will be set automatically when
\r
120 // picking is active.
\r
122 int cameraIndex = TDCameraIndex();
\r
123 oVert.cameraIndex = cameraIndex;
\r
124 oVert.worldSpacePos.xyz = worldSpacePos.xyz;
\r
125 oVert.color = TDInstanceColor(Cd);
\r