浏览代码

Fix parallaxmap shader crash

Fixes #5813.
dubejf 10 年之前
父节点
当前提交
1736aa73ba
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      examples/js/shaders/ParallaxShader.js

+ 3 - 1
examples/js/shaders/ParallaxShader.js

@@ -82,7 +82,9 @@ THREE.ParallaxShader = {
 				"float heightFromTexture = texture2D( bumpMap, currentTextureCoords ).r;",
 
 				// while ( heightFromTexture > currentLayerHeight )
-				"for ( int i = 0; i == 0; i += 0 ) {",
+				// Infinite loops are not well supported. Do a "large" finite
+				// loop, but not too large, as it slows down some compilers.
+				"for ( int i = 0; i < 30; i += 1 ) {",
 					"if ( heightFromTexture <= currentLayerHeight ) {",
 						"break;",
 					"}",