|
@@ -412,6 +412,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
this.addPostPlugin = function ( plugin ) {
|
|
|
|
|
|
plugin.init( this, lights, _webglObjects, _webglObjectsImmediate );
|
|
|
+
|
|
|
this.renderPluginsPost.push( plugin );
|
|
|
|
|
|
};
|
|
@@ -419,6 +420,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
this.addPrePlugin = function ( plugin ) {
|
|
|
|
|
|
plugin.init( this, lights, _webglObjects, _webglObjectsImmediate );
|
|
|
+
|
|
|
this.renderPluginsPre.push( plugin );
|
|
|
|
|
|
};
|
|
@@ -3150,7 +3152,6 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// Rendering
|
|
|
|
|
|
this.render = function ( scene, camera, renderTarget, forceClear ) {
|
|
@@ -3371,38 +3372,8 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
for ( var i = 0, il = plugins.length; i < il; i ++ ) {
|
|
|
|
|
|
- // reset state for plugin (to start from clean slate)
|
|
|
-
|
|
|
- _currentProgram = null;
|
|
|
- _currentCamera = null;
|
|
|
-
|
|
|
- _oldBlending = - 1;
|
|
|
- _oldDepthTest = - 1;
|
|
|
- _oldDepthWrite = - 1;
|
|
|
- _oldDoubleSided = - 1;
|
|
|
- _oldFlipSided = - 1;
|
|
|
- _currentGeometryGroupHash = - 1;
|
|
|
- _currentMaterialId = - 1;
|
|
|
-
|
|
|
- _lightsNeedUpdate = true;
|
|
|
-
|
|
|
plugins[ i ].render( scene, camera, _currentWidth, _currentHeight );
|
|
|
|
|
|
- // reset state after plugin (anything could have changed)
|
|
|
-
|
|
|
- _currentProgram = null;
|
|
|
- _currentCamera = null;
|
|
|
-
|
|
|
- _oldBlending = - 1;
|
|
|
- _oldDepthTest = - 1;
|
|
|
- _oldDepthWrite = - 1;
|
|
|
- _oldDoubleSided = - 1;
|
|
|
- _oldFlipSided = - 1;
|
|
|
- _currentGeometryGroupHash = - 1;
|
|
|
- _currentMaterialId = - 1;
|
|
|
-
|
|
|
- _lightsNeedUpdate = true;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
};
|
|
@@ -6242,7 +6213,7 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
function setDefaultGLState () {
|
|
|
|
|
@@ -6265,7 +6236,26 @@ THREE.WebGLRenderer = function ( parameters ) {
|
|
|
|
|
|
_gl.clearColor( _clearColor.r, _clearColor.g, _clearColor.b, _clearAlpha );
|
|
|
|
|
|
- };
|
|
|
+ }
|
|
|
+
|
|
|
+ function resetGLState() {
|
|
|
+
|
|
|
+ _currentProgram = null;
|
|
|
+ _currentCamera = null;
|
|
|
+
|
|
|
+ _oldBlending = - 1;
|
|
|
+ _oldDepthTest = - 1;
|
|
|
+ _oldDepthWrite = - 1;
|
|
|
+ _oldDoubleSided = - 1;
|
|
|
+ _oldFlipSided = - 1;
|
|
|
+ _currentGeometryGroupHash = - 1;
|
|
|
+ _currentMaterialId = - 1;
|
|
|
+
|
|
|
+ _lightsNeedUpdate = true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ this.resetGLState = resetGLState;
|
|
|
|
|
|
// default plugins (order is important)
|
|
|
|