소스 검색

fix spelling and remove typeof #2

ranbuch 5 년 전
부모
커밋
78398149bf
4개의 변경된 파일12개의 추가작업 그리고 12개의 파일을 삭제
  1. 2 2
      docs/api/en/renderers/WebGLRenderer.html
  2. 2 2
      src/renderers/WebGLRenderer.d.ts
  3. 5 5
      src/renderers/WebGLRenderer.js
  4. 3 3
      src/renderers/webgl/WebGLRenderLists.js

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

@@ -473,12 +473,12 @@
 
 		<h3>[method:null setOpaqueSort]( [param:Function method] )</h3>
 		<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>
 
 		<h3>[method:null setTransparentSort]( [param:Function method] )</h3>
 		<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>
 
 		<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;
 
 	/**
-	 * 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;
 
 	/**
-	 * 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;
 

+ 5 - 5
src/renderers/WebGLRenderer.js

@@ -162,6 +162,8 @@ function WebGLRenderer( parameters ) {
 		_height = _canvas.height,
 
 		_pixelRatio = 1,
+		_opaqueSort = null,
+		_transparentSort = null,
 
 		_viewport = 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 opaqueSort, transparentSort;
-
 	var utils;
 
 	function initGLContext() {
@@ -509,13 +509,13 @@ function WebGLRenderer( parameters ) {
 
 	this.setOpaqueSort = function ( method ) {
 
-		opaqueSort = typeof method === 'function' ? method : null;
+		_opaqueSort = method;
 
 	};
 
 	this.setTransparentSort = function ( method ) {
 
-		transparentSort = typeof method === 'function' ? method : null;
+		_transparentSort = method;
 
 	};
 
@@ -1168,7 +1168,7 @@ function WebGLRenderer( parameters ) {
 
 		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 );
 
 	}