Просмотр исходного кода

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

rtortajada 11 месяцев назад
Родитель
Сommit
2d978cb7ee
1 измененных файлов с 3 добавлено и 4 удалено
  1. 3 4
      examples/jsm/lines/LineMaterial.js

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

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

粤ICP备19079148号