|
|
@@ -10,6 +10,11 @@
|
|
|
|
|
|
namespace BansheeEngine
|
|
|
{
|
|
|
+ /**
|
|
|
+ * @brief Primary class for holding geometry. Stores data in the form of a vertex
|
|
|
+ * buffers and optionally index buffer, which may be bound to the pipeline for drawing.
|
|
|
+ * May contain multiple sub-meshes.
|
|
|
+ */
|
|
|
class CM_EXPORT Mesh : public MeshBase
|
|
|
{
|
|
|
public:
|
|
|
@@ -45,7 +50,14 @@ namespace BansheeEngine
|
|
|
*/
|
|
|
UINT32 mapToSubresourceIdx() const { return 0; }
|
|
|
|
|
|
+ /**
|
|
|
+ * @brief Returns an axis aligned bounding box of the geometry contained in the vertex buffers for all submeshes.
|
|
|
+ */
|
|
|
const AABox& getBounds() const;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @brief Returns an axis aligned bounding box of the geometry contained in the specific sub-mesh.
|
|
|
+ */
|
|
|
const AABox& getBounds(UINT32 submeshIdx) const;
|
|
|
|
|
|
/**
|
|
|
@@ -112,25 +124,84 @@ namespace BansheeEngine
|
|
|
/************************************************************************/
|
|
|
|
|
|
public:
|
|
|
+ /**
|
|
|
+ * @brief Creates a new empty mesh.
|
|
|
+ *
|
|
|
+ * @param numVertices Number of vertices in the mesh.
|
|
|
+ * @param numIndices Number of indices in the mesh.
|
|
|
+ * @param vertexDesc Vertex description structure that describes how are vertices organized in the
|
|
|
+ * vertex buffer. When binding a mesh to the pipeline you must ensure vertex description
|
|
|
+ * at least partially matches the input description of the currently bound vertex GPU program.
|
|
|
+ * @param bufferType Specify static for buffers you don't plan on updating other reading from often. Otherwise specify
|
|
|
+ * dynamic. This parameter affects performance.
|
|
|
+ * @param drawOp Determines how should the provided indices be interpreted by the pipeline. Default option is triangles,
|
|
|
+ * where three indices represent a single triangle.
|
|
|
+ * @param indexType Size of indices, use smaller size for better performance, however be careful not to go over
|
|
|
+ * the number of vertices limited by the size.
|
|
|
+ */
|
|
|
static HMesh create(UINT32 numVertices, UINT32 numIndices,
|
|
|
const VertexDataDescPtr& vertexDesc, MeshBufferType bufferType = MeshBufferType::Static,
|
|
|
DrawOperationType drawOp = DOT_TRIANGLE_LIST, IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
|
|
|
|
|
|
+ /**
|
|
|
+ * @brief Creates a new mesh and immediately writes some data to the mesh. This is faster than writing
|
|
|
+ * the data in a separate step after creation.
|
|
|
+ *
|
|
|
+ * @param numVertices Number of vertices in the mesh.
|
|
|
+ * @param numIndices Number of indices in the mesh.
|
|
|
+ * @param vertexDesc Vertex description structure that describes how are vertices organized in the
|
|
|
+ * vertex buffer. When binding a mesh to the pipeline you must ensure vertex description
|
|
|
+ * at least partially matches the input description of the currently bound vertex GPU program.
|
|
|
+ * @param initialMeshData Vertex and index data used for initializing the mesh. Caller must ensure the data vertex and index buffers
|
|
|
+ * match the ones in the mesh, however the data might only write to a certain subset of the mesh, it does not
|
|
|
+ * have to write to all of it.
|
|
|
+ * @param bufferType Specify static for buffers you don't plan on updating other reading from often. Otherwise specify
|
|
|
+ * dynamic. This parameter affects performance.
|
|
|
+ * @param drawOp Determines how should the provided indices be interpreted by the pipeline. Default option is triangles,
|
|
|
+ * where three indices represent a single triangle.
|
|
|
+ * @param indexType Size of indices, use smaller size for better performance, however be careful not to go over
|
|
|
+ * the number of vertices limited by the size.
|
|
|
+ */
|
|
|
static HMesh create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, const MeshDataPtr& initialMeshData,
|
|
|
MeshBufferType bufferType = MeshBufferType::Static, DrawOperationType drawOp = DOT_TRIANGLE_LIST,
|
|
|
IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
|
|
|
|
|
|
+ /**
|
|
|
+ * @brief Creates a new mesh from an existing mesh data. Created mesh will match the vertex and index buffers described
|
|
|
+ * by the mesh data exactly.
|
|
|
+ *
|
|
|
+ * @param initialMeshData Vertex and index data used for initializing the mesh.
|
|
|
+ * @param bufferType Specify static for buffers you don't plan on updating other reading from often. Otherwise specify
|
|
|
+ * dynamic. This parameter affects performance.
|
|
|
+ * @param drawOp Determines how should the provided indices be interpreted by the pipeline. Default option is triangles,
|
|
|
+ * where three indices represent a single triangle.
|
|
|
+ */
|
|
|
static HMesh create(const MeshDataPtr& initialMeshData, MeshBufferType bufferType = MeshBufferType::Static,
|
|
|
DrawOperationType drawOp = DOT_TRIANGLE_LIST);
|
|
|
|
|
|
+ /**
|
|
|
+ * @copydoc create(UINT32, UINT32, const VertexDataDescPtr&, MeshBufferType, DrawOperationType, IndexBuffer::IndexType)
|
|
|
+ *
|
|
|
+ * @note Internal method. Use "create" for normal use.
|
|
|
+ */
|
|
|
static MeshPtr _createPtr(UINT32 numVertices, UINT32 numIndices,
|
|
|
const VertexDataDescPtr& vertexDesc, MeshBufferType bufferType = MeshBufferType::Static,
|
|
|
DrawOperationType drawOp = DOT_TRIANGLE_LIST, IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
|
|
|
|
|
|
+ /**
|
|
|
+ * @copydoc create(UINT32, UINT32, const VertexDataDescPtr&, const MeshDataPtr&, MeshBufferType, DrawOperationType, IndexBuffer::IndexType)
|
|
|
+ *
|
|
|
+ * @note Internal method. Use "create" for normal use.
|
|
|
+ */
|
|
|
static MeshPtr _createPtr(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, const MeshDataPtr& initialMeshData,
|
|
|
MeshBufferType bufferType = MeshBufferType::Static, DrawOperationType drawOp = DOT_TRIANGLE_LIST,
|
|
|
IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
|
|
|
|
|
|
+ /**
|
|
|
+ * @copydoc create(const MeshDataPtr&, MeshBufferType, DrawOperationType)
|
|
|
+ *
|
|
|
+ * @note Internal method. Use "create" for normal use.
|
|
|
+ */
|
|
|
static MeshPtr _createPtr(const MeshDataPtr& initialMeshData, MeshBufferType bufferType = MeshBufferType::Static,
|
|
|
DrawOperationType drawOp = DOT_TRIANGLE_LIST);
|
|
|
};
|