Last change
on this file since 12232 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
1.5 KB
|
Line | |
---|
1 | //--------------------------------------------------------------------------- |
---|
2 | //These materials/shaders are part of the NEW InstanceManager implementation |
---|
3 | //Written by Matias N. Goldberg ("dark_sylinc") |
---|
4 | //--------------------------------------------------------------------------- |
---|
5 | #version 120 |
---|
6 | |
---|
7 | //Vertex input |
---|
8 | attribute vec4 vertex; |
---|
9 | attribute vec3 normal; |
---|
10 | attribute vec3 tangent; |
---|
11 | attribute vec4 uv0; |
---|
12 | attribute vec4 blendIndices; |
---|
13 | attribute vec4 blendWeights; |
---|
14 | |
---|
15 | //Parameters |
---|
16 | uniform mat4 viewProjMatrix; |
---|
17 | uniform mat4 worldMatrix; |
---|
18 | |
---|
19 | #if (DEPTH_SHADOWCASTER || DEPTH_SHADOWRECEIVER) |
---|
20 | uniform vec4 depthRange; |
---|
21 | #endif |
---|
22 | |
---|
23 | #if DEPTH_SHADOWRECEIVER |
---|
24 | uniform mat4 texViewProjMatrix; |
---|
25 | #endif |
---|
26 | |
---|
27 | //Output |
---|
28 | #if DEPTH_SHADOWCASTER |
---|
29 | varying vec2 depth; |
---|
30 | #else |
---|
31 | varying vec2 _uv0; |
---|
32 | varying vec3 oNormal; |
---|
33 | varying vec3 oVPos; |
---|
34 | #if DEPTH_SHADOWRECEIVER |
---|
35 | varying vec4 oLightSpacePos; |
---|
36 | #endif |
---|
37 | #endif |
---|
38 | //--------------------------------------------- |
---|
39 | //Main Vertex Shader |
---|
40 | //--------------------------------------------- |
---|
41 | void main(void) |
---|
42 | { |
---|
43 | vec4 worldPos = vertex * worldMatrix; |
---|
44 | vec3 worldNorm = normal * mat3(worldMatrix); |
---|
45 | |
---|
46 | //Transform the position |
---|
47 | gl_Position = viewProjMatrix * worldPos; |
---|
48 | |
---|
49 | #if DEPTH_SHADOWCASTER |
---|
50 | depth.x = (gl_Position.z - depthRange.x) * depthRange.w; |
---|
51 | depth.y = depthRange.w; |
---|
52 | #else |
---|
53 | _uv0 = uv0.xy; |
---|
54 | oNormal = worldNorm; |
---|
55 | oVPos = worldPos.xyz; |
---|
56 | |
---|
57 | #if DEPTH_SHADOWRECEIVER |
---|
58 | oLightSpacePos = texViewProjMatrix * worldPos; |
---|
59 | oLightSpacePos.z = (oLightSpacePos.z - depthRange.x) * depthRange.w; |
---|
60 | #endif |
---|
61 | #endif |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.