mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:23:33 +02:00
Fixing all the shaders for entities to work correctly with the now supported color attribute field
This commit is contained in:
parent
f0efade06d
commit
ad9129b552
15 changed files with 48 additions and 18 deletions
|
@ -19,9 +19,11 @@
|
||||||
uniform sampler2D diffuseMap;
|
uniform sampler2D diffuseMap;
|
||||||
|
|
||||||
// the interpolated normal
|
// the interpolated normal
|
||||||
varying vec3 vertexColor;
|
|
||||||
varying vec4 normal;
|
varying vec4 normal;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// Fetch diffuse map
|
// Fetch diffuse map
|
||||||
vec4 diffuse = texture2D(diffuseMap, gl_TexCoord[0].st);
|
vec4 diffuse = texture2D(diffuseMap, gl_TexCoord[0].st);
|
||||||
|
@ -31,7 +33,7 @@ void main(void) {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(normal.xyz),
|
normalize(normal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb * vertexColor,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
getMaterialSpecular(mat),
|
getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat));
|
getMaterialShininess(mat));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,15 @@ const int MAX_TEXCOORDS = 2;
|
||||||
|
|
||||||
uniform mat4 texcoordMatrices[MAX_TEXCOORDS];
|
uniform mat4 texcoordMatrices[MAX_TEXCOORDS];
|
||||||
|
|
||||||
|
|
||||||
// the interpolated normal
|
// the interpolated normal
|
||||||
varying vec3 vertexColor;
|
|
||||||
varying vec4 normal;
|
varying vec4 normal;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
vertexColor = gl_Color.xyz;
|
color = gl_Color.xyz;
|
||||||
|
|
||||||
// and the texture coordinates
|
// and the texture coordinates
|
||||||
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
||||||
|
|
|
@ -26,6 +26,8 @@ uniform vec2 emissiveParams;
|
||||||
// the interpolated normal
|
// the interpolated normal
|
||||||
varying vec4 normal;
|
varying vec4 normal;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
// the interpolated texcoord1
|
// the interpolated texcoord1
|
||||||
varying vec2 interpolatedTexcoord1;
|
varying vec2 interpolatedTexcoord1;
|
||||||
|
|
||||||
|
@ -39,7 +41,7 @@ void main(void) {
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(normal.xyz),
|
normalize(normal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
getMaterialSpecular(mat),
|
getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat),
|
getMaterialShininess(mat),
|
||||||
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
||||||
|
|
|
@ -28,9 +28,12 @@ varying vec4 normal;
|
||||||
// the interpolated texcoord1
|
// the interpolated texcoord1
|
||||||
varying vec2 interpolatedTexcoord1;
|
varying vec2 interpolatedTexcoord1;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
gl_FrontColor = gl_Color;
|
color = gl_Color.xyz;
|
||||||
|
|
||||||
// and the texture coordinates
|
// and the texture coordinates
|
||||||
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
||||||
|
|
|
@ -34,6 +34,8 @@ varying vec4 interpolatedTangent;
|
||||||
|
|
||||||
varying vec2 interpolatedTexcoord1;
|
varying vec2 interpolatedTexcoord1;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// compute the view normal from the various bits
|
// compute the view normal from the various bits
|
||||||
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
||||||
|
@ -52,7 +54,7 @@ void main(void) {
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(viewNormal.xyz),
|
normalize(viewNormal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
getMaterialSpecular(mat),
|
getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat),
|
getMaterialShininess(mat),
|
||||||
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
||||||
|
|
|
@ -34,13 +34,15 @@ varying vec4 interpolatedTangent;
|
||||||
// the interpolated texcoord1
|
// the interpolated texcoord1
|
||||||
varying vec2 interpolatedTexcoord1;
|
varying vec2 interpolatedTexcoord1;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// transform and store the normal and tangent for interpolation
|
// transform and store the normal and tangent for interpolation
|
||||||
//interpolatedNormal = gl_ModelViewMatrix * vec4(gl_Normal, 0.0);
|
//interpolatedNormal = gl_ModelViewMatrix * vec4(gl_Normal, 0.0);
|
||||||
//interpolatedTangent = gl_ModelViewMatrix * vec4(tangent, 0.0);
|
//interpolatedTangent = gl_ModelViewMatrix * vec4(tangent, 0.0);
|
||||||
|
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
gl_FrontColor = gl_Color;
|
color = gl_Color.xyz;
|
||||||
|
|
||||||
// and the texture coordinates
|
// and the texture coordinates
|
||||||
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
||||||
|
|
|
@ -37,6 +37,9 @@ varying vec4 interpolatedTangent;
|
||||||
|
|
||||||
varying vec2 interpolatedTexcoord1;
|
varying vec2 interpolatedTexcoord1;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// compute the view normal from the various bits
|
// compute the view normal from the various bits
|
||||||
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
||||||
|
@ -56,7 +59,7 @@ void main(void) {
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(viewNormal.xyz),
|
normalize(viewNormal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
specular, // no use of getMaterialSpecular(mat)
|
specular, // no use of getMaterialSpecular(mat)
|
||||||
getMaterialShininess(mat),
|
getMaterialShininess(mat),
|
||||||
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
||||||
|
|
|
@ -31,6 +31,8 @@ varying vec4 normal;
|
||||||
|
|
||||||
varying vec2 interpolatedTexcoord1;
|
varying vec2 interpolatedTexcoord1;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// set the diffuse, normal, specular data
|
// set the diffuse, normal, specular data
|
||||||
vec4 diffuse = texture2D(diffuseMap, gl_TexCoord[0].st);
|
vec4 diffuse = texture2D(diffuseMap, gl_TexCoord[0].st);
|
||||||
|
@ -42,7 +44,7 @@ void main(void) {
|
||||||
packDeferredFragmentLightmap(
|
packDeferredFragmentLightmap(
|
||||||
normalize(normal.xyz),
|
normalize(normal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
specular, // no use of getMaterialSpecular(mat)
|
specular, // no use of getMaterialSpecular(mat)
|
||||||
getMaterialShininess(mat),
|
getMaterialShininess(mat),
|
||||||
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));
|
||||||
|
|
|
@ -28,6 +28,8 @@ varying vec4 interpolatedNormal;
|
||||||
// the interpolated tangent
|
// the interpolated tangent
|
||||||
varying vec4 interpolatedTangent;
|
varying vec4 interpolatedTangent;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// compute the view normal from the various bits
|
// compute the view normal from the various bits
|
||||||
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
||||||
|
@ -44,7 +46,7 @@ void main(void) {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(viewNormal.xyz),
|
normalize(viewNormal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
getMaterialSpecular(mat),
|
getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat));
|
getMaterialShininess(mat));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,15 @@ varying vec4 interpolatedNormal;
|
||||||
// the interpolated tangent
|
// the interpolated tangent
|
||||||
varying vec4 interpolatedTangent;
|
varying vec4 interpolatedTangent;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// transform and store the normal and tangent for interpolation
|
// transform and store the normal and tangent for interpolation
|
||||||
//interpolatedNormal = gl_ModelViewMatrix * vec4(gl_Normal, 0.0);
|
//interpolatedNormal = gl_ModelViewMatrix * vec4(gl_Normal, 0.0);
|
||||||
//interpolatedTangent = gl_ModelViewMatrix * vec4(tangent, 0.0);
|
//interpolatedTangent = gl_ModelViewMatrix * vec4(tangent, 0.0);
|
||||||
|
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
gl_FrontColor = gl_Color;
|
color = gl_Color.xyz;
|
||||||
|
|
||||||
// and the texture coordinates
|
// and the texture coordinates
|
||||||
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
||||||
|
|
|
@ -31,6 +31,8 @@ varying vec4 interpolatedNormal;
|
||||||
// the interpolated tangent
|
// the interpolated tangent
|
||||||
varying vec4 interpolatedTangent;
|
varying vec4 interpolatedTangent;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// compute the view normal from the various bits
|
// compute the view normal from the various bits
|
||||||
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
vec3 normalizedNormal = normalize(vec3(interpolatedNormal));
|
||||||
|
@ -49,7 +51,7 @@ void main(void) {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(viewNormal.xyz),
|
normalize(viewNormal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
specular, //getMaterialSpecular(mat),
|
specular, //getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat));
|
getMaterialShininess(mat));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ uniform sampler2D specularMap;
|
||||||
// the interpolated normal
|
// the interpolated normal
|
||||||
varying vec4 normal;
|
varying vec4 normal;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
// set the diffuse, normal, specular data
|
// set the diffuse, normal, specular data
|
||||||
vec4 diffuse = texture2D(diffuseMap, gl_TexCoord[0].st);
|
vec4 diffuse = texture2D(diffuseMap, gl_TexCoord[0].st);
|
||||||
|
@ -35,7 +37,7 @@ void main(void) {
|
||||||
packDeferredFragment(
|
packDeferredFragment(
|
||||||
normalize(normal.xyz),
|
normalize(normal.xyz),
|
||||||
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
specular, //getMaterialSpecular(mat),
|
specular, //getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat));
|
getMaterialShininess(mat));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ uniform sampler2D diffuseMap;
|
||||||
|
|
||||||
varying vec4 normal;
|
varying vec4 normal;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
|
|
||||||
// Fetch diffuse map
|
// Fetch diffuse map
|
||||||
|
@ -31,7 +33,7 @@ void main(void) {
|
||||||
packDeferredFragmentTranslucent(
|
packDeferredFragmentTranslucent(
|
||||||
normalize(normal.xyz),
|
normalize(normal.xyz),
|
||||||
getMaterialOpacity(mat) * diffuse.a,
|
getMaterialOpacity(mat) * diffuse.a,
|
||||||
getMaterialDiffuse(mat) * diffuse.rgb,
|
getMaterialDiffuse(mat) * diffuse.rgb * color,
|
||||||
getMaterialSpecular(mat),
|
getMaterialSpecular(mat),
|
||||||
getMaterialShininess(mat));
|
getMaterialShininess(mat));
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ attribute vec4 clusterWeights;
|
||||||
// the interpolated normal
|
// the interpolated normal
|
||||||
varying vec4 normal;
|
varying vec4 normal;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
vec4 position = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
normal = vec4(0.0, 0.0, 0.0, 0.0);
|
normal = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
@ -39,7 +41,7 @@ void main(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
gl_FrontColor = gl_Color;
|
color = gl_Color.xyz;
|
||||||
|
|
||||||
// and the texture coordinates
|
// and the texture coordinates
|
||||||
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
||||||
|
|
|
@ -34,6 +34,8 @@ varying vec4 interpolatedNormal;
|
||||||
// the interpolated tangent
|
// the interpolated tangent
|
||||||
varying vec4 interpolatedTangent;
|
varying vec4 interpolatedTangent;
|
||||||
|
|
||||||
|
varying vec3 color;
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
vec4 interpolatedPosition = vec4(0.0, 0.0, 0.0, 0.0);
|
vec4 interpolatedPosition = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0);
|
interpolatedNormal = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
|
@ -47,7 +49,7 @@ void main(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// pass along the diffuse color
|
// pass along the diffuse color
|
||||||
gl_FrontColor = gl_Color;
|
color = gl_Color.xyz;
|
||||||
|
|
||||||
// and the texture coordinates
|
// and the texture coordinates
|
||||||
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
gl_TexCoord[0] = texcoordMatrices[0] * vec4(gl_MultiTexCoord0.xy, 0.0, 1.0);
|
||||||
|
|
Loading…
Reference in a new issue