Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/data_extern/programs/GLSL150/instancingVp.glsl @ 12181

Last change on this file since 12181 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 1009 bytes
Line 
1#version 150
2
3in vec4 position;
4in vec3 normal;
5in vec4 uv0;
6in float uv1;
7
8out vec4 oColor_0;
9#if SHADOW_CASTER
10#else
11out vec2 oTexcoord2_0;
12#endif
13
14uniform mat4x3 worldMatrix3x4Array[80];
15uniform mat4 viewProjectionMatrix;
16uniform vec4 lightPos;
17uniform vec4 ambient;
18uniform vec4 lightDiffuseColour;
19
20void main()
21{
22#if SHADOW_CASTER
23        // transform by indexed matrix
24        vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0);
25
26        // view / projection
27        gl_Position = viewProjectionMatrix * transformedPos;
28       
29        oColor_0 = ambient;
30#else
31        // transform by indexed matrix
32        vec4 transformedPos = vec4((worldMatrix3x4Array[int(uv1)] * position).xyz, 1.0);
33       
34        // view / projection
35        gl_Position = viewProjectionMatrix * transformedPos;
36        oTexcoord2_0 = uv0.xy;
37
38        vec3 norm = mat3(worldMatrix3x4Array[int(uv1)]) * normal;
39       
40        vec3 lightDir =         normalize(
41                lightPos.xyz -  (transformedPos.xyz * lightPos.w));
42
43        oColor_0 = ambient + clamp(dot(lightDir, norm), 0.0, 1.0) * lightDiffuseColour;
44#endif
45}
46
Note: See TracBrowser for help on using the repository browser.