Modify vertex shaders to use new uniforms
This commit is contained in:
parent
59d29c6431
commit
2dd2996737
@ -42,6 +42,8 @@ uniform vec4 uOffsetPlayerPosition;
|
|||||||
|
|
||||||
varying vec4 vColor;
|
varying vec4 vColor;
|
||||||
|
|
||||||
|
uniform mat4 ooliteModelViewProjection;
|
||||||
|
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
@ -55,7 +57,7 @@ void main(void)
|
|||||||
|
|
||||||
// Project the dust, and find its distance from the camera.
|
// Project the dust, and find its distance from the camera.
|
||||||
position.w = 1.0;
|
position.w = 1.0;
|
||||||
position = gl_ModelViewProjectionMatrix * position;
|
position = ooliteModelViewProjection * position;
|
||||||
gl_Position = position;
|
gl_Position = position;
|
||||||
|
|
||||||
float distance = length(position);
|
float distance = length(position);
|
||||||
|
@ -21,15 +21,18 @@
|
|||||||
MA 02110-1301, USA.
|
MA 02110-1301, USA.
|
||||||
S*/
|
S*/
|
||||||
|
|
||||||
|
uniform mat3 ooliteNormalMatrix;
|
||||||
|
uniform mat4 ooliteModelView;
|
||||||
|
uniform mat4 ooliteModelViewProjection;
|
||||||
varying vec3 vNormal;
|
varying vec3 vNormal;
|
||||||
varying vec3 vEyeVector;
|
varying vec3 vEyeVector;
|
||||||
|
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
vNormal = normalize(gl_NormalMatrix * gl_Normal);
|
vNormal = normalize(ooliteNormalMatrix * gl_Normal);
|
||||||
vEyeVector = -vec3(gl_ModelViewMatrix * gl_Vertex);
|
vEyeVector = -vec3(ooliteModelView * gl_Vertex);
|
||||||
|
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
gl_Position = ooliteModelViewProjection * gl_Vertex;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
|
|
||||||
attribute vec3 tangent;
|
attribute vec3 tangent;
|
||||||
|
|
||||||
|
uniform mat3 ooliteNormalMatrix;
|
||||||
|
uniform mat4 ooliteModelView;
|
||||||
|
uniform mat4 ooliteModelViewProjection;
|
||||||
|
|
||||||
// No vNormal, because normal is always 0,0,1 in tangent space.
|
// No vNormal, because normal is always 0,0,1 in tangent space.
|
||||||
varying vec3 vEyeVector;
|
varying vec3 vEyeVector;
|
||||||
@ -44,13 +47,13 @@ varying vec3 vCubeTexCoords;
|
|||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
// Build tangent basis
|
// Build tangent basis
|
||||||
vec3 n = normalize(gl_NormalMatrix * gl_Normal);
|
vec3 n = normalize(ooliteNormalMatrix * gl_Normal);
|
||||||
vec3 t = normalize(gl_NormalMatrix * tangent);
|
vec3 t = normalize(ooliteNormalMatrix * tangent);
|
||||||
vec3 b = cross(n, t);
|
vec3 b = cross(n, t);
|
||||||
|
|
||||||
mat3 TBN = mat3(t, b, n);
|
mat3 TBN = mat3(t, b, n);
|
||||||
|
|
||||||
vec3 eyeVector = -vec3(gl_ModelViewMatrix * gl_Vertex);
|
vec3 eyeVector = -vec3(ooliteModelView * gl_Vertex);
|
||||||
vEyeVector = eyeVector * TBN;
|
vEyeVector = eyeVector * TBN;
|
||||||
|
|
||||||
vec3 lightVector = gl_LightSource[1].position.xyz;
|
vec3 lightVector = gl_LightSource[1].position.xyz;
|
||||||
@ -62,5 +65,5 @@ void main(void)
|
|||||||
vCubeTexCoords = gl_Vertex.xyz;
|
vCubeTexCoords = gl_Vertex.xyz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
gl_Position = ooliteModelViewProjection * gl_Vertex;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user