Przeglądaj źródła

fix spelling and remove typeof #2

ranbuch 5 lat temu
rodzic
commit
78398149bf

+ 2 - 2
docs/api/en/renderers/WebGLRenderer.html

@@ -473,12 +473,12 @@
 
 
 		<h3>[method:null setOpaqueSort]( [param:Function method] )</h3>
 		<h3>[method:null setOpaqueSort]( [param:Function method] )</h3>
 		<p>
 		<p>
-		Sets the costum opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
+		Sets the custom opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
 		</p>
 		</p>
 
 
 		<h3>[method:null setTransparentSort]( [param:Function method] )</h3>
 		<h3>[method:null setTransparentSort]( [param:Function method] )</h3>
 		<p>
 		<p>
-		Sets the costum transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function. In some cases the transparent materials sort may get rendered in the wrong order. This issue may cause materials to rendere behind other materials instead of the front of them and vice versa.
+		Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function. In some cases the transparent materials sort may get rendered in the wrong order. This issue may cause materials to rendere behind other materials instead of the front of them and vice versa.
 		</p>
 		</p>
 
 
 		<h3>[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )</h3>
 		<h3>[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )</h3>

+ 2 - 2
src/renderers/WebGLRenderer.d.ts

@@ -259,12 +259,12 @@ export class WebGLRenderer implements Renderer {
 	setScissorTest( enable: boolean ): void;
 	setScissorTest( enable: boolean ): void;
 
 
 	/**
 	/**
-	 * Sets the costum opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
+	 * Sets the custom opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function.
 	 */
 	 */
 	setOpaqueSort( method: Function ): void;
 	setOpaqueSort( method: Function ): void;
 
 
 	/**
 	/**
-	 * Sets the costum transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
+	 * Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
 	 */
 	 */
 	setTransparentSort( method: Function ): void;
 	setTransparentSort( method: Function ): void;
 
 

+ 5 - 5
src/renderers/WebGLRenderer.js

@@ -162,6 +162,8 @@ function WebGLRenderer( parameters ) {
 		_height = _canvas.height,
 		_height = _canvas.height,
 
 
 		_pixelRatio = 1,
 		_pixelRatio = 1,
+		_opaqueSort = null,
+		_transparentSort = null,
 
 
 		_viewport = new Vector4( 0, 0, _width, _height ),
 		_viewport = new Vector4( 0, 0, _width, _height ),
 		_scissor = new Vector4( 0, 0, _width, _height ),
 		_scissor = new Vector4( 0, 0, _width, _height ),
@@ -253,8 +255,6 @@ function WebGLRenderer( parameters ) {
 
 
 	var background, morphtargets, bufferRenderer, indexedBufferRenderer;
 	var background, morphtargets, bufferRenderer, indexedBufferRenderer;
 
 
-	var opaqueSort, transparentSort;
-
 	var utils;
 	var utils;
 
 
 	function initGLContext() {
 	function initGLContext() {
@@ -509,13 +509,13 @@ function WebGLRenderer( parameters ) {
 
 
 	this.setOpaqueSort = function ( method ) {
 	this.setOpaqueSort = function ( method ) {
 
 
-		opaqueSort = typeof method === 'function' ? method : null;
+		_opaqueSort = method;
 
 
 	};
 	};
 
 
 	this.setTransparentSort = function ( method ) {
 	this.setTransparentSort = function ( method ) {
 
 
-		transparentSort = typeof method === 'function' ? method : null;
+		_transparentSort = method;
 
 
 	};
 	};
 
 
@@ -1168,7 +1168,7 @@ function WebGLRenderer( parameters ) {
 
 
 		if ( _this.sortObjects === true ) {
 		if ( _this.sortObjects === true ) {
 
 
-			currentRenderList.sort( opaqueSort, transparentSort );
+			currentRenderList.sort( _opaqueSort, _transparentSort );
 
 
 		}
 		}
 
 

+ 3 - 3
src/renderers/webgl/WebGLRenderLists.js

@@ -130,10 +130,10 @@ function WebGLRenderList() {
 
 
 	}
 	}
 
 
-	function sort( costumOpaqueSort, costumTransparentSort ) {
+	function sort( customOpaqueSort, customTransparentSort ) {
 
 
-		if ( opaque.length > 1 ) opaque.sort( costumOpaqueSort || painterSortStable );
-		if ( transparent.length > 1 ) transparent.sort( costumTransparentSort || reversePainterSortStable );
+		if ( opaque.length > 1 ) opaque.sort( customOpaqueSort || painterSortStable );
+		if ( transparent.length > 1 ) transparent.sort( customTransparentSort || reversePainterSortStable );
 
 
 	}
 	}