Browse Source

Move variable declarations above the line that includes clipping planes shader (#31144)

rtortajada 11 months ago
parent
commit
2d978cb7ee
1 changed files with 3 additions and 4 deletions
  1. 3 4
      examples/jsm/lines/LineMaterial.js

+ 3 - 4
examples/jsm/lines/LineMaterial.js

@@ -311,6 +311,9 @@ ShaderLib[ 'line' ] = {
 
 		void main() {
 
+			float alpha = opacity;
+			vec4 diffuseColor = vec4( diffuse, alpha );
+
 			#include <clipping_planes_fragment>
 
 			#ifdef USE_DASH
@@ -321,8 +324,6 @@ ShaderLib[ 'line' ] = {
 
 			#endif
 
-			float alpha = opacity;
-
 			#ifdef WORLD_UNITS
 
 				// Find the closest points on the view ray and the line segment
@@ -387,8 +388,6 @@ ShaderLib[ 'line' ] = {
 
 			#endif
 
-			vec4 diffuseColor = vec4( diffuse, alpha );
-
 			#include <logdepthbuf_fragment>
 			#include <color_fragment>
 

粤ICP备19079148号