Class: Scene
场景对象,一般我们会将创建的网格渲染对象添加到场景中进行渲染
代码示例:
const scene = new Scene();
const points = new Mesh(renderer, { mode: renderer.gl.POINTS, geometry, program });
points.position.set(-1, 1, 0);
scene.add(points);
Hierarchy
-
↳
Scene
Table of contents
Constructors
Properties
- visible
- localMatrix
- worldMatrix
- matrixAutoUpdate
- position
- scale
- rotation
- quaternion
- up
- children
- parent
- worldMatrixNeedsUpdate
Methods
Constructors
constructor
• new Scene(): Scene
Returns
Inherited from
Defined in
Properties
visible
• visible: boolean
是否可见
Inherited from
Defined in
localMatrix
• localMatrix: ProjectionMatrix
局部变换矩阵
Inherited from
Defined in
worldMatrix
• worldMatrix: ProjectionMatrix
物体的世界变换矩阵 (如果没有父级,那么他和局部变化矩阵相同)
Inherited from
Defined in
matrixAutoUpdate
• matrixAutoUpdate: boolean
当这个属性设置了之后,它将计算每 一帧的位移、旋转(四元变换)和缩放矩阵,并重新计算 worldMatrix
属性
Inherited from
Defined in
position
• position: Vector3
物体局部位置
Inherited from
Defined in
scale
• scale: Vector3
物体的局部缩放
Inherited from
Defined in
rotation
• rotation: Euler
物体的局部旋转
Inherited from
Defined in
quaternion
• quaternion: Quaternion
物体的局部旋转
Inherited from
Defined in
up
• up: Vector3
物体的朝向
Inherited from
Defined in
children
• children: Object3D
[]
对象子级
Inherited from
Defined in
parent
• parent: WithNull
<Object3D
>
对象父级
Inherited from
Defined in
worldMatrixNeedsUpdate
• worldMatrixNeedsUpdate: boolean
当这个属性设置了之后,它将计算在那一帧中的 worldMatrix
,并将这个值重置为false。默认值为false
Inherited from
Object3D.worldMatrixNeedsUpdate
Defined in
Methods
add
▸ add(object
, notifyChild?
): void
添加对象到这个对象的子级
Parameters
Name | Type | Default value |
---|---|---|
object | Object3D | undefined |
notifyChild | boolean | true |
Returns
void
Inherited from
Defined in
remove
▸ remove(object
, notifyChild?
): void
从此对象移除传入的对象(如果存在)
Parameters
Name | Type | Default value |
---|---|---|
object | Object3D | undefined |
notifyChild | boolean | true |
Returns
void
Inherited from
Defined in
contains
▸ contains(object
): boolean
判断此渲染对象的子集是否包含传入的渲染对象
Parameters
Name | Type |
---|---|
object | Object3D |
Returns
boolean
Inherited from
Defined in
setParent
▸ setParent(object
, notifyParent?
): void
设置此渲染对象的父集
Parameters
Name | Type | Default value | Description |
---|---|---|---|
object | any | undefined | 渲染对象 |
notifyParent | boolean | true | 设置是否将此渲染对象添加到传入的渲染对象中 |
Returns
void
Inherited from
Defined in
traverse
▸ traverse(callback
): void
遍历此对象(包含子对象)
Parameters
Name | Type | Description |
---|---|---|
callback | any | 回调函数 |
Returns
void
Inherited from
Defined in
lookAt
▸ lookAt(eye
, invert?
): void
旋转物体使其在世界空间中面朝一个点
Parameters
Name | Type | Description |
---|---|---|
eye | Vector3 | 朝向位置 |
invert? | boolean | 是否反转 |
Returns
void
Inherited from
Defined in
updateMatrixWorld
▸ updateMatrixWorld(force?
): void
更新渲染对象的世界矩阵
Parameters
Name | Type | Description |
---|---|---|
force? | boolean | 是否更新次渲染对象的子集 |
Returns
void
Inherited from
Defined in
updateMatrix
▸ updateMatrix(): void
更新局部变换矩阵
Returns
void
Inherited from
Defined in
decompose
▸ decompose(): void
从局部矩阵计算位置,旋转和缩放
Returns
void
Inherited from
Defined in
clone
▸ clone(): Scene
克隆场景对象
Returns
Overrides
Defined in
copy
▸ copy(source
, recursive
): Scene
将传入的场景对象的各属性复制到此场景实例中
Parameters
Name | Type | Description |
---|---|---|
source | any | 源场景 |
recursive | any | 设置是否复制子对象 |