From 9908299a06ba0b3622452fefd127264dd31f60cb Mon Sep 17 00:00:00 2001
From: ranbuch [method:null setScissorTest]( [param:Boolean boolean] )
scissor area will be affected by further renderer actions.
+ Sets the costum opaque sort function for the WebGLRenderLists. Pass null to use the default painterSortStable function. +
+ ++ 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. +
+
Resizes the output canvas to (width, height) with device pixel ratio taken into account,
diff --git a/src/renderers/WebGLRenderer.d.ts b/src/renderers/WebGLRenderer.d.ts
index 1a032a2edcee3e..60e3122119f8e8 100644
--- a/src/renderers/WebGLRenderer.d.ts
+++ b/src/renderers/WebGLRenderer.d.ts
@@ -258,6 +258,16 @@ 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.
+ */
+ setOpaqueSort( method: Function ): void;
+
+ /**
+ * Sets the costum transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
+ */
+ setTransparentSort( method: Function ): void;
+
/**
* Returns a THREE.Color instance with the current clear color.
*/
From 78398149bf84a21d381b4c14677c17bb6806c7a2 Mon Sep 17 00:00:00 2001
From: ranbuch
- 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.
- 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.
- 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.
+ Sets the custom transparent sort function for the WebGLRenderLists. Pass null to use the default reversePainterSortStable function.
[method:null setScissorTest]( [param:Boolean boolean] )
[method:null setOpaqueSort]( [param:Function method] )
[method:null setTransparentSort]( [param:Function method] )
[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )
diff --git a/src/renderers/WebGLRenderer.d.ts b/src/renderers/WebGLRenderer.d.ts
index 60e3122119f8e8..807c1b4cecb9ae 100644
--- a/src/renderers/WebGLRenderer.d.ts
+++ b/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;
diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js
index 5ead6446057223..8fdc4e7223f854 100644
--- a/src/renderers/WebGLRenderer.js
+++ b/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 );
}
diff --git a/src/renderers/webgl/WebGLRenderLists.js b/src/renderers/webgl/WebGLRenderLists.js
index 87fea7a6f14ae9..f12376f3c2f0e5 100644
--- a/src/renderers/webgl/WebGLRenderLists.js
+++ b/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 );
}
From 99e80892df567fbeabaedc3664aca786f55e27a9 Mon Sep 17 00:00:00 2001
From: ranbuch [method:null setOpaqueSort]( [param:Function method] )
[method:null setTransparentSort]( [param:Function method] )
[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )