Search Results for

    Show / Hide Table of Contents

    Class MeshAccessor

    General purpose utility for accessing mesh data (both read and write).

    Inheritance
    MeshAccessor
    Assembly: FlaxEngine.dll
    File: Engine/Graphics/Models/MeshAccessor.h
    Syntax
    public class MeshAccessor

    Methods

    AllocateBuffer(MeshBufferType bufferType, int32 count, GPUVertexLayout* layout)

    Allocates the data for the mesh vertex buffer.

    Declaration
    public bool AllocateBuffer(MeshBufferType bufferType, int32 count, GPUVertexLayout* layout)
    Parameters
    MeshBufferType bufferType

    Type of the mesh buffer to initialize.

    int32 count

    Amount of items in the buffer.

    GPUVertexLayout layout

    Layout of the elements in the buffer.

    Returns
    bool

    True if failed, otherwise false.

    AllocateBuffer(MeshBufferType bufferType, int32 count, PixelFormat format)

    Allocates the data for the mesh buffer.

    Declaration
    public bool AllocateBuffer(MeshBufferType bufferType, int32 count, PixelFormat format)
    Parameters
    MeshBufferType bufferType

    Type of the mesh buffer to initialize.

    int32 count

    Amount of items in the buffer.

    PixelFormat format

    Format of the elements in the buffer.

    Returns
    bool

    True if failed, otherwise false.

    Attribute(VertexElement::Types attribute)

    Declaration
    public Stream Attribute(VertexElement::Types attribute)
    Parameters
    VertexElement::Types attribute

    Returns
    Stream

    BlendIndices()

    Declaration
    public Stream BlendIndices()
    Returns
    Stream

    BlendWeights()

    Declaration
    public Stream BlendWeights()
    Returns
    Stream

    Color()

    Declaration
    public Stream Color()
    Returns
    Stream

    Index()

    Declaration
    public Stream Index()
    Returns
    Stream

    LoadBuffer(MeshBufferType bufferType, Span<byte> bufferData, GPUVertexLayout* layout)

    Loads the data from the provided mesh buffer.

    Declaration
    public bool LoadBuffer(MeshBufferType bufferType, Span<byte> bufferData, GPUVertexLayout* layout)
    Parameters
    MeshBufferType bufferType

    Type of the mesh buffer to load.

    Span<byte> bufferData

    Data used by that buffer.

    GPUVertexLayout layout

    Layout of the elements in the buffer.

    Returns
    bool

    True if failed, otherwise false.

    LoadFromMeshData(const void* meshDataPtr)

    Declaration
    public bool LoadFromMeshData(const void* meshDataPtr)
    Parameters
    void meshDataPtr

    Returns
    bool

    LoadMesh(const MeshBase* mesh, bool forceGpu=false, Span<MeshBufferType> buffers=Span<MeshBufferType>())

    Loads the data from the mesh.

    Declaration
    public bool LoadMesh(const MeshBase* mesh, bool forceGpu=false, Span<MeshBufferType> buffers=Span<MeshBufferType>())
    Parameters
    MeshBase mesh

    The source mesh object to access.

    bool forceGpu

    If set to true the data will be downloaded from the GPU, otherwise it can be loaded from the drive (source asset file) or from memory (if cached). Downloading mesh from GPU requires this call to be made from the other thread than main thread. Virtual assets are always downloaded from GPU memory due to lack of dedicated storage container for the asset data.

    Span<MeshBufferType> buffers

    Custom list of mesh buffers to load. Use empty value to access all of them.

    Returns
    bool

    True if failed, otherwise false.

    Normal()

    Declaration
    public Stream Normal()
    Returns
    Stream

    PackNormal(Float3& normal)

    Declaration
    public static void PackNormal(Float3& normal)
    Parameters
    Float3 normal

    Returns
    void

    Position()

    Declaration
    public Stream Position()
    Returns
    Stream

    Tangent()

    Declaration
    public Stream Tangent()
    Returns
    Stream

    TexCoord(int32 channel = 0)

    Declaration
    public Stream TexCoord(int32 channel = 0)
    Parameters
    int32 channel

    Returns
    Stream

    UnpackNormal(Float3& normal)

    Declaration
    public static void UnpackNormal(Float3& normal)
    Parameters
    Float3 normal

    Returns
    void

    UpdateMesh(MeshBase* mesh, bool calculateBounds=true)

    Updates the mesh vertex and index buffers with data assigned to the accessor (eg. via AllocateBuffer).

    Declaration
    public bool UpdateMesh(MeshBase* mesh, bool calculateBounds=true)
    Parameters
    MeshBase mesh

    The target mesh to update.

    bool calculateBounds

    True if auto-calculate mesh local bounding box based on input positions stream. Otherwise, mesh bound swill stay unchanged.

    Returns
    bool

    True if failed, otherwise false.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat