From c9daf8df7bdb3fb479e7683e67f6a7c8ea5a5c41 Mon Sep 17 00:00:00 2001 From: BeaR Date: Tue, 16 Apr 2013 19:01:18 +0200 Subject: [PATCH] Cleanup and fix vertex shader --- GPU/GLES/TransformPipeline.cpp | 2 +- GPU/GLES/VertexShaderGenerator.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index f3aae9f272..bc907c210d 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -341,7 +341,7 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[ if (dot > 0.0f) { Color4 lightSpec(gstate_c.lightColor[2][l], 0.0f); - lightSum1 += (lightSpec * *specular * (powf(dot, specCoef_) * (dot * lightScale))); + lightSum1 += (lightSpec * *specular * (powf(dot, specCoef_) * lightScale)); } } diff --git a/GPU/GLES/VertexShaderGenerator.cpp b/GPU/GLES/VertexShaderGenerator.cpp index 82a4c1184d..81135c70d3 100644 --- a/GPU/GLES/VertexShaderGenerator.cpp +++ b/GPU/GLES/VertexShaderGenerator.cpp @@ -301,7 +301,7 @@ void GenerateVertexShader(int prim, char *buffer) { if (hasColor) { WRITE(p, " lowp vec3 unlitColor = a_color0.rgb;\n"); } else { - WRITE(p, " lowp vec3 unlitColor = vec3(u_matambientalpha);\n"); + WRITE(p, " lowp vec3 unlitColor = u_matambientalpha.rgb;\n"); } // TODO: Declare variables for dots for shade mapping if needed. @@ -364,7 +364,7 @@ void GenerateVertexShader(int prim, char *buffer) { WRITE(p, " vec3 halfVec%i = normalize(normalize(toLight%i) + vec3(0.0, 0.0, 1.0));\n", i, i); WRITE(p, " dot%i = dot(halfVec%i, worldnormal);\n", i, i); WRITE(p, " if (dot%i > 0.0)\n", i); - WRITE(p, " lightSum1 += u_lightspecular%i * %s * (pow(dot%i, u_matspecular.a) * (dot%i * lightScale%i));\n", i, specular, i, i, i); + WRITE(p, " lightSum1 += u_lightspecular%i * %s * (pow(dot%i, u_matspecular.a) * lightScale%i);\n", i, specular, i, i); } WRITE(p, " lightSum0 += vec4((u_lightambient%i + diffuse%i)*lightScale%i, 0.0);\n", i, i, i); }