Search Results for

    Show / Hide Table of Contents

    Class Mesh

    Represents part of the model that is made of vertices and can be rendered using custom material and transformation.

    Inheritance
    Object
    ScriptingObject
    MeshBase
    Mesh
    Inherited Members
    MeshBase::_box
    MeshBase::_cachedIndexBuffer
    MeshBase::_cachedIndexBufferCount
    MeshBase::_cachedVertexBufferCount
    MeshBase::_cachedVertexBuffers
    MeshBase::_cachedVertexLayouts
    MeshBase::_collisionProxy
    ScriptingObject::_gcHandle
    MeshBase::_hasBounds
    ScriptingObject::_id
    MeshBase::_index
    MeshBase::_indexBuffer
    MeshBase::_lodIndex
    MeshBase::_materialSlotIndex
    MeshBase::_model
    MeshBase::_sphere
    MeshBase::_triangles
    ScriptingObject::_type
    MeshBase::_use16BitIndexBuffer
    MeshBase::_vertexBuffers
    MeshBase::_vertices
    ScriptingObject::CanCast(const ScriptingTypeHandle& from, const ScriptingTypeHandle& to)
    ScriptingObject::CanCast(const MClass* from, const MClass* to)
    ScriptingObject::Cast(ScriptingObject* obj)
    ScriptingObject::ChangeID(const Guid& newId)
    ScriptingObject::CreateManaged()
    ScriptingObject::CreateManagedInternal()
    ScriptingObject::Deleted
    Object::DeleteObject(float timeToLive = 0.0f, bool useGameTime=false)
    Object::DeleteObjectNow()
    MeshBase::DEPRECATED("Use Release instead.") void Unload()
    ScriptingObject::DestroyManaged()
    MeshBase::DownloadData(Span<MeshBufferType> types, Array<BytesContainer, FixedAllocation<4>>& buffers, Array<GPUVertexLayout* , FixedAllocation<4>>& layouts, bool forceGpu=false)
    MeshBase::DownloadDataCPU(MeshBufferType type, BytesContainer& result, int32& count, GPUVertexLayout* *layout=nullptr)
    MeshBase::DownloadDataGPU(MeshBufferType type, BytesContainer& result, GPUVertexLayout* *layout=nullptr)
    MeshBase::DownloadDataGPUAsync(MeshBufferType type, BytesContainer& result, GPUVertexLayout* *layout=nullptr)
    Object::Flags
    ScriptingObject::FromInterface(void* interfaceObj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::FromInterface(T* interfaceObj)
    MeshBase::GetBox()
    ScriptingObject::GetClass()
    MeshBase::GetCollisionProxy()
    MeshBase::GetDrawCallGeometry(struct DrawCall& drawCall)
    ScriptingObject::GetID()
    MeshBase::GetIndex()
    MeshBase::GetIndexBuffer()
    MeshBase::GetLODIndex()
    ScriptingObject::GetManagedInstance()
    MeshBase::GetMaterialSlotIndex()
    MeshBase::GetModelBase()
    ScriptingObject::GetOrCreateManagedInstance()
    MeshBase::GetSphere()
    MeshBase::GetTriangleCount()
    ScriptingObject::GetType()
    ScriptingObject::GetTypeHandle()
    MeshBase::GetVertexBuffer(int32 index)
    MeshBase::GetVertexCount()
    MeshBase::GetVertexLayout()
    ScriptingObject::HasManagedInstance()
    MeshBase::HasVertexColors()
    MeshBase::Init(uint32 vertices, uint32 triangles, const Array<const void* , FixedAllocation<MODEL_MAX_VB>>& vbData, const void* ibData, bool use16BitIndexBuffer, Array<GPUVertexLayout* , FixedAllocation<MODEL_MAX_VB>> vbLayout)
    MeshBase::Intersects(const Ray& ray, const Matrix& world, Real& distance, Vector3& normal)
    MeshBase::Intersects(const Ray& ray, const Transform& transform, Real& distance, Vector3& normal)
    ScriptingObject::Is(const ScriptingTypeHandle& type)
    ScriptingObject::Is(const MClass* type)
    ScriptingObject::Is()
    MeshBase::IsInitialized()
    ScriptingObject::IsRegistered()
    MeshBase::Link(ModelBase* model, int32 lodIndex, int32 index)
    MeshBase::MeshBase(const SpawnParams& params)
    ScriptingObject::NewObject(const ScriptingTypeHandle& typeHandle)
    ScriptingObject::NewObject()
    ScriptingObject::OnDeleteObject()
    ScriptingObject::OnManagedInstanceDeleted()
    ScriptingObject::OnScriptingDispose()
    ScriptingObject::RegisterObject()
    MeshBase::Render(GPUContext* context)
    ScriptingObject::ScriptingObject(const SpawnParams& params)
    MeshBase::SetBounds(const BoundingBox& box)
    MeshBase::SetBounds(const BoundingBox& box, const BoundingSphere& sphere)
    ScriptingObject::SetManagedInstance(MObject* instance)
    MeshBase::SetMaterialSlotIndex(int32 value)
    Mesh
    ScriptingObject::ToInterface(ScriptingObject* obj, const ScriptingTypeHandle& interfaceType)
    ScriptingObject::ToInterface(ScriptingObject* obj)
    ScriptingObject::ToManaged(const ScriptingObject* obj)
    ScriptingObject::ToNative(MObject* obj)
    ScriptingObject::ToString()
    ScriptingObject::UnregisterObject()
    MeshBase::UpdateTriangles(uint32 triangleCount, const uint32* ib)
    MeshBase::UpdateTriangles(uint32 triangleCount, const uint16* ib)
    MeshBase::UpdateTriangles(uint32 triangleCount, const void* ib, bool use16BitIndices)
    MeshBase::Use16BitIndexBuffer()
    MeshBase::~MeshBase()
    Object::~Object()
    ScriptingObject::~ScriptingObject()
    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
    MeshBase::Release()

    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.

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