daign/clipping-with-caps

new three.js version be of no effect

Opened this issue · 1 comments

dytmh commented

new three.js version be of no effect

this.renderer.clear();

	var gl = this.renderer.context;

    if ( this.showCaps ) {

        this.renderer.state.buffers.stencil.setTest( true );

        this.renderer.state.buffers.stencil.setFunc( gl.ALWAYS, 1, 0xff );
        this.renderer.state.buffers.stencil.setOp( gl.KEEP, gl.KEEP, gl.INCR );
        this.renderer.render( this.backStencil, this.camera );

        this.renderer.state.buffers.stencil.setFunc( gl.ALWAYS, 1, 0xff );
        this.renderer.state.buffers.stencil.setOp( gl.KEEP, gl.KEEP, gl.DECR );
        this.renderer.render( this.frontStencil, this.camera );

        this.renderer.state.buffers.stencil.setFunc( gl.EQUAL, 1, 0xff );
        this.renderer.state.buffers.stencil.setOp( gl.KEEP, gl.KEEP, gl.KEEP );
        this.renderer.render( this.capsScene, this.camera );

        this.renderer.state.buffers.stencil.setTest( false );

    }

    this.renderer.render( this.scene, this.camera );

i try this
`
if ( this.showCaps ) {

		this.renderer.state.buffers.stencil.setTest( true );
		this.renderer.state.buffers.stencil.setLocked( true );

		this.renderer.state.buffers.stencil.setFunc( gl.ALWAYS, 1, 0xff );
		this.renderer.state.buffers.stencil.setOp( gl.KEEP, gl.KEEP, gl.INCR );		
		this.renderer.render( this.backStencil, this.camera );

		this.renderer.state.buffers.stencil.setFunc( gl.ALWAYS, 1, 0xff );
		this.renderer.state.buffers.stencil.setOp( gl.KEEP, gl.KEEP, gl.DECR );
		this.renderer.render( this.frontStencil, this.camera );

		this.renderer.state.buffers.stencil.setFunc( gl.EQUAL, 1, 0xff );
		this.renderer.state.buffers.stencil.setOp( gl.KEEP, gl.KEEP, gl.KEEP );
		this.renderer.render( this.capsScene, this.camera );


		this.renderer.state.buffers.stencil.setLocked( false );
		this.renderer.state.buffers.stencil.setTest( false );

	}

	this.renderer.render( this.scene, this.camera );`