1 | import { CoordinateSystem } from "../constants.js";
|
2 | import { Object3D } from "../core/Object3D.js";
|
3 | import { WebGLCubeRenderTarget } from "../renderers/WebGLCubeRenderTarget.js";
|
4 | import { WebGLRenderer } from "../renderers/WebGLRenderer.js";
|
5 |
|
6 | /**
|
7 | * Creates **6** {@link THREE.PerspectiveCamera | cameras} that render to a {@link THREE.WebGLCubeRenderTarget | WebGLCubeRenderTarget}.
|
8 | * @remarks The cameras are added to the {@link children} array.
|
9 | * @example
|
10 | * ```typescript
|
11 | * // Create cube render target
|
12 | * const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
|
13 | *
|
14 | * // Create cube camera
|
15 | * const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
|
16 | * scene.add( cubeCamera );
|
17 | *
|
18 | * // Create car
|
19 | * const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } );
|
20 | * const car = new THREE.Mesh( carGeometry, chromeMaterial );
|
21 | * scene.add( car );
|
22 | *
|
23 | * // Update the render target cube
|
24 | * car.visible = false;
|
25 | * cubeCamera.position.copy( car.position );
|
26 | * cubeCamera.update( renderer, scene );
|
27 | *
|
28 | * // Render the scene
|
29 | * car.visible = true;
|
30 | * renderer.render( scene, camera );
|
31 | * ```
|
32 | * @see Example: {@link https://threejs.org/examples/#webgl_materials_cubemap_dynamic | materials / cubemap / dynamic }
|
33 | * @see {@link https://threejs.org/docs/index.html#api/en/cameras/CubeCamera | Official Documentation}
|
34 | * @see {@link https://github.com/mrdoob/three.js/blob/master/src/cameras/CubeCamera.js | Source}
|
35 | */
|
36 | export class CubeCamera extends Object3D {
|
37 | /**
|
38 | * Constructs a {@link CubeCamera} that contains 6 {@link PerspectiveCamera | PerspectiveCameras} that render to a {@link THREE.WebGLCubeRenderTarget | WebGLCubeRenderTarget}.
|
39 | * @param near The near clipping distance.
|
40 | * @param far The far clipping distance.
|
41 | * @param renderTarget The destination cube render target.
|
42 | */
|
43 | constructor(near: number, far: number, renderTarget: WebGLCubeRenderTarget);
|
44 |
|
45 | /**
|
46 | * @override
|
47 | * @defaultValue `CubeCamera`
|
48 | */
|
49 | override readonly type: string | "CubeCamera";
|
50 |
|
51 | /**
|
52 | * The destination cube render target.
|
53 | */
|
54 | renderTarget: WebGLCubeRenderTarget;
|
55 |
|
56 | coordinateSystem: CoordinateSystem;
|
57 |
|
58 | activeMipmapLevel: number;
|
59 |
|
60 | updateCoordinateSystem(): void;
|
61 |
|
62 | /**
|
63 | * Call this to update the { CubeCamera.renderTarget | renderTarget}.
|
64 | * renderer The current WebGL renderer
|
65 | * scene The current scene
|
66 | */
|
67 | update(renderer: WebGLRenderer, scene: Object3D): void;
|
68 | }
|