noncompiled/views/View.js
// This class encapsulates all state within Three.js
This class encapsulates all state within Three.js
This class encapsulates all state within Three . js
function ThreeJsState() {
    this.renderer = new THREE.WebGLRenderer({
        antialias        : true,    
        preserveDrawingBuffer    : true    
    });
    this.renderer.setClearColor( 0x000000, 1 );
    this.renderer.setSize( innerWidth, innerHeight );
    this.composer = new THREE.EffectComposer(this.renderer);
    this.camera    = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, .01, 100000 );
    this.camera.position.set(-4, 2, 4);
    THREEx.WindowResize.bind(this.renderer, this.camera);
    this.controls = new THREE.OrbitControls( this.camera, this.renderer.domElement );
    this.controls.noPan = false;
    this.scene = new THREE.Scene();
    this.scene.add(this.camera);
    this.renderpass = new THREE.RenderPass(this.scene, this.camera);
    this.composer.passes.push(this.renderpass);
    this.shaderpass_default = new THREE.ShaderPass({
        uniforms: {
            "input_texture": { type: "t", value: null },
        },
        vertexShader: vertexShaders.passthrough,
        fragmentShader: fragmentShaders.passthrough,
    }, 'input_texture');
    this.shaderpass_default.renderToScreen = true;
    this.composer.passes.push(this.shaderpass_default);
}
function ThreeJsState ( ) { this . renderer = new THREE . WebGLRenderer ( { antialias : true , preserveDrawingBuffer : true } ) ; this . renderer . setClearColor ( 0x000000 , 1 ) ; this . renderer . setSize ( innerWidth , innerHeight ) ; this . composer = new THREE . EffectComposer ( this . renderer ) ; this . camera = new THREE . PerspectiveCamera ( 35 , window . innerWidth / window . innerHeight , .01 , 100000 ) ; this . camera . position . set ( - 4 , 2 , 4 ) ; THREEx . WindowResize . bind ( this . renderer , this . camera ) ; this . controls = new THREE . OrbitControls ( this . camera , this . renderer . domElement ) ; this . controls . noPan = false ; this . scene = new THREE . Scene ( ) ; this . scene . add ( this . camera ) ; this . renderpass = new THREE . RenderPass ( this . scene , this . camera ) ; this . composer . passes . push ( this . renderpass ) ; this . shaderpass_default = new THREE . ShaderPass ( { uniforms : { "input_texture" : { type : "t" , value : null } , } , vertexShader : vertexShaders . passthrough , fragmentShader : fragmentShaders . passthrough , } , 'input_texture' ) ; this . shaderpass_default . renderToScreen = true ; this . composer . passes . push ( this . shaderpass_default ) ; }
This class encapsulates all state within Three.js
This class encapsulates all state within Three . js
// create the renderer // to get smoother output // to allow screenshot // put a camera in the scene // transparently support window resize // create a camera contol // create a scene