You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.3 KiB
91 lines
2.3 KiB
2 years ago
|
<!DOCTYPE html>
|
||
|
<html lang="zh">
|
||
|
<head>
|
||
|
<meta charset="utf-8" />
|
||
|
<base href="../../../" />
|
||
|
<script src="page.js"></script>
|
||
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
[page:Object3D] →
|
||
|
|
||
|
<h1>立方相机([name])</h1>
|
||
|
|
||
|
<p class="desc">创建6个渲染到[page:WebGLCubeRenderTarget]的摄像机。</p>
|
||
|
|
||
|
<h2>代码示例</h2>
|
||
|
|
||
|
<code>
|
||
|
// Create cube render target
|
||
|
const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 128, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
|
||
|
|
||
|
// Create cube camera
|
||
|
const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
|
||
|
scene.add( cubeCamera );
|
||
|
|
||
|
// Create car
|
||
|
const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } );
|
||
|
const car = new THREE.Mesh( carGeometry, chromeMaterial );
|
||
|
scene.add( car );
|
||
|
|
||
|
// Update the render target cube
|
||
|
car.visible = false;
|
||
|
cubeCamera.position.copy( car.position );
|
||
|
cubeCamera.update( renderer, scene );
|
||
|
|
||
|
// Render the scene
|
||
|
car.visible = true;
|
||
|
renderer.render( scene, camera );
|
||
|
</code>
|
||
|
|
||
|
<h2>例子</h2>
|
||
|
|
||
|
<p>
|
||
|
[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]
|
||
|
</p>
|
||
|
|
||
|
<h2>构造器</h2>
|
||
|
|
||
|
|
||
|
|
||
|
<h3>[name]( [param:Number near], [param:Number far], [param:WebGLCubeRenderTarget renderTarget] )</h3>
|
||
|
<p>
|
||
|
near -- 近剪切面的距离<br />
|
||
|
far -- 远剪切面的距离<br />
|
||
|
renderTarget -- The destination cube render target.
|
||
|
</p>
|
||
|
<p>
|
||
|
构造一个包含6个[page:PerspectiveCamera PerspectiveCameras](透视摄像机)的立方摄像机,
|
||
|
并将其拍摄的场景渲染到一个[page:WebGLCubeRenderTarget]上。
|
||
|
</p>
|
||
|
|
||
|
|
||
|
<h2>属性</h2>
|
||
|
<p>共有属性请参见其基类[page:Object3D]。</p>
|
||
|
|
||
|
<h3>[property:WebGLCubeRenderTarget renderTarget]</h3>
|
||
|
<p>
|
||
|
The destination cube render target.
|
||
|
</p>
|
||
|
|
||
|
<h2>方法</h2>
|
||
|
<p>共有方法请参见其基类[page:Object3D]。</p>
|
||
|
|
||
|
|
||
|
<h3>[method:undefined update]( [param:WebGLRenderer renderer], [param:Scene scene] )</h3>
|
||
|
<p>
|
||
|
renderer -- 当前的WebGL渲染器<br />
|
||
|
scene -- 当前的场景
|
||
|
</p>
|
||
|
<p>
|
||
|
这个方法用来更新[page:CubeCamera.renderTarget renderTarget](渲染目标对象)。
|
||
|
</p>
|
||
|
|
||
|
<h2>源代码</h2>
|
||
|
|
||
|
<p>
|
||
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
||
|
</p>
|
||
|
</body>
|
||
|
</html>
|