Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Mesh

网格资源。

Hierarchy

Index

Constructors

constructor

Properties

__asyncLoadAssets__

__asyncLoadAssets__: boolean = false

__depends__

__depends__: any = null

__nativeDepend__

__nativeDepend__: any = null

__onLoadedInvoked__

__onLoadedInvoked__: boolean = false

Private _boneSpaceBounds

_boneSpaceBounds: Map<number, (null | aabb)[]> = new Map()

Private _data

_data: Uint8Array = globalEmptyMeshBuffer

Private _dataLength

_dataLength: number = 0

Private _hash

_hash: number = 0

Private _initialized

_initialized: boolean = false

Private _jointBufferIndices

_jointBufferIndices: number[] | null = null

_native

_native: string = ""

用于本机资产的可序列化URL。供内部使用。

default

""

_nativeUrl

_nativeUrl: string = ""

Private _renderingSubMeshes

_renderingSubMeshes: RenderingSubMesh[] | null = null

_uuid

_uuid: string

loaded

loaded: boolean = true

该资源是否已经成功加载。

morphRendering

morphRendering: MorphRendering | null = null

Static preventDeferredLoadDependents

preventDeferredLoadDependents: boolean = false

当场景或 Prefab 被标记为 asyncLoadAssets,禁止延迟加载该资源所依赖的其它原始资源。

default

false

Static preventPreloadNativeObject

preventPreloadNativeObject: boolean = false

禁止预加载原生对象。

default

false

Accessors

nativeAsset

  • get nativeAsset(): ArrayBuffer
  • set nativeAsset(value: ArrayBuffer): void

nativeDep

  • get nativeDep(): undefined | { __isNative__: boolean; ext: string; uuid: string }

data

  • get data(): Uint8Array

hash

  • get hash(): number

jointBufferIndices

  • get jointBufferIndices(): number[]

maxPosition

  • get maxPosition(): undefined | Vec3
  • (各分量都)大于等于此网格任何顶点位置的最大位置。

    deprecated

    Please use [[struct.maxPosition]] instead

    Returns undefined | Vec3

minPosition

  • get minPosition(): undefined | Vec3
  • (各分量都)小于等于此网格任何顶点位置的最大位置。

    deprecated

    Please use [[struct.minPosition]] instead

    Returns undefined | Vec3

nativeUrl

  • get nativeUrl(): string

refCount

  • get refCount(): number

renderingSubMeshes

struct

subMeshCount

  • get subMeshCount(): number
  • 此网格的子网格数量。

    deprecated

    Please use [[renderingSubMeshes.length]] instead

    Returns number

Methods

Private accessAttribute

  • accessAttribute(primitiveIndex: number, attributeName: AttributeName, accessor: (vertexBundle: IVertexBundle, iAttribute: number) => void): void

Private createVertexBuffers

  • createVertexBuffers(gfxDevice: Device, data: ArrayBuffer): Buffer[]

Private setRawAsset

  • setRawAsset(filename: string, inLibrary?: boolean): void

addRef

assign

  • assign(struct: IStruct, data: Uint8Array): void
  • 重置此网格的结构和数据。

    deprecated

    Will be removed in v3.0.0, please use reset instead

    Parameters

    • struct: IStruct

      The new struct

    • data: Uint8Array

      The new data

    Returns void

copyAttribute

  • copyAttribute(primitiveIndex: number, attributeName: AttributeName, buffer: ArrayBuffer, stride: number, offset: number): boolean
  • 读取子网格的指定属性到目标缓冲区中。

    Parameters

    • primitiveIndex: number

      Sub mesh index

    • attributeName: AttributeName

      Attribute name

    • buffer: ArrayBuffer

      The target array buffer

    • stride: number

      Byte distance between two attributes in the target buffer

    • offset: number

      The offset of the first attribute in the target buffer

    Returns boolean

    Return false if failed to access attribute, return true otherwise.

copyIndices

  • copyIndices(primitiveIndex: number, outputArray: number[] | ArrayBufferView): boolean
  • 读取子网格的索引数据到目标数组中。

    Parameters

    • primitiveIndex: number

      Sub mesh index

    • outputArray: number[] | ArrayBufferView

      The target output array

    Returns boolean

    Return false if failed to access the indices data, return true otherwise.

Optional createNode

decRef

  • decRef(autoRelease?: boolean): Asset

destroy

  • destroy(): any

destroyRenderingMesh

  • destroyRenderingMesh(): void

getBoneSpaceBounds

initialize

  • initialize(): void

merge

  • merge(mesh: Mesh, worldMatrix?: Mat4, validate?: undefined | false | true): boolean
  • 合并指定的网格到此网格中。

    Parameters

    • mesh: Mesh

      The mesh to be merged

    • Optional worldMatrix: Mat4

      The world matrix of the given mesh

    • Optional validate: undefined | false | true

    Returns boolean

    Check the mesh state and return the validation result.

onLoaded

  • onLoaded(): void

readAttribute

  • readAttribute(primitiveIndex: number, attributeName: AttributeName): TypedArray | null
  • 读取子网格的指定属性。

    Parameters

    • primitiveIndex: number

      Sub mesh index

    • attributeName: AttributeName

      Attribute name

    Returns TypedArray | null

    Return null if not found or can't read, otherwise, will create a large enough typed array to contain all data of the attribute, the array type will match the data type of the attribute.

readIndices

  • readIndices(primitiveIndex: number): null | Uint8Array | Uint16Array | Uint32Array
  • 读取子网格的索引数据。

    Parameters

    • primitiveIndex: number

      Sub mesh index

    Returns null | Uint8Array | Uint16Array | Uint32Array

    Return null if not found or can't read, otherwise, will create a large enough typed array to contain all indices data, the array type will use the corresponding stride size.

reset

Private serialize

  • serialize(): void

toString

  • toString(): string
  • 返回对象的字符串表示形式。
    Asset 对象将会重写 Object 对象的 toString() 方法。
    当资源要表示为文本值时或在字符串连接时引用时,
    JavaScript 会自动调用 toString() 方法。

    对于原始类型的资源,它将返回this.nativeUrl
    否则,返回空字符串。
    子类可能会覆盖此方法。

    method

    toString

    Returns string

validateMergingMesh

  • validateMergingMesh(mesh: Mesh): boolean
  • 验证指定网格是否可以合并至当前网格。

    当满足以下条件之一时,指定网格可以合并至当前网格:

    • 当前网格无数据而待合并网格有数据;
    • 它们的顶点块数目相同且对应顶点块的布局一致,并且它们的子网格数目相同且对应子网格的布局一致。

    两个顶点块布局一致当且仅当:

    • 它们具有相同数量的顶点属性且对应的顶点属性具有相同的属性格式。

    两个子网格布局一致,当且仅当:

    • 它们具有相同的图元类型并且引用相同数量、相同索引的顶点块;并且,
    • 要么都需要索引绘制,要么都不需要索引绘制。

    Parameters

    • mesh: Mesh

      The other mesh to be validated

    Returns boolean

Static deserialize

  • deserialize(data: any): any

Object literals

Private struct

struct: object

primitives

primitives: never[] = []

vertexBundles

vertexBundles: never[] = []

Generated using TypeDoc