Skip to content

KBE3D / KBCore / Cesium / VertexFormat

类: VertexFormat

A vertex format defines what attributes make up a vertex. A VertexFormat can be provided to a Geometry to request that certain properties be computed, e.g., just position, position and normal, etc.

示例

ts
// Create a vertex format with position and 2D texture coordinate attributes.
const format = new Cesium.VertexFormat({
  position : true,
  st : true
});

参数

An object with boolean properties corresponding to VertexFormat properties as shown in the code example.

属性

POSITION_ONLY

readonly static POSITION_ONLY: VertexFormat

An immutable vertex format with only a position attribute.


POSITION_AND_NORMAL

readonly static POSITION_AND_NORMAL: VertexFormat

An immutable vertex format with position and normal attributes. This is compatible with per-instance color appearances like PerInstanceColorAppearance.


POSITION_NORMAL_AND_ST

readonly static POSITION_NORMAL_AND_ST: VertexFormat

An immutable vertex format with position, normal, and st attributes. This is compatible with MaterialAppearance when MaterialAppearance#materialSupport is <code>TEXTURED</code>.


POSITION_AND_ST

readonly static POSITION_AND_ST: VertexFormat

An immutable vertex format with position and st attributes. This is compatible with EllipsoidSurfaceAppearance.


POSITION_AND_COLOR

readonly static POSITION_AND_COLOR: VertexFormat

An immutable vertex format with position and color attributes.


ALL

readonly static ALL: VertexFormat

An immutable vertex format with well-known attributes: position, normal, st, tangent, and bitangent.


DEFAULT

readonly static DEFAULT: VertexFormat

An immutable vertex format with position, normal, and st attributes. This is compatible with most appearances and materials; however normal and st attributes are not always required. When this is known in advance, another <code>VertexFormat</code> should be used.


packedLength

static packedLength: number

The number of elements used to pack the object into an array.


position

position: boolean

When <code>true</code>, the vertex has a 3D position attribute. <p> 64-bit floating-point (for precision). 3 components per attribute. </p>


normal

normal: boolean

When <code>true</code>, the vertex has a normal attribute (normalized), which is commonly used for lighting. <p> 32-bit floating-point. 3 components per attribute. </p>


st

st: boolean

When <code>true</code>, the vertex has a 2D texture coordinate attribute. <p> 32-bit floating-point. 2 components per attribute </p>


bitangent

bitangent: boolean

When <code>true</code>, the vertex has a bitangent attribute (normalized), which is used for tangent-space effects like bump mapping. <p> 32-bit floating-point. 3 components per attribute. </p>


tangent

tangent: boolean

When <code>true</code>, the vertex has a tangent attribute (normalized), which is used for tangent-space effects like bump mapping. <p> 32-bit floating-point. 3 components per attribute. </p>


color

color: boolean

When <code>true</code>, the vertex has an RGB color attribute. <p> 8-bit unsigned byte. 3 components per attribute. </p>

方法

pack()

static pack(value: VertexFormat, array: number[], startingIndex?: number): number[]

Stores the provided instance into the provided array.

参数

value

VertexFormat

The value to pack.

array

number[]

The array to pack into.

startingIndex?

number

The index into the array at which to start packing the elements.

返回

number[]

The array that was packed into


unpack()

static unpack(array: number[], startingIndex?: number, result?: VertexFormat): VertexFormat

Retrieves an instance from a packed array.

参数

array

number[]

The packed array.

startingIndex?

number

The starting index of the element to be unpacked.

result?

VertexFormat

The object into which to store the result.

返回

VertexFormat

The modified result parameter or a new VertexFormat instance if one was not provided.


clone()

static clone(vertexFormat: VertexFormat, result?: VertexFormat): VertexFormat

Duplicates a VertexFormat instance.

参数

vertexFormat

VertexFormat

The vertex format to duplicate.

result?

VertexFormat

The object onto which to store the result.

返回

VertexFormat

The modified result parameter or a new VertexFormat instance if one was not provided. (Returns undefined if vertexFormat is undefined)

构造函数

构造函数

new VertexFormat(options?: any): VertexFormat

参数

options?

any

返回

VertexFormat

KBE3D @3.0.0 Copyright © 2024-present KBE3D