Browse Source

cast to float; kill `.toFixed`

ycw 4 years ago
parent
commit
461b102128
2 changed files with 3 additions and 3 deletions
  1. 2 2
      examples/jsm/postprocessing/SSRPass.js
  2. 1 1
      examples/jsm/shaders/SSRShader.js

+ 2 - 2
examples/jsm/postprocessing/SSRPass.js

@@ -220,7 +220,7 @@ var SSRPass = function ( { renderer, scene, camera, width, height, selects, enco
 
 	this.ssrMaterial = new ShaderMaterial( {
 		defines: Object.assign( {}, SSRShader.defines, {
-			MAX_STEP: Math.sqrt( this.width * this.width + this.height * this.height ).toFixed(1)
+			MAX_STEP: Math.sqrt( this.width * this.width + this.height * this.height )
 		} ),
 		uniforms: UniformsUtils.clone( SSRShader.uniforms ),
 		vertexShader: SSRShader.vertexShader,
@@ -639,7 +639,7 @@ SSRPass.prototype = Object.assign( Object.create( Pass.prototype ), {
 		this.width = width;
 		this.height = height;
 
-		this.ssrMaterial.defines.MAX_STEP = Math.sqrt( width * width + height * height ).toFixed(1);
+		this.ssrMaterial.defines.MAX_STEP = Math.sqrt( width * width + height * height );
 		this.ssrMaterial.needsUpdate = true;
 		this.beautyRenderTarget.setSize( width, height );
 		this.prevRenderTarget.setSize( width, height );

+ 1 - 1
examples/jsm/shaders/SSRShader.js

@@ -163,7 +163,7 @@ var SSRShader = {
 			float totalStep=max(abs(xLen),abs(yLen));
 			float xSpan=xLen/totalStep;
 			float ySpan=yLen/totalStep;
-			for(float i=0.;i<MAX_STEP;i++){
+			for(float i=0.;i<float(MAX_STEP);i++){
 				if(i>=totalStep) break;
 				vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan);
 				if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break;