diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 63: Use a vec4 for the MaterialColor uniform, so that the alpha value can be specified by the user.

Message ID 20110721123634.17019.16569.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org July 21, 2011, 12:36 p.m. UTC
------------------------------------------------------------
revno: 63
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
timestamp: Fri 2010-11-19 15:11:20 +0200
message:
  Use a vec4 for the MaterialColor uniform, so that the alpha value can be specified by the user.
modified:
  data/shaders/light-advanced.frag
  data/shaders/light-basic.vert
  src/scenebuild.cpp
  src/sceneshading.cpp
  src/scenetexture.cpp


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'data/shaders/light-advanced.frag'
--- data/shaders/light-advanced.frag	2010-07-28 14:52:54 +0000
+++ data/shaders/light-advanced.frag	2010-11-19 13:11:20 +0000
@@ -8,7 +8,7 @@ 
 uniform vec3 MaterialAmbient;
 uniform vec3 MaterialDiffuse;
 uniform vec3 MaterialSpecular;
-uniform vec3 MaterialColor;
+uniform vec4 MaterialColor;
 
 varying vec3 Normal;
 varying vec3 Light;
@@ -32,5 +32,5 @@ 
 
     // Calculate the final color
     gl_FragColor = vec4(ambient, 1.0) + vec4(specular, 1.0) +
-                   vec4(diffuse, 1.0) * vec4(MaterialColor, 1.0);
+                   vec4(diffuse, 1.0) * MaterialColor;
 }

=== modified file 'data/shaders/light-basic.vert'
--- data/shaders/light-basic.vert	2010-07-09 13:34:12 +0000
+++ data/shaders/light-basic.vert	2010-11-19 13:11:20 +0000
@@ -5,7 +5,7 @@ 
 uniform mat4 ModelViewProjectionMatrix;
 uniform mat4 NormalMatrix;
 uniform vec4 LightSourcePosition;
-uniform vec3 MaterialColor;
+uniform vec4 MaterialColor;
 
 varying vec4 Color;
 varying vec2 TextureCoord;
@@ -21,7 +21,7 @@ 
     // Multiply the diffuse value by the vertex color (which is fixed in this case)
     // to get the actual color that we will use to draw this vertex with
     float diffuse = max(dot(N, L), 0.0);
-    Color = diffuse * vec4(MaterialColor, 1.0);
+    Color = diffuse * MaterialColor;
 
     // Set the texture coordinates as a varying
     TextureCoord = texcoord;

=== modified file 'src/scenebuild.cpp'
--- src/scenebuild.cpp	2010-11-19 12:03:25 +0000
+++ src/scenebuild.cpp	2010-11-19 13:11:20 +0000
@@ -85,7 +85,7 @@ 
     glUniform3fv(mShader.mLocations.LightSourceAmbient, 1, lightAmbient);
     glUniform3fv(mShader.mLocations.LightSourceDiffuse, 1, lightDiffuse);
 
-    glUniform3fv(mShader.mLocations.MaterialColor, 1, materialColor);
+    glUniform4fv(mShader.mLocations.MaterialColor, 1, materialColor);
 
     mCurrentFrame = 0;
     mRunning = true;

=== modified file 'src/sceneshading.cpp'
--- src/sceneshading.cpp	2010-11-19 12:03:25 +0000
+++ src/sceneshading.cpp	2010-11-19 13:11:20 +0000
@@ -99,7 +99,7 @@ 
     glUniform3fv(mShader[mCurrentPart].mLocations.MaterialAmbient, 1, materialAmbient);
     glUniform3fv(mShader[mCurrentPart].mLocations.MaterialDiffuse, 1, materialDiffuse);
     glUniform3fv(mShader[mCurrentPart].mLocations.MaterialSpecular, 1, materialSpecular);
-    glUniform3fv(mShader[mCurrentPart].mLocations.MaterialColor, 1, materialColor);
+    glUniform4fv(mShader[mCurrentPart].mLocations.MaterialColor, 1, materialColor);
 
     // Calculate and load the half vector
     Vector3f halfVector = Vector3f(lightPosition[0], lightPosition[1], lightPosition[2]);

=== modified file 'src/scenetexture.cpp'
--- src/scenetexture.cpp	2010-07-15 08:59:36 +0000
+++ src/scenetexture.cpp	2010-11-19 13:11:20 +0000
@@ -91,7 +91,7 @@ 
     glUniform3fv(mShader.mLocations.LightSourceAmbient, 1, lightAmbient);
     glUniform3fv(mShader.mLocations.LightSourceDiffuse, 1, lightDiffuse);
 
-    glUniform3fv(mShader.mLocations.MaterialColor, 1, materialColor);
+    glUniform4fv(mShader.mLocations.MaterialColor, 1, materialColor);
 
     mCurrentFrame = 0;
     mRunning = true;