Class Mesh
Represents part of the model that is made of vertices and can be rendered using custom material and transformation.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Graphics/Models/Mesh.h
Syntax
public class Mesh : public MeshBase
Constructors
DEPRECATED("Use Init intead.")
Load mesh data and Initialize GPU buffers [Deprecated in v1.10]
Declaration
public DEPRECATED("Use Init intead.") bool Load(uint32 vertices
Parameters
"Use Init intead."
Mesh_DEPRECATED__Use_Init_intead___
|
Fields
ib
Declaration
public uint32 void void void void* ib
Field Value
uint32 void void void void
|
triangles
Declaration
public uint32 triangles
Field Value
uint32
|
use16BitIndexBuffer
Declaration
public uint32 void void void void bool use16BitIndexBuffer
Field Value
uint32 void void void void bool
|
vb0
Declaration
public uint32 void* vb0
Field Value
uint32 void
|
vb1
Declaration
public uint32 void void* vb1
Field Value
uint32 void void
|
vb2
Declaration
public uint32 void void void* vb2
Field Value
uint32 void void void
|
Methods
Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor)
Draws the mesh.
Declaration
public void Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor) const
Parameters
RenderContext
renderContext
The rendering context. |
DrawInfo
info
The packed drawing info data. |
float
lodDitherFactor
The LOD transition dither factor. |
Draw(const RenderContext& renderContext, MaterialBase* material, const Matrix& world, StaticFlags flags=StaticFlags::None, bool receiveDecals=true, DrawPass drawModes=DrawPass::Default, float perInstanceRandom = 0.0f, int8 sortOrder = 0)
Draws the mesh.
Declaration
public void Draw(const RenderContext& renderContext, MaterialBase* material, const Matrix& world, StaticFlags flags=StaticFlags::None, bool receiveDecals=true, DrawPass drawModes=DrawPass::Default, float perInstanceRandom = 0.0f, int8 sortOrder = 0) const
Parameters
RenderContext
renderContext
The rendering context. |
MaterialBase
material
The material to use for rendering. |
Matrix
world
The world transformation of the model. |
StaticFlags
flags
The object static flags. |
bool
receiveDecals
True if rendered geometry can receive decals, otherwise false. |
DrawPass
drawModes
The draw passes to use for rendering this object. |
float
perInstanceRandom
The random per-instance value (normalized to range 0-1). |
int8
sortOrder
Object sorting key. |
Draw(const RenderContextBatch& renderContextBatch, const DrawInfo& info, float lodDitherFactor)
Draws the mesh.
Declaration
public void Draw(const RenderContextBatch& renderContextBatch, const DrawInfo& info, float lodDitherFactor) const
Parameters
RenderContextBatch
renderContextBatch
The rendering context batch. |
DrawInfo
info
The packed drawing info data. |
float
lodDitherFactor
The LOD transition dither factor. |
Init(uint32 vertices, uint32 triangles, const Array<const void* , FixedAllocation<3>>& vbData, const void* ibData, bool use16BitIndexBuffer, Array<GPUVertexLayout* , FixedAllocation<3>> vbLayout)
Declaration
public bool Init(uint32 vertices, uint32 triangles, const Array<const void* , FixedAllocation<3>>& vbData, const void* ibData, bool use16BitIndexBuffer, Array<GPUVertexLayout* , FixedAllocation<3>> vbLayout) override
Parameters
uint32
vertices
|
uint32
triangles
|
Array<void , FixedAllocation<3>>
vbData
|
void
ibData
|
bool
use16BitIndexBuffer
|
Array<GPUVertexLayout , FixedAllocation<3>>
vbLayout
|
Returns
bool
|
Release()
Releases the mesh data (GPU buffers and local cache).
Declaration
public virtual void Release() override
Overrides
UpdateMesh(uint32 vertexCount, uint32 triangleCount, const Float3* vertices, const uint16* triangles, const Float3* normals=nullptr, const Float3* tangents=nullptr, const Float2* uvs=nullptr, const Color32* colors=nullptr)
Updates the model mesh (used by the virtual models created with Init rather than Load). Can be used only for virtual assets (see IsVirtual() and CreateVirtualAsset()). Mesh data will be cached and uploaded to the GPU with a delay.
Declaration
public bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, const Float3* vertices, const uint16* triangles, const Float3* normals=nullptr, const Float3* tangents=nullptr, const Float2* uvs=nullptr, const Color32* colors=nullptr)
Parameters
uint32
vertexCount
The amount of vertices in the vertex buffer. |
uint32
triangleCount
The amount of triangles in the index buffer. |
Float3
vertices
The mesh vertices positions. Cannot be null. |
uint16
triangles
The mesh index buffer (clockwise triangles). Uses 32-bit stride buffer. Cannot be null. |
Float3
normals
The normal vectors (per vertex). |
Float3
tangents
The normal vectors (per vertex). Use null to compute them from normal vectors. |
Float2
uvs
The texture coordinates (per vertex). |
Color32
colors
The vertex colors (per vertex). |
Returns
bool
True if failed, otherwise false. |
UpdateMesh(uint32 vertexCount, uint32 triangleCount, const Float3* vertices, const uint32* triangles, const Float3* normals=nullptr, const Float3* tangents=nullptr, const Float2* uvs=nullptr, const Color32* colors=nullptr)
Updates the model mesh (used by the virtual models created with Init rather than Load). Can be used only for virtual assets (see IsVirtual() and CreateVirtualAsset()). Mesh data will be cached and uploaded to the GPU with a delay.
Declaration
public bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, const Float3* vertices, const uint32* triangles, const Float3* normals=nullptr, const Float3* tangents=nullptr, const Float2* uvs=nullptr, const Color32* colors=nullptr)
Parameters
uint32
vertexCount
The amount of vertices in the vertex buffer. |
uint32
triangleCount
The amount of triangles in the index buffer. |
Float3
vertices
The mesh vertices positions. Cannot be null. |
uint32
triangles
The mesh index buffer (clockwise triangles). Uses 32-bit stride buffer. Cannot be null. |
Float3
normals
The normal vectors (per vertex). |
Float3
tangents
The normal vectors (per vertex). Use null to compute them from normal vectors. |
Float2
uvs
The texture coordinates (per vertex). |
Color32
colors
The vertex colors (per vertex). |
Returns
bool
True if failed, otherwise false. |
UpdateMesh(uint32 vertexCount, uint32 triangleCount, const VB0ElementType* vb0, const VB1ElementType* vb1, const VB2ElementType* vb2, const uint16* ib)
Updates the model mesh (used by the virtual models created with Init rather than Load). [Deprecated in v1.10]
Declaration
public bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, const VB0ElementType* vb0, const VB1ElementType* vb1, const VB2ElementType* vb2, const uint16* ib)
Parameters
uint32
vertexCount
The amount of vertices in the vertex buffer. |
uint32
triangleCount
The amount of triangles in the index buffer. |
VB0ElementType
vb0
The first vertex buffer data. |
VB1ElementType
vb1
The second vertex buffer data. |
VB2ElementType
vb2
The third vertex buffer data. |
uint16
ib
The index buffer in clockwise order. |
Returns
bool
True if failed, otherwise false. |
UpdateMesh(uint32 vertexCount, uint32 triangleCount, const VB0ElementType* vb0, const VB1ElementType* vb1, const VB2ElementType* vb2, const uint32* ib)
Updates the model mesh (used by the virtual models created with Init rather than Load). [Deprecated in v1.10]
Declaration
public bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, const VB0ElementType* vb0, const VB1ElementType* vb1, const VB2ElementType* vb2, const uint32* ib)
Parameters
uint32
vertexCount
The amount of vertices in the vertex buffer. |
uint32
triangleCount
The amount of triangles in the index buffer. |
VB0ElementType
vb0
The first vertex buffer data. |
VB1ElementType
vb1
The second vertex buffer data. |
VB2ElementType
vb2
The third vertex buffer data. |
uint32
ib
The index buffer in clockwise order. |
Returns
bool
True if failed, otherwise false. |
UpdateMesh(uint32 vertexCount, uint32 triangleCount, const VB0ElementType* vb0, const VB1ElementType* vb1, const VB2ElementType* vb2, const void* ib, bool use16BitIndices)
Updates the model mesh (used by the virtual models created with Init rather than Load). Can be used only for virtual assets (see IsVirtual() and CreateVirtualAsset()). Mesh data will be cached and uploaded to the GPU with a delay. [Deprecated in v1.10]
Declaration
public bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, const VB0ElementType* vb0, const VB1ElementType* vb1, const VB2ElementType* vb2, const void* ib, bool use16BitIndices)
Parameters
uint32
vertexCount
The amount of vertices in the vertex buffer. |
uint32
triangleCount
The amount of triangles in the index buffer. |
VB0ElementType
vb0
The first vertex buffer data. |
VB1ElementType
vb1
The second vertex buffer data. |
VB2ElementType
vb2
The third vertex buffer data. |
void
ib
The index buffer in clockwise order. |
bool
use16BitIndices
True if index buffer uses 16-bit index buffer, otherwise 32-bit. |
Returns
bool
True if failed, otherwise false. |