1 /**
2 * Camera for rendering cube maps
3 * - renders scene into axis-aligned cube
4 *
5 * @author alteredq / http://alteredqualia.com/
6 */
7
8 /**@constructor*/
9 THREE.CubeCamera = function ( near, far, cubeResolution ) {
10
11 THREE.Object3D.call( this );
12
13 var fov = 90, aspect = 1;
14
15 var cameraPX = new THREE.PerspectiveCamera( fov, aspect, near, far );
16 cameraPX.up.set( 0, -1, 0 );
17 cameraPX.lookAt( new THREE.Vector3( 1, 0, 0 ) );
18 this.add( cameraPX );
19
20 var cameraNX = new THREE.PerspectiveCamera( fov, aspect, near, far );
21 cameraNX.up.set( 0, -1, 0 );
22 cameraNX.lookAt( new THREE.Vector3( -1, 0, 0 ) );
23 this.add( cameraNX );
24
25 var cameraPY = new THREE.PerspectiveCamera( fov, aspect, near, far );
26 cameraPY.up.set( 0, 0, 1 );
27 cameraPY.lookAt( new THREE.Vector3( 0, 1, 0 ) );
28 this.add( cameraPY );
29
30 var cameraNY = new THREE.PerspectiveCamera( fov, aspect, near, far );
31 cameraNY.up.set( 0, 0, -1 );
32 cameraNY.lookAt( new THREE.Vector3( 0, -1, 0 ) );
33 this.add( cameraNY );
34
35 var cameraPZ = new THREE.PerspectiveCamera( fov, aspect, near, far );
36 cameraPZ.up.set( 0, -1, 0 );
37 cameraPZ.lookAt( new THREE.Vector3( 0, 0, 1 ) );
38 this.add( cameraPZ );
39
40 var cameraNZ = new THREE.PerspectiveCamera( fov, aspect, near, far );
41 cameraNZ.up.set( 0, -1, 0 );
42 cameraNZ.lookAt( new THREE.Vector3( 0, 0, -1 ) );
43 this.add( cameraNZ );
44
45 this.renderTarget = new THREE.WebGLRenderTargetCube( cubeResolution, cubeResolution, { format: THREE.RGBFormat, magFilter: THREE.LinearFilter, minFilter: THREE.LinearFilter } );
46
47 this.updateCubeMap = function ( renderer, scene ) {
48
49 var renderTarget = this.renderTarget;
50 var generateMipmaps = renderTarget.generateMipmaps;
51
52 renderTarget.generateMipmaps = false;
53
54 renderTarget.activeCubeFace = 0;
55 renderer.render( scene, cameraPX, renderTarget );
56
57 renderTarget.activeCubeFace = 1;
58 renderer.render( scene, cameraNX, renderTarget );
59
60 renderTarget.activeCubeFace = 2;
61 renderer.render( scene, cameraPY, renderTarget );
62
63 renderTarget.activeCubeFace = 3;
64 renderer.render( scene, cameraNY, renderTarget );
65
66 renderTarget.activeCubeFace = 4;
67 renderer.render( scene, cameraPZ, renderTarget );
68
69 renderTarget.generateMipmaps = generateMipmaps;
70
71 renderTarget.activeCubeFace = 5;
72 renderer.render( scene, cameraNZ, renderTarget );
73
74 };
75
76 };
77
78 THREE.CubeCamera.prototype = Object.create( THREE.Object3D.prototype );
79
nike free rn
new balance hombre baratas
cinturones gucci
ugg rebajas
cinturon gucci
ray ban baratas
nike cortez
peuterey mujer
christian louboutin madrid
mbt zapatos
gafas ray ban baratas
mbt ofertas
air max blancas
mbt barcelona
nike air max 90
woolrich barcelona
nike mujer
botas ugg
gafas de sol carrera aratas
air max 2016 baratas
oakley baratas
nike air max 2016