Class MeshAccessor
General purpose utility for accessing mesh data (both read and write).
Inheritance
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()
BlendWeights()
Color()
Index()
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 |
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()
PackNormal(Float3& normal)
Declaration
public static void PackNormal(Float3& normal)
Parameters
Float3
normal
|
Returns
void
|
Position()
Tangent()
TexCoord(int32 channel = 0)
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. |