3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Graphics.ModelMeshPart Class Reference

Represents a mesh formed by a index and vertex buffer, plus an effect. Bounding box and bounding sphere are also stored for frustum culling. More...

#include <ModelMeshPart.hpp>

Inheritance diagram for Engine3DRadSpace.Graphics.ModelMeshPart:
Collaboration diagram for Engine3DRadSpace.Graphics.ModelMeshPart:

Public Member Functions

 ModelMeshPart (IntPtr handle)
unsafe ModelMeshPart (IGraphicsDevice device, IntPtr pVertexData, ulong numVerts, ulong structSize, uint *indices, ulong numIndices)
 ModelMeshPart (IVertexBuffer vbuff, IIndexBuffer ibuff, Effect effect)
 ModelMeshPart (Graphics::IVertexBuffer *vert, Graphics::IIndexBuffer *index)
 Constructs a model mesh part with specified GPU vertex and index buffers.
 ModelMeshPart (IGraphicsDevice *Device, void *vertices, size_t numVerts, size_t structSize, std::span< unsigned > indices)
 Constructs a model mesh part with specified CPU vertex buffers.
 ModelMeshPart (ModelMeshPart &&meshPart) noexcept=default
 ModelMeshPart (ModelMeshPart &meshPart)=delete
ModelMeshPart & operator= (ModelMeshPart &)=delete
ModelMeshPart & operator= (ModelMeshPart &&meshPart) noexcept=default
template<VertexDecl V>
 ModelMeshPart (IGraphicsDevice *Device, std::span< V > vertices, std::span< unsigned > indices)
 Constructs a model mesh part with specified vertex format.
Math::Matrix4x4 MVP () const noexcept
 Gets the combined Model-View-Projection matrix for this mesh part.
Math::BoundingBox GetBoundingBox () const noexcept
 Gets the bounding box of the mesh part. This is used for frustum culling and collision detection.
Math::BoundingSphere GetBoundingSphere () const noexcept
 Gets the bounding sphere of the mesh part. This is used for frustum culling and collision detection.
Graphics::IVertexBuffer * GetVertexBuffer () const noexcept
 Gets the underlying vertex buffer of this mesh part.
Graphics::IIndexBuffer * GetIndexBuffer () const noexcept
 Gets the underlying index buffer of this mesh part.
std::pair< Graphics::IVertexBuffer *, Graphics::IIndexBuffer * > CreateStagingBuffers ()
 Creates staging vertex and index buffers available for CPU reading if they don't exist. If they already exist, returns the already created buffers.
 ~ModelMeshPart ()=default
Public Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
virtual void Dispose ()

Public Attributes

std::unique_ptr< IIndexBuffer > IndexBuffer
std::unique_ptr< IVertexBuffer > VertexBuffer
Math::Matrix4x4 ImportOffset = Math::Matrix4x4()
 Import offset set by the model importer.
Math::Matrix4x4 World = Math::Matrix4x4()
 World/Model transform matrix.
Math::Matrix4x4 View = Math::Matrix4x4()
 Assigned view matrix. Usually obtained from the selected camera.
Math::Matrix4x4 Projection = Math::Matrix4x4()
 Assigned projection matrix. Usually obtained from the selected camera.
Rendering::MaterialDescriptor Material
 Describes the material properties of this mesh part.
std::vector< std::unique_ptr< ITexture2D > > Textures
 All textures used by this mesh part. The order of the textures should match the order expected by the effect/shader.
std::vector< std::unique_ptr< ISamplerState > > TextureSamplers
 All sampler states used by the textures.

Properties

BoundingBox BoundingBox [get]
BoundingSphere BoundingSphere [get]
IVertexBuffer VertexBuffer [get]
IIndexBuffer IndexBuffer [get]
unsafe Matrix4x4 Transform [get, set]
MaterialDescriptor Material [get, set]
Properties inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr Handle [get]

Friends

class Model3D

Additional Inherited Members

Protected Member Functions inherited from Engine3DRadSpace.NatPtrWrapper
 NatPtrWrapper (IntPtr handle, Action< IntPtr > fnDestroy)
 NatPtrWrapper (Action< IntPtr > fnDestroy)
void Reset (IntPtr newObj)
void Dispose (bool disposing)
Protected Attributes inherited from Engine3DRadSpace.NatPtrWrapper
IntPtr _handle
bool _disposed

Detailed Description

Represents a mesh formed by a index and vertex buffer, plus an effect. Bounding box and bounding sphere are also stored for frustum culling.

Constructor & Destructor Documentation

◆ ModelMeshPart() [1/8]

Engine3DRadSpace.Graphics.ModelMeshPart.ModelMeshPart ( IntPtr handle)
inline

◆ ModelMeshPart() [2/8]

unsafe Engine3DRadSpace.Graphics.ModelMeshPart.ModelMeshPart ( IGraphicsDevice device,
IntPtr pVertexData,
ulong numVerts,
ulong structSize,
uint * indices,
ulong numIndices )
inline

◆ ModelMeshPart() [3/8]

Engine3DRadSpace.Graphics.ModelMeshPart.ModelMeshPart ( IVertexBuffer vbuff,
IIndexBuffer ibuff,
Effect effect )
inline

◆ ModelMeshPart() [4/8]

Constructs a model mesh part with specified GPU vertex and index buffers.

Parameters
vertThe GPU vertex buffer.
indexThe GPU index buffer.

◆ ModelMeshPart() [5/8]

ModelMeshPart::ModelMeshPart ( IGraphicsDevice * Device,
void * vertices,
size_t numVerts,
size_t structSize,
std::span< unsigned > indices )

Constructs a model mesh part with specified CPU vertex buffers.

Parameters
DeviceThe graphics device.
verticesThe vertex data.
numVertsThe number of vertices.
structSizeThe size of each vertex structure.
indices

◆ ModelMeshPart() [6/8]

◆ ModelMeshPart() [7/8]

◆ ModelMeshPart() [8/8]

template<VertexDecl V>
Engine3DRadSpace.Graphics.ModelMeshPart::ModelMeshPart ( IGraphicsDevice * Device,
std::span< V > vertices,
std::span< unsigned > indices )
inline

Constructs a model mesh part with specified vertex format.

Template Parameters
VThe vertex declaration type.
Parameters
DeviceThe graphics device.
verticesThe vertex data.
indicesThe index data.

◆ ~ModelMeshPart()

Engine3DRadSpace.Graphics.ModelMeshPart.~ModelMeshPart ( )
default

Member Function Documentation

◆ CreateStagingBuffers()

std::pair< IVertexBuffer *, IIndexBuffer * > ModelMeshPart::CreateStagingBuffers ( )

Creates staging vertex and index buffers available for CPU reading if they don't exist. If they already exist, returns the already created buffers.

Returns
Pair of vertex and index buffers pointer references

◆ GetBoundingBox()

BoundingBox ModelMeshPart::GetBoundingBox ( ) const
noexcept

Gets the bounding box of the mesh part. This is used for frustum culling and collision detection.

Returns
The bounding box of the mesh part.

◆ GetBoundingSphere()

BoundingSphere ModelMeshPart::GetBoundingSphere ( ) const
noexcept

Gets the bounding sphere of the mesh part. This is used for frustum culling and collision detection.

Returns
The bounding sphere of the mesh part.

◆ GetIndexBuffer()

IIndexBuffer * ModelMeshPart::GetIndexBuffer ( ) const
noexcept

Gets the underlying index buffer of this mesh part.

Returns

◆ GetVertexBuffer()

IVertexBuffer * ModelMeshPart::GetVertexBuffer ( ) const
noexcept

Gets the underlying vertex buffer of this mesh part.

Returns

◆ MVP()

Matrix4x4 ModelMeshPart::MVP ( ) const
noexcept

Gets the combined Model-View-Projection matrix for this mesh part.

Returns
The combined Model-View-Projection matrix.

◆ operator=() [1/2]

ModelMeshPart & Engine3DRadSpace.Graphics.ModelMeshPart.operator= ( ModelMeshPart && meshPart)
defaultnoexcept

◆ operator=() [2/2]

ModelMeshPart & Engine3DRadSpace.Graphics.ModelMeshPart.operator= ( ModelMeshPart & )
delete

◆ Model3D

friend class Model3D
friend

Member Data Documentation

◆ ImportOffset

Math::Matrix4x4 Engine3DRadSpace.Graphics.ModelMeshPart.ImportOffset = Math::Matrix4x4()

Import offset set by the model importer.

◆ IndexBuffer

◆ Material

Describes the material properties of this mesh part.

◆ Projection

Math::Matrix4x4 Engine3DRadSpace.Graphics.ModelMeshPart.Projection = Math::Matrix4x4()

Assigned projection matrix. Usually obtained from the selected camera.

◆ Textures

std::vector<std::unique_ptr<ITexture2D> > Engine3DRadSpace.Graphics.ModelMeshPart.Textures

All textures used by this mesh part. The order of the textures should match the order expected by the effect/shader.

◆ TextureSamplers

std::vector<std::unique_ptr<ISamplerState> > Engine3DRadSpace.Graphics.ModelMeshPart.TextureSamplers

All sampler states used by the textures.

◆ VertexBuffer

◆ View

Math::Matrix4x4 Engine3DRadSpace.Graphics.ModelMeshPart.View = Math::Matrix4x4()

Assigned view matrix. Usually obtained from the selected camera.

◆ World

Math::Matrix4x4 Engine3DRadSpace.Graphics.ModelMeshPart.World = Math::Matrix4x4()

World/Model transform matrix.

Property Documentation

◆ BoundingBox

BoundingBox Engine3DRadSpace.Graphics.ModelMeshPart.BoundingBox
get

◆ BoundingSphere

BoundingSphere Engine3DRadSpace.Graphics.ModelMeshPart.BoundingSphere
get

◆ IndexBuffer

IIndexBuffer Engine3DRadSpace.Graphics.ModelMeshPart.IndexBuffer
get

◆ Material

MaterialDescriptor Engine3DRadSpace.Graphics.ModelMeshPart.Material
getset

◆ Transform

unsafe Matrix4x4 Engine3DRadSpace.Graphics.ModelMeshPart.Transform
getset

◆ VertexBuffer

IVertexBuffer Engine3DRadSpace.Graphics.ModelMeshPart.VertexBuffer
get

The documentation for this class was generated from the following files: