codecamp

three.js CameraHelper

用于模拟相机视锥体的辅助对象.

它使用 LineSegments 来模拟相机视锥体.

代码示例

const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
const helper = new THREE.CameraHelper( camera );
scene.add( helper );

例子

WebGL / camera

WebGL / extrude / splines

构造函数

CameraHelper( camera : Camera )

camera -- 被模拟的相机.

为指定相机创建一个新的相机辅助对象 CameraHelper .

属性

请到基类 LineSegments 页面查看公共属性.

.camera : Camera

被模拟的相机.

.pointMap : Object

包含用于模拟相机的点.

.matrix : Object

请参考相机的世界矩阵 camera.matrixWorld.

.matrixAutoUpdate : Object

请查看 Object3D.matrixAutoUpdate. 这里设置为 false 表示辅助对象 使用相机的 matrixWorld.

方法

请到基类 LineSegments 页面查看公共方法.

.dispose () : undefined

用于辅助对象销毁内部创建的 material 和 geometry 。

.setColors ( frustum : Color, cone : Color, up : Color, target : Color, cross : Color ) : this

定义辅助对象的颜色。

.update () : undefined

基于相机的投影矩阵更新辅助对象.

源码

src/helpers/CameraHelper.js


three.js Box3Helper
three.js DirectionalLightHelper
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

参考

核心 / BufferAttributes

渲染器 / WebXR

开发者参考

WebGL渲染器

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }