RSX Code Reference
    Preparing search index...

    Class Mesh

    Primary class for holding geometry. Stores data in the form of vertex buffers and optionally an index buffer, which may be bound to the pipeline for drawing. May contain multiple sub-meshes.

    Hierarchy (View Summary)

    Index
    • Creates a new mesh with enough space to hold the a number of primitives using the specified layout. All indices will be part of a single sub-mesh.

      Parameters

      • vertexCount: number

        Number of vertices in the mesh.

      • indexCount: number

        Number of indices in the mesh. Must be a multiple of primitive size as specified by provided topology.

      • Optionaltopology: EnumValue<MeshTopology>

        Determines how should the provided indices be interpreted by the pipeline. Default option is a triangle list, where three indices represent a single triangle.

      • Optionalusage: EnumValue<MeshUsage>

        Optimizes performance depending on planned usage of the mesh.

      • Optionalvertex: EnumValue<VertexLayout>

        Controls how are vertices organized in the vertex buffer and what data they contain.

      • Optionalindex: EnumValue<IndexType>

        Size of indices, use smaller size for better performance, however be careful not to go over the number of vertices limited by the data type size.

      • OptionalnormalPacking: EnumValue<NormalizedVectorPacking>

        The packing mode for normals.

      • OptionalisInternalConstructor: boolean

      Returns Mesh

    • Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can be referenced by multiple sub-meshes.

      Parameters

      • vertexCount: number

        Number of vertices in the mesh.

      • indexCount: number

        Number of indices in the mesh. Must be a multiple of primitive size as specified by provided topology.

      • subMeshes: readonly Immutable<SubMesh>[]

        Defines how are indices separated into sub-meshes, and how are those sub-meshes rendered. Sub-meshes may be rendered independently, each with a different material.

      • Optionalusage: EnumValue<MeshUsage>

        Optimizes performance depending on planned usage of the mesh.

      • Optionalvertex: EnumValue<VertexLayout>

        Controls how are vertices organized in the vertex buffer and what data they contain.

      • Optionalindex: EnumValue<IndexType>

        Size of indices, use smaller size for better performance, however be careful not to go over the number of vertices limited by the data type size.

      • OptionalnormalPacking: EnumValue<NormalizedVectorPacking>

        The packing mode for normals.

      Returns Mesh

    • Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described by the mesh data exactly. Mesh will have no sub-meshes.

      Parameters

      • data: MeshData

        Vertex and index data to initialize the mesh with.

      • Optionaltopology: EnumValue<MeshTopology>

        Determines how should the provided indices be interpreted by the pipeline. Default option is a triangle list, where three indices represent a single triangle.

      • Optionalusage: EnumValue<MeshUsage>

        Optimizes performance depending on planned usage of the mesh.

      Returns Mesh

    • Creates a new mesh with enough space to hold the a number of primitives using the specified layout. Indices can be referenced by multiple sub-meshes.

      Parameters

      • data: MeshData

        Vertex and index data to initialize the mesh with.

      • subMeshes: readonly Immutable<SubMesh>[]

        Defines how are indices separated into sub-meshes, and how are those sub-meshes rendered. Sub-meshes may be rendered independently, each with a different material.

      • Optionalusage: EnumValue<MeshUsage>

        Optimizes performance depending on planned usage of the mesh.

      Returns Mesh

    • get cpuCachedData(): MeshData

      Accesses the vertex and index data of the mesh.

      Returns MeshData

      The mesh must have been created with the MeshUsage::CPUCached flag. If the data is not CPU cached, use ReadDataAsync instead.

    • get isCachedDataAvailable(): boolean

      Determines if cached MeshData is available.

      Returns boolean

      This required the MeshUsage::CPUCached flag to be set.

    • get isDestroyed(): boolean

      Determines if the resource is destroyed.

      Returns boolean

      This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

    • get isFullyStreamedIn(): boolean

      Checks if all of the streaming data has been assigned.

      Returns boolean

      True if all the streaming data has been assigned via SetStreamingData.

    • get isPreviewStreamedIn(): boolean

      Determines if the preview data has been streamed in.

      Returns boolean

    • get morphShapes(): MorphShapes

      Returns an object containing all shapes used for morph animation, if any are available.

      Returns MorphShapes

    • get name(): string

      Name of the resource. Use primarily for easier identification and not important to the engine itself.

      Returns string

    • get skeleton(): Skeleton

      Gets the skeleton required for animation of this mesh, if any is available.

      Returns Skeleton

    • get uuid(): UUID

      Returns a universally unique identifier of this resource.

      Returns UUID

    • Duplicates the resource and creates a unique UUID for the duplicated resource.

      Returns Resource

      The duplicated resource or null, if the duplication failed.

    • Virtual

      Method called by RSX to perform actions required after the creation of the resource.

      Returns void

    • Virtual

      Method called by RSX to perform any operations needed after deserialization.

      Returns void

      Use this API to restore your serializable data into live objects.

    • Virtual

      Method called by RSX to disable the resource.

      Returns void

      Use this API to deactivate the resource before it is serialized.

    • Virtual

      Method called by RSX to enable the resource.

      Returns void

      Use this API to activate the resource after it has been disabled by serialization.

    • Virtual

      Method called by RSX to perform initialization of the resource.

      Returns void

      Use this API to initialize data and default construct all fields.

    • Virtual

      Method called by RSX to perform any operations before serialization.

      Returns void

      Use this API to bake your live data into serializable data.

    • Reads internal mesh data into and immediately creates the MeshData. Performs the read asynchronously without blocking the GPU.

      Returns AsyncOp<MeshData>

      Async operation object that will contain the buffer with the data once the operation completes.

      This is an "asynchronous method".

    • Reverts the resource to the on-disk representation.

      Returns boolean

      This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.

    • Sets the vertex and index data of the mesh.

      Parameters

      Returns UncertainAsyncOp<void, string>

      The caller must ensure the data matches mesh's vertex/index counts, vertex layout and index format.