Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Mesh

Mesh asset

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 = ""

Serializable url for native asset. For internal usage.

default

""

_nativeUrl

_nativeUrl: string = ""

Private _renderingSubMeshes

_renderingSubMeshes: RenderingSubMesh[] | null = null

_uuid

_uuid: string

loaded

loaded: boolean = true

Whether the asset is loaded or not

morphRendering

morphRendering: MorphRendering | null = null

Static preventDeferredLoadDependents

preventDeferredLoadDependents: boolean = false

Indicates whether its dependent native assets can support deferred load if the owner scene (or prefab) is marked as asyncLoadAssets.

default

false

Static preventPreloadNativeObject

preventPreloadNativeObject: boolean = false

Indicates whether its native object should be preloaded from native url.

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
  • The maximum position of all vertices in the mesh

    deprecated

    Please use [[struct.maxPosition]] instead

    Returns undefined | Vec3

minPosition

  • get minPosition(): undefined | Vec3
  • The minimum position of all vertices in the mesh

    deprecated

    Please use [[struct.minPosition]] instead

    Returns undefined | Vec3

nativeUrl

  • get nativeUrl(): string

refCount

  • get refCount(): number

renderingSubMeshes

struct

subMeshCount

  • get subMeshCount(): number
  • The sub meshes count of the mesh.

    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
  • Reset the struct and data of the mesh

    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
  • Read the requested attribute of the given sub mesh and fill into the given buffer.

    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
  • Read the indices data of the given sub mesh and fill into the given array

    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
  • Merge the given mesh into the current mesh

    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
  • Read the requested attribute of the given sub mesh

    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
  • Read the indices data of the given sub mesh

    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
  • Returns the string representation of the object.
    The Asset object overrides the toString() method of the Object object.
    JavaScript calls the toString() method automatically
    when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.

    For assets of the native type, it will return this.nativeUrl.
    Otherwise, an empty string is returned.
    This method may be overwritten by subclasses.

    method

    toString

    Returns string

validateMergingMesh

  • validateMergingMesh(mesh: Mesh): boolean
  • Validation for whether the given mesh can be merged into the current mesh. To pass the validation, it must satisfy either of these two requirements:

    • When the current mesh have no data
    • When the two mesh have the same vertex bundle count, the same sub meshes count, and the same sub mesh layout.

    Same mesh layout means:

    • They have the same primitive type and reference to the same amount vertex bundle with the same indices.
    • And they all have or don't have index view

    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