Class: Mesh
网格渲染对象
代码示例:
const points = new Mesh(renderer, { mode: renderer.gl.POINTS, geometry, program });
points.setParent(scene);
points.position.set(-1, 1, 0);
Hierarchy
-
↳
Mesh
Table of contents
Constructors
Properties
- gl
- modelViewMatrix
- normalMatrix
- renderOrder
- zDepth
- frustumCulled
- mode
- renderer
- visible
- localMatrix
- worldMatrix
- matrixAutoUpdate
- position
- scale
- rotation
- quaternion
- up
- children
- parent
- worldMatrixNeedsUpdate
Accessors
Methods
- draw
- updateWireframeGeometry
- updateGeometry
- updateProgram
- destroy
- clone
- copy
- add
- remove
- contains
- setParent
- traverse
- lookAt
- updateMatrixWorld
- updateMatrix
- decompose
Constructors
constructor
• new Mesh(renderer
, options?
): Mesh
Parameters
Name | Type | Description |
---|---|---|
renderer | any | 渲染器 |
options | MeshOptions | MeshOptions |
Returns
Overrides
Defined in
Properties
gl
• gl: WebGLRenderingContext
| WebGL2RenderingContext
Defined in
modelViewMatrix
• modelViewMatrix: Matrix4
Defined in
normalMatrix
• normalMatrix: Matrix3
Defined in
renderOrder
• renderOrder: number
Defined in
zDepth
• zDepth: number
Defined in
frustumCulled
• frustumCulled: boolean
Defined in
mode
• mode: number
Defined in
renderer
• renderer: Renderer
Defined in
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
Accessors
id
• get
id(): string
获取当前 Mesh
的 id
Returns
string
Defined in
geometry
• get
geometry(): Geometry
获取当前 Mesh
的几何体信息
Returns
Defined in
program
• get
program(): Program
获取当前 Mesh
的 program
对象
Returns
Defined in
wireframe
• get
wireframe(): boolean
获取是否是网格渲染
Returns
boolean
Defined in
• set
wireframe(wireframe
): void
设置是否是网格渲染
Parameters
Name | Type |
---|---|
wireframe | boolean |
Returns
void
Defined in
Methods
draw
▸ draw(options?
): void
执行Mesh
的渲染,一般由Renderer
渲染器进行调度。
Parameters
Name | Type |
---|---|
options | MeshDrawOptions |
Returns
void
Defined in
updateWireframeGeometry
▸ updateWireframeGeometry(wireframe
, force?
): void
更新网格几何体数据,主要是顶点索引数据
Parameters
Name | Type | Default value | Description |
---|---|---|---|
wireframe | any | undefined | 是否更新索引数据为网格数据 |
force | boolean | false | 是否强制更新 |
Returns
void
Defined in
updateGeometry
▸ updateGeometry(geometry
, destroy?
): void
更新几何体信息,如果开启了 wireframe
还需要更新 WireframeGeometry
Parameters
Name | Type | Default value | Description |
---|---|---|---|
geometry | any | undefined | 几何体 |
destroy | boolean | true | 是否销毁上一个几何体 |
Returns
void
Defined in
updateProgram
▸ updateProgram(program
, destroy?
): void
更新 Program
对象
Parameters
Name | Type | Default value | Description |
---|---|---|---|
program | any | undefined | |
destroy | boolean | true | 是否销毁上一个 program |
Returns
void
Defined in
destroy
▸ destroy(): void
销毁此 Mesh
Returns
void
Defined in
clone
▸ clone(): Mesh
克隆 Mesh
对象
Returns
Overrides
Defined in
copy
▸ copy(mesh
, recursive?
): Mesh
将给定的 Mesh
对象复制到此对象
Parameters
Name | Type | Default value | Description |
---|---|---|---|
mesh | any | undefined | 源对象 |
recursive | boolean | true | 设置是否复制子对象 |
Returns
Overrides
Defined in
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