Вход Регистрация
Файл: Space race/libs/postprocessing/EffectComposer.js
Строк: 138
<?php
/**
 * @author alteredq / http://alteredqualia.com/
 */

THREE.EffectComposer = function ( rendererrenderTarget ) {

    
this.renderer renderer;

    
this.renderTarget1 renderTarget;

    if ( 
this.renderTarget1 === undefined ) {

        var 
width window.innerWidth || 1;
        var 
height window.innerHeight || 1;

        
this.renderTargetParameters = { minFilterTHREE.LinearFiltermagFilterTHREE.LinearFilterformatTHREE.RGBFormatstencilBufferfalse };
        
this.renderTarget1 = new THREE.WebGLRenderTargetwidthheightthis.renderTargetParameters );

    }

    
this.renderTarget2 this.renderTarget1.clone();

    
this.writeBuffer this.renderTarget1;
    
this.readBuffer this.renderTarget2;

    
this.passes = [];

    
this.copyPass = new THREE.ShaderPassTHREE.ShaderExtras"screen" ] );

};

THREE.EffectComposer.prototype = {

    
swapBuffers: function() {

        var 
tmp this.readBuffer;
        
this.readBuffer this.writeBuffer;
        
this.writeBuffer tmp;

    },

    
addPass: function ( pass ) {

        
this.passes.pushpass );

    },

    
render: function ( delta ) {

        
this.writeBuffer this.renderTarget1;
        
this.readBuffer this.renderTarget2;

        var 
maskActive false;

        var 
passiil this.passes.length;

        for ( 
0il++ ) {

            
pass this.passes];

            if ( !
pass.enabled ) continue;

            
pass.renderthis.rendererthis.writeBufferthis.readBufferdeltamaskActive );

            if ( 
pass.needsSwap ) {

                if ( 
maskActive ) {

                    var 
context this.renderer.context;

                    
context.stencilFunccontext.NOTEQUAL10xffffffff );

                    
this.copyPass.renderthis.rendererthis.writeBufferthis.readBufferdelta );

                    
context.stencilFunccontext.EQUAL10xffffffff );

                }

                
this.swapBuffers();

            }

            if ( 
pass instanceof THREE.MaskPass ) {

                
maskActive true;

            } else if ( 
pass instanceof THREE.ClearMaskPass ) {

                
maskActive false;

            }

        }

    },

    
reset: function ( renderTarget ) {

        
this.renderTarget1 renderTarget;

        if ( 
this.renderTarget1 === undefined ) {

            
this.renderTarget1 = new THREE.WebGLRenderTargetwindow.innerWidthwindow.innerHeightthis.renderTargetParameters );

        }

        
this.renderTarget2 this.renderTarget1.clone();

        
this.writeBuffer this.renderTarget1;
        
this.readBuffer this.renderTarget2;

        
THREE.EffectComposer.quad.scale.setwindow.innerWidthwindow.innerHeight);

        
THREE.EffectComposer.camera.left window.innerWidth / - 2;
        
THREE.EffectComposer.camera.right window.innerWidth 2;
        
THREE.EffectComposer.camera.top window.innerHeight 2;
        
THREE.EffectComposer.camera.bottom window.innerHeight / - 2;

        
THREE.EffectComposer.camera.updateProjectionMatrix();

    }

};

// shared ortho camera

THREE.EffectComposer.initWidth window.innerWidth || 1;
THREE.EffectComposer.initHeight window.innerHeight || 1;

THREE.EffectComposer.camera = new THREE.OrthographicCameraTHREE.EffectComposer.initWidth / - 2THREE.EffectComposer.initWidth 2THREE.EffectComposer.initHeight 2THREE.EffectComposer.initHeight / - 2, -1000010000 );

// shared fullscreen quad scene

THREE.EffectComposer.geometry = new THREE.PlaneGeometry1);
THREE.EffectComposer.geometry.applyMatrix( new THREE.Matrix4().makeRotationXMath.PI ) );

THREE.EffectComposer.quad = new THREE.MeshTHREE.EffectComposer.geometrynull );
THREE.EffectComposer.quad.position.= -100;
THREE.EffectComposer.quad.scale.setTHREE.EffectComposer.initWidthTHREE.EffectComposer.initHeight);

THREE.EffectComposer.scene = new THREE.Scene();
THREE.EffectComposer.scene.addTHREE.EffectComposer.quad );
THREE.EffectComposer.scene.addTHREE.EffectComposer.camera );
?>
Онлайн: 2
Реклама