[Bf-blender-cvs] [e960cecdf8d] blender2.8: GPU: Silence warning of potentially unused variable (NormalMatrix)

Dalai Felinto noreply at git.blender.org
Fri Jul 7 15:10:29 CEST 2017


Commit: e960cecdf8d1cef32f8c42e633ad05a08a97972b
Author: Dalai Felinto
Date:   Fri Jul 7 15:09:03 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe960cecdf8d1cef32f8c42e633ad05a08a97972b

GPU: Silence warning of potentially unused variable (NormalMatrix)

===================================================================

M	source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl

===================================================================

diff --git a/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl b/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
index 94cd960872a..fa30c9fb1ed 100644
--- a/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
@@ -26,9 +26,7 @@ out vec3 fCol;
 
 // TODO: in float angle; // [-pi .. +pi], + peak, 0 flat, - valley
 
-mat3 NormalMatrix;
-
-bool front(vec3 N, vec3 eye)
+bool front(mat3 NormalMatrix, vec3 N, vec3 eye)
 {
 	return dot(NormalMatrix * N, eye) > 0.0;
 }
@@ -41,7 +39,7 @@ void main()
 
 	MV_pos = ModelViewMatrix * vec4(pos, 1.0);
 
-	NormalMatrix = transpose(inverse(mat3(ModelViewMatrix)));
+	mat3 NormalMatrix = transpose(inverse(mat3(ModelViewMatrix)));
 
 	/* if persp */
 	if (ProjectionMatrix[3][3] == 0.0) {
@@ -51,8 +49,8 @@ void main()
 		eye = vec3(0.0, 0.0, 1.0);
 	}
 
-	bool face_1_front = front(N1, eye);
-	bool face_2_front = front(N2, eye);
+	bool face_1_front = front(NormalMatrix, N1, eye);
+	bool face_2_front = front(NormalMatrix, N2, eye);
 
 	if (face_1_front && face_2_front)
 		edgeClass = 1.0; // front-facing edge




More information about the Bf-blender-cvs mailing list