Created
April 29, 2013 11:08
-
-
Save kishalmi/5480983 to your computer and use it in GitHub Desktop.
support for shadowMapCullFace 'None' and 'Both'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- build/three.js 2013-04-29 12:12:34.237944000 +0200 | |
+++ /home/lmg/js/three.js 2013-04-29 13:00:24.276532000 +0200 | |
@@ -35281,18 +35281,14 @@ | |
_gl.clearColor( 1, 1, 1, 1 ); | |
_gl.disable( _gl.BLEND ); | |
- _gl.enable( _gl.CULL_FACE ); | |
- _gl.frontFace( _gl.CCW ); | |
- | |
- if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { | |
- _gl.cullFace( _gl.FRONT ); | |
- | |
- } else { | |
- | |
- _gl.cullFace( _gl.BACK ); | |
- | |
- } | |
+ // save current values of both cull and front face - for restoring later | |
+ // since these are not saved in the renderer yet, locals with default values are used. | |
+ // ideally they'd get saved inside setFaceCulling() | |
+ // and setDefaultGLState() would also call it instead of directly setting _gl values | |
+ var _oldFrontFace = THREE.FrontFaceDirectionCCW; | |
+ var _oldCullFace = THREE.CullFaceBack; | |
+ _renderer.setFaceCulling(_renderer.shadowMapCullFace, THREE.FrontFaceDirectionCCW); | |
_renderer.setDepthTest( true ); | |
@@ -35559,12 +35555,7 @@ | |
_gl.clearColor( clearColor.r, clearColor.g, clearColor.b, clearAlpha ); | |
_gl.enable( _gl.BLEND ); | |
- if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { | |
- | |
- _gl.cullFace( _gl.BACK ); | |
- | |
- } | |
- | |
+ _renderer.setFaceCulling(_oldCullFace, _oldFrontFace); | |
}; | |
function createVirtualLight( light, cascade ) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment