diff options
Diffstat (limited to 'assets/shaders/ub_vshader.glsl')
-rwxr-xr-x | assets/shaders/ub_vshader.glsl | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/assets/shaders/ub_vshader.glsl b/assets/shaders/ub_vshader.glsl index da8a8660..43c7c9fc 100755 --- a/assets/shaders/ub_vshader.glsl +++ b/assets/shaders/ub_vshader.glsl | |||
@@ -59,9 +59,9 @@ uniform vec3 u_eye; | |||
59 | uniform vec3 u_light0Atten; | 59 | uniform vec3 u_light0Atten; |
60 | uniform vec2 u_light0Spot; | 60 | uniform vec2 u_light0Spot; |
61 | uniform vec4 u_light0Color; | 61 | uniform vec4 u_light0Color; |
62 | uniform vec4 u_light0Specular; | 62 | uniform vec4 u_light0Specular; |
63 | varying vec3 v_light0Dir; | 63 | varying vec3 v_light0Dir; |
64 | varying vec3 v_light0SpotDir; | 64 | varying vec3 v_light0SpotDir; |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | #if defined( LIGHT_1 ) | 67 | #if defined( LIGHT_1 ) |
@@ -71,9 +71,9 @@ uniform vec3 u_eye; | |||
71 | uniform vec3 u_light1Atten; | 71 | uniform vec3 u_light1Atten; |
72 | uniform vec2 u_light1Spot; | 72 | uniform vec2 u_light1Spot; |
73 | uniform vec3 u_light1Color; | 73 | uniform vec3 u_light1Color; |
74 | uniform vec4 u_light1Specular; | 74 | uniform vec4 u_light1Specular; |
75 | varying vec3 v_light1Dir; | 75 | varying vec3 v_light1Dir; |
76 | varying vec3 v_light1SpotDir; | 76 | varying vec3 v_light1SpotDir; |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #if defined( LIGHT_2 ) | 79 | #if defined( LIGHT_2 ) |
@@ -83,9 +83,9 @@ uniform vec3 u_eye; | |||
83 | uniform vec3 u_light2Atten; | 83 | uniform vec3 u_light2Atten; |
84 | uniform vec2 u_light2Spot; // 0 - spot light cutoff angle, 1 - spot light exponent | 84 | uniform vec2 u_light2Spot; // 0 - spot light cutoff angle, 1 - spot light exponent |
85 | uniform vec3 u_light2Color; | 85 | uniform vec3 u_light2Color; |
86 | uniform vec4 u_light2Specular; | 86 | uniform vec4 u_light2Specular; |
87 | varying vec3 v_light2Dir; | 87 | varying vec3 v_light2Dir; |
88 | varying vec3 v_light2SpotDir; | 88 | varying vec3 v_light2SpotDir; |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | #if defined( LIGHT_3 ) | 91 | #if defined( LIGHT_3 ) |
@@ -95,9 +95,9 @@ uniform vec3 u_eye; | |||
95 | uniform vec3 u_light3Atten; | 95 | uniform vec3 u_light3Atten; |
96 | uniform vec2 u_light3Spot; | 96 | uniform vec2 u_light3Spot; |
97 | uniform vec3 u_light3Color; | 97 | uniform vec3 u_light3Color; |
98 | uniform vec4 u_light3Specular; | 98 | uniform vec4 u_light3Specular; |
99 | varying vec3 v_light3Dir; | 99 | varying vec3 v_light3Dir; |
100 | varying vec3 v_light3SpotDir; | 100 | varying vec3 v_light3SpotDir; |
101 | #endif | 101 | #endif |
102 | #endif | 102 | #endif |
103 | 103 | ||
@@ -123,60 +123,60 @@ void main() { | |||
123 | v_eyeDir = vec3(-u_viewMatrix[3][0], -u_viewMatrix[3][1], -u_viewMatrix[3][2]); | 123 | v_eyeDir = vec3(-u_viewMatrix[3][0], -u_viewMatrix[3][1], -u_viewMatrix[3][2]); |
124 | #if defined( LIGHT_0 ) | 124 | #if defined( LIGHT_0 ) |
125 | { | 125 | { |
126 | vec3 lpos = ( u_viewMatrix * vec4( u_light0Pos, 1.0 ) ).xyz; | 126 | vec3 lpos = ( u_viewMatrix * vec4( u_light0Pos, 1.0 ) ).xyz; |
127 | 127 | ||
128 | #if ( LIGHT_0 == 0 ) | 128 | #if ( LIGHT_0 == 0 ) |
129 | v_light0Dir = ( u_viewMatrix * vec4( -u_light0Dir, 0.0 ) ).xyz; | 129 | v_light0Dir = ( u_viewMatrix * vec4( -u_light0Dir, 0.0 ) ).xyz; |
130 | #else | 130 | #else |
131 | v_light0Dir = lpos - v_mvPos; | 131 | v_light0Dir = lpos - v_mvPos; |
132 | #if ( LIGHT_0 == 2 ) | 132 | #if ( LIGHT_0 == 2 ) |
133 | v_light0SpotDir = (u_viewMatrix * vec4( -u_light0Dir, 0.0 )).xyz; | 133 | v_light0SpotDir = (u_viewMatrix * vec4( -u_light0Dir, 0.0 )).xyz; |
134 | #endif // ( LIGHT_0 == 2 ) | 134 | #endif // ( LIGHT_0 == 2 ) |
135 | #endif // ( LIGHT_0 == 0 ) | 135 | #endif // ( LIGHT_0 == 0 ) |
136 | } | 136 | } |
137 | #endif // defined( LIGHT_0 ) | 137 | #endif // defined( LIGHT_0 ) |
138 | #if defined( LIGHT_1 ) | 138 | #if defined( LIGHT_1 ) |
139 | { | 139 | { |
140 | vec3 lpos = ( u_viewMatrix * vec4( u_light1Pos, 1.0 ) ).xyz; | 140 | vec3 lpos = ( u_viewMatrix * vec4( u_light1Pos, 1.0 ) ).xyz; |
141 | 141 | ||
142 | #if ( LIGHT_1 == 0 ) | 142 | #if ( LIGHT_1 == 0 ) |
143 | v_light1Dir = ( u_viewMatrix * vec4( -u_light1Dir, 0.0 ) ).xyz; | 143 | v_light1Dir = ( u_viewMatrix * vec4( -u_light1Dir, 0.0 ) ).xyz; |
144 | #else | 144 | #else |
145 | v_light1Dir = lpos - v_mvPos; | 145 | v_light1Dir = lpos - v_mvPos; |
146 | #if ( LIGHT_1 == 2 ) | 146 | #if ( LIGHT_1 == 2 ) |
147 | v_light1SpotDir = (u_viewMatrix * vec4( -u_light1Dir, 0.0 )).xyz; | 147 | v_light1SpotDir = (u_viewMatrix * vec4( -u_light1Dir, 0.0 )).xyz; |
148 | #endif // ( LIGHT_1 == 2 ) | 148 | #endif // ( LIGHT_1 == 2 ) |
149 | #endif // ( LIGHT_1 == 0 ) | 149 | #endif // ( LIGHT_1 == 0 ) |
150 | } | 150 | } |
151 | #endif // defined( LIGHT_1 ) | 151 | #endif // defined( LIGHT_1 ) |
152 | #if defined( LIGHT_2 ) | 152 | #if defined( LIGHT_2 ) |
153 | { | 153 | { |
154 | vec3 lpos = ( u_viewMatrix * vec4( u_light2Pos, 1.0 ) ).xyz; | 154 | vec3 lpos = ( u_viewMatrix * vec4( u_light2Pos, 1.0 ) ).xyz; |
155 | 155 | ||
156 | #if ( LIGHT_2 == 0 ) | 156 | #if ( LIGHT_2 == 0 ) |
157 | v_light2Dir = ( u_viewMatrix * vec4( -u_light2Dir, 0.0 ) ).xyz; | 157 | v_light2Dir = ( u_viewMatrix * vec4( -u_light2Dir, 0.0 ) ).xyz; |
158 | #else | 158 | #else |
159 | v_light2Dir = lpos - v_mvPos; | 159 | v_light2Dir = lpos - v_mvPos; |
160 | #if ( LIGHT_2 == 2 ) | 160 | #if ( LIGHT_2 == 2 ) |
161 | v_light2SpotDir = (u_viewMatrix * vec4( -u_light2Dir, 0.0 )).xyz; | 161 | v_light2SpotDir = (u_viewMatrix * vec4( -u_light2Dir, 0.0 )).xyz; |
162 | #endif // ( LIGHT_2 == 2 ) | 162 | #endif // ( LIGHT_2 == 2 ) |
163 | #endif // ( LIGHT_2 == 0 ) | 163 | #endif // ( LIGHT_2 == 0 ) |
164 | } | 164 | } |
165 | #endif // defined( LIGHT_2 ) | 165 | #endif // defined( LIGHT_2 ) |
166 | #if defined( LIGHT_3 ) | 166 | #if defined( LIGHT_3 ) |
167 | { | 167 | { |
168 | vec3 lpos = ( u_viewMatrix * vec4( u_light3Pos, 1.0 ) ).xyz; | 168 | vec3 lpos = ( u_viewMatrix * vec4( u_light3Pos, 1.0 ) ).xyz; |
169 | 169 | ||
170 | #if ( LIGHT_3 == 0 ) | 170 | #if ( LIGHT_3 == 0 ) |
171 | v_light3Dir = ( u_viewMatrix * vec4( -u_light3Dir, 0.0 ) ).xyz; | 171 | v_light3Dir = ( u_viewMatrix * vec4( -u_light3Dir, 0.0 ) ).xyz; |
172 | #else | 172 | #else |
173 | v_light3Dir = lpos - v_mvPos; | 173 | v_light3Dir = lpos - v_mvPos; |
174 | #if ( LIGHT_3 == 2 ) | 174 | #if ( LIGHT_3 == 2 ) |
175 | v_light3SpotDir = (u_viewMatrix * vec4( -u_light3Dir, 0.0 )).xyz; | 175 | v_light3SpotDir = (u_viewMatrix * vec4( -u_light3Dir, 0.0 )).xyz; |
176 | #endif // ( LIGHT_3 == 2 ) | 176 | #endif // ( LIGHT_3 == 2 ) |
177 | #endif // ( LIGHT_3 == 0 ) | 177 | #endif // ( LIGHT_3 == 0 ) |
178 | } | 178 | } |
179 | #endif // defined( LIGHT_3 ) | 179 | #endif // defined( LIGHT_3 ) |
180 | #endif // defined( LIGHTING ) | 180 | #endif // defined( LIGHTING ) |
181 | 181 | ||
182 | // pass along the geo | 182 | // pass along the geo |