src/gl/compiler.cpp

changeset 37
90443fb328ea
parent 35
98906a94732f
child 39
caac957e9834
--- a/src/gl/compiler.cpp	Fri Jan 31 00:25:35 2020 +0200
+++ b/src/gl/compiler.cpp	Sat Feb 01 15:33:57 2020 +0200
@@ -37,12 +37,29 @@
 uniform mat4 modelMatrix;
 uniform mat4 viewMatrix;
 uniform mat4 projectionMatrix;
+uniform int fragmentStyle;
+
+const int FRAGSTYLE_Normal = 0;
+const int FRAGSTYLE_BfcGreen = 1;
+const int FRAGSTYLE_BfcRed = 2;
+const int FRAGSTYLE_Random = 3;
 
 void main()
 {
 	mat3 normalMatrix = transpose(inverse(mat3(modelMatrix)));
 	vNormal = normalize(normalMatrix * normal);
-	vColor = color;
+	if (fragmentStyle == FRAGSTYLE_BfcGreen)
+	{
+		vColor = vec4(0.2, 0.9, 0.2, 1.0);
+	}
+	else if (fragmentStyle == FRAGSTYLE_BfcRed)
+	{
+		vColor = vec4(0.9, 0.2, 0.2, 1.0);
+	}
+	else
+	{
+		vColor = color;
+	}
 	vFragPos = vec3(modelMatrix * vec4(position, 1.0));
 	gl_Position = projectionMatrix * viewMatrix * vec4(vFragPos, 1.0);
 }

mercurial