Skip to main content

Class: Plane

平面几何体

代码示例:

const plane - new Plane(renderer);

const plane = new Mesh(renderer, { geometry: planeGeometry, program });
scene.add(plane);

Hierarchy​

Table of contents​

Constructors​

Properties​

Accessors​

Methods​

Constructors​

constructor​

• new Plane(renderer, «destructured»?): Plane

Parameters​

NameTypeDescription
rendererRenderer渲染器
«destructured»Partial<PlaneOptions>-

Returns​

Plane

Overrides​

Geometry.constructor

Defined in​

src/geometries/Plane.ts:139

Properties​

renderer​

• renderer: Renderer

Inherited from​

Geometry.renderer

Defined in​

src/core/Base.ts:7


drawRange​

• drawRange: any

Inherited from​

Geometry.drawRange

Defined in​

src/core/Geometry.ts:53


instancedCount​

• instancedCount: number

Inherited from​

Geometry.instancedCount

Defined in​

src/core/Geometry.ts:55


isInstanced​

• isInstanced: boolean

Inherited from​

Geometry.isInstanced

Defined in​

src/core/Geometry.ts:57


drawMode​

• drawMode: number

Inherited from​

Geometry.drawMode

Defined in​

src/core/Geometry.ts:59

Accessors​

gl​

• get gl(): WebGLRenderingContext | WebGL2RenderingContext

获取 webgl 实例

Returns​

WebGLRenderingContext | WebGL2RenderingContext

Inherited from​

Geometry.gl

Defined in​

src/core/Base.ts:16


rendererState​

• get rendererState(): State

获取渲染状态

Returns​

State

Inherited from​

Geometry.rendererState

Defined in​

src/core/Base.ts:23


id​

• get id(): string

获取当前几何体数据的唯一标识

Returns​

string

Inherited from​

Geometry.id

Defined in​

src/core/Geometry.ts:105


attributes​

• get attributes(): Map<string, BufferAttribute>

获取全部的属性信息

Returns​

Map<string, BufferAttribute>

Inherited from​

Geometry.attributes

Defined in​

src/core/Geometry.ts:112


attributesData​

• get attributesData(): Attributes

获取属性数据

Returns​

Attributes

Inherited from​

Geometry.attributesData

Defined in​

src/core/Geometry.ts:119


index​

• get index(): undefined | BufferAttribute

获取顶点索引属性

Returns​

undefined | BufferAttribute

Inherited from​

Geometry.index

Defined in​

src/core/Geometry.ts:136


bounds​

• get bounds(): any

获取当前几何体的包围盒

Returns​

any

Inherited from​

Geometry.bounds

Defined in​

src/core/Geometry.ts:143

• set bounds(bounds): void

手动设置包围盒,一般我们只需要内部计算

Parameters​

NameType
boundsany

Returns​

void

Inherited from​

Geometry.bounds

Defined in​

src/core/Geometry.ts:151

Methods​

addAttribute​

▸ addAttribute(name, attribute): void

添加对应的属性信息(顶点数据)

Parameters​

NameType
namestring
attributeBufferAttribute

Returns​

void

Inherited from​

Geometry.addAttribute

Defined in​

src/core/Geometry.ts:160


getAttribute​

▸ getAttribute(name): undefined | BufferAttribute

获取对应的属性信息(顶点数据)

Parameters​

NameType
nameany

Returns​

undefined | BufferAttribute

Inherited from​

Geometry.getAttribute

Defined in​

src/core/Geometry.ts:191


setAttributeData​

▸ setAttributeData(name, data): void

设置对应的属性数据

Parameters​

NameType
nameany
dataany

Returns​

void

Inherited from​

Geometry.setAttributeData

Defined in​

src/core/Geometry.ts:200


updateAttribute​

▸ updateAttribute(attribute): void

更新顶点属性数据

Parameters​

NameType
attributeany

Returns​

void

Inherited from​

Geometry.updateAttribute

Defined in​

src/core/Geometry.ts:212


removeAttribute​

▸ removeAttribute(attribute): void

移除属性信息

Parameters​

NameType
attributeany

Returns​

void

Inherited from​

Geometry.removeAttribute

Defined in​

src/core/Geometry.ts:235


setIndex​

▸ setIndex(index): void

设置顶点索引数据

Parameters​

NameType
indexany

Returns​

void

Inherited from​

Geometry.setIndex

Defined in​

src/core/Geometry.ts:243


setVertices​

▸ setVertices(data): void

设置顶点数据

Parameters​

NameType
dataany

Returns​

void

Inherited from​

Geometry.setVertices

Defined in​

src/core/Geometry.ts:262


setNormals​

▸ setNormals(data): void

设置顶点法向量数据

Parameters​

NameType
dataany

Returns​

void

Inherited from​

Geometry.setNormals

Defined in​

src/core/Geometry.ts:282


setUVs​

▸ setUVs(data): void

设置纹理 UV 数据

Parameters​

NameType
dataany

Returns​

void

Inherited from​

Geometry.setUVs

Defined in​

src/core/Geometry.ts:296


setColors​

▸ setColors(colors): void

设置顶点颜色数据

Parameters​

NameType
colors(Float32Array | Float64Array | number[] | Vector3 | Vector4)[]

Returns​

void

Inherited from​

Geometry.setColors

Defined in​

src/core/Geometry.ts:310


setDrawRange​

▸ setDrawRange(start, count): void

设置顶点渲染的开始索引和数量

Parameters​

NameTypeDescription
startnumber开始索引
countnumber数量

Returns​

void

Inherited from​

Geometry.setDrawRange

Defined in​

src/core/Geometry.ts:333


setInstancedCount​

▸ setInstancedCount(count): void

设置实例化渲染的数量

Parameters​

NameTypeDescription
countnumber数量

Returns​

void

Inherited from​

Geometry.setInstancedCount

Defined in​

src/core/Geometry.ts:342


createVAO​

▸ createVAO(program): void

创建 Vao

Parameters​

NameType
programProgram

Returns​

void

Inherited from​

Geometry.createVAO

Defined in​

src/core/Geometry.ts:350


bindAttributes​

▸ bindAttributes(program): void

绑定顶点属性数据 https://devdocs.io/dom/webgl2renderingcontext/vertexattribipointer

Parameters​

NameType
programProgram

Returns​

void

Inherited from​

Geometry.bindAttributes

Defined in​

src/core/Geometry.ts:363


computeBoundingBox​

▸ computeBoundingBox(vertices?): any

计算当前几何体的的矩形边界(立方体包围盒)

Parameters​

NameTypeDescription
vertices?number[] | DataType外部传入的顶点数据

Returns​

any

Inherited from​

Geometry.computeBoundingBox

Defined in​

src/core/Geometry.ts:402


computeBoundingSphere​

▸ computeBoundingSphere(vertices?): void

计算当前几何体的的球形边界(球形包围盒)

Parameters​

NameTypeDescription
vertices?number[] | DataType外部传入的顶点数据

Returns​

void

Inherited from​

Geometry.computeBoundingSphere

Defined in​

src/core/Geometry.ts:437


draw​

▸ draw(program, drawMode?): void

执行绘制

Parameters​

NameTypeDescription
programanyProgram 对象
drawModenumber绘制模式

Returns​

void

Inherited from​

Geometry.draw

Defined in​

src/core/Geometry.ts:458


copy​

▸ copy(source): Plane

将传入的几何体对象的属性值拷贝到此对象

Parameters​

NameTypeDescription
sourceGeometry源几何体对象

Returns​

Plane

Inherited from​

Geometry.copy

Defined in​

src/core/Geometry.ts:502


clone​

▸ clone(): Geometry

克隆此几何体对象

Returns​

Geometry

Inherited from​

Geometry.clone

Defined in​

src/core/Geometry.ts:540


destroy​

▸ destroy(): void

销毁几何体对象

Returns​

void

Inherited from​

Geometry.destroy

Defined in​

src/core/Geometry.ts:549