summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-05 17:43:59 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-05 17:57:19 +0200
commiteb0da9b80fa412202200cd5255e0e0eb6a9e38e9 (patch)
treed707aed353fca4b3d6e99cf9513338990c92062a
parent8af5e1a9fbd48d173bd1cd98f153428234638707 (diff)
fix whitespace issues
Change-Id: I7a3680aa324c4242572b71c91ec5bc4f85eff9e9
-rw-r--r--chart2/opengl/shape3DFragmentShader.glsl55
-rw-r--r--chart2/opengl/shape3DVertexShader.glsl5
2 files changed, 31 insertions, 29 deletions
diff --git a/chart2/opengl/shape3DFragmentShader.glsl b/chart2/opengl/shape3DFragmentShader.glsl
index f527dd1da689..5cb521afccab 100644
--- a/chart2/opengl/shape3DFragmentShader.glsl
+++ b/chart2/opengl/shape3DFragmentShader.glsl
@@ -6,27 +6,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#version 330 core
+#version 330 core
#define MAX_LIGHT_NUM 8
in vec3 positionWorldspace;
in vec3 normalCameraspace;
uniform mat4 V;
out vec4 actualColor;
-struct MaterialParameters
-{
- vec4 ambient;
- vec4 diffuse;
- vec4 specular;
+struct MaterialParameters
+{
+ vec4 ambient;
+ vec4 diffuse;
+ vec4 specular;
vec4 materialColor;
-
+
int twoSidesLighting;
float shininess;
float pad;
float pad1;
};
-layout(std140) uniform GlobalMaterialParameters
+layout(std140) uniform GlobalMaterialParameters
{
MaterialParameters matralParameter;
}Material;
@@ -51,23 +51,23 @@ layout(std140) uniform GlobalLights
void main()
{
vec3 colorTotal = vec3(0.0f, 0.0f, 0.0f);
-
+
vec3 vertexPositionCameraspace = (V * vec4(positionWorldspace,1)).xyz;
-
+
vec3 MaterialDiffuseColor = Material.matralParameter.materialColor.rgb;
-
+
vec3 normalDirectionCameraspace = normalCameraspace;
- vec3 eyeDirectionCameraspace = normalize(vec3(0, 0, 0) - vertexPositionCameraspace);
+ vec3 eyeDirectionCameraspace = normalize(vec3(0, 0, 0) - vertexPositionCameraspace);
float attenuation = 1.0;
int i = 0;
vec3 lightDirectionCameraspace;
vec3 vertexToLightSource;
-
+
vec3 lightAmbient = Lights.ambient.rgb *
- MaterialDiffuseColor *
+ MaterialDiffuseColor *
Material.matralParameter.ambient.rgb
* 5.0;
-
+
if ((Material.matralParameter.twoSidesLighting == 1) && (!gl_FrontFacing))
{
normalDirectionCameraspace = -normalDirectionCameraspace;
@@ -76,15 +76,15 @@ void main()
{
float LightPower = Lights.light[i].lightPower;
lightDirectionCameraspace = normalize((V * Lights.light[i].positionWorldspace).xyz);
-
+
float cosTheta = clamp(dot(normalDirectionCameraspace,lightDirectionCameraspace), 0,1);
- vec3 lightDiffuse = LightPower *
- attenuation *
- Lights.light[i].lightColor.rgb *
- MaterialDiffuseColor *
- Material.matralParameter.diffuse.rgb *
+ vec3 lightDiffuse = LightPower *
+ attenuation *
+ Lights.light[i].lightColor.rgb *
+ MaterialDiffuseColor *
+ Material.matralParameter.diffuse.rgb *
cosTheta;
-
+
vec3 specularReflection;
if (dot(normalDirectionCameraspace, lightDirectionCameraspace) < 0)
{
@@ -94,17 +94,18 @@ void main()
{
vec3 R = reflect(-lightDirectionCameraspace,normalDirectionCameraspace);
float cosAlpha = clamp(dot(eyeDirectionCameraspace, R), 0,1);
- specularReflection = attenuation *
- LightPower *
- Lights.light[i].lightColor.rgb *
+ specularReflection = attenuation *
+ LightPower *
+ Lights.light[i].lightColor.rgb *
Material.matralParameter.specular.rgb *
MaterialDiffuseColor *
pow(max(0.0, cosAlpha), Material.matralParameter.shininess);
}
colorTotal += lightDiffuse + specularReflection;
-
+
}
colorTotal += lightAmbient;
actualColor = vec4(colorTotal, 1.0);
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/shape3DVertexShader.glsl b/chart2/opengl/shape3DVertexShader.glsl
index 4587feb780da..d0bd69370a49 100644
--- a/chart2/opengl/shape3DVertexShader.glsl
+++ b/chart2/opengl/shape3DVertexShader.glsl
@@ -21,9 +21,10 @@ uniform mat3 normalMatrix;
void main()
{
gl_Position = P * V * M * vec4(vertexPositionModelspace,1);
-
+
positionWorldspace = (M * vec4(vertexPositionModelspace,1)).xyz;
normalCameraspace = normalize(mat3(V) * normalMatrix * vertexNormalModelspace);
}
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */