BsMeshManager.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsModule.h"
  4. #include "BsMesh.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Manager that handles creation of Meshes.
  9. */
  10. class BS_CORE_EXPORT MeshManager : public Module<MeshManager>
  11. {
  12. public:
  13. MeshManager();
  14. ~MeshManager();
  15. /**
  16. * @copydoc Mesh::create(UINT32, UINT32, const VertexDataDescPtr&, MeshBufferType, DrawOperationType, IndexBuffer::IndexType)
  17. */
  18. MeshPtr create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, MeshBufferType bufferType = MeshBufferType::Static,
  19. DrawOperationType drawOp = DOT_TRIANGLE_LIST, IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
  20. /**
  21. * @copydoc Mesh::create(UINT32, UINT32, const VertexDataDescPtr&, const Vector<SubMesh>&, MeshBufferType, IndexBuffer::IndexType)
  22. */
  23. MeshPtr create(UINT32 numVertices, UINT32 numIndices, const VertexDataDescPtr& vertexDesc, const Vector<SubMesh>& subMeshes,
  24. MeshBufferType bufferType = MeshBufferType::Static, IndexBuffer::IndexType indexType = IndexBuffer::IT_32BIT);
  25. /**
  26. * @copyodc Mesh::create(const MeshDataPtr&, MeshBufferType, DrawOperationType)
  27. */
  28. MeshPtr create(const MeshDataPtr& initialData, MeshBufferType bufferType = MeshBufferType::Static, DrawOperationType drawOp = DOT_TRIANGLE_LIST);
  29. /**
  30. * @copyodc Mesh::create(const MeshDataPtr&, const Vector<SubMesh>&, MeshBufferType)
  31. */
  32. MeshPtr create(const MeshDataPtr& initialData, const Vector<SubMesh>& subMeshes, MeshBufferType bufferType = MeshBufferType::Static);
  33. /**
  34. * @brief Creates a new empty and uninitialized mesh. You will need to manually initialize the mesh before using it.
  35. *
  36. * @note This should only be used for special cases and is not meant for normal use.
  37. */
  38. MeshPtr createEmpty();
  39. /**
  40. * @brief Returns some dummy mesh data with one triangle you may use for initializing a mesh.
  41. */
  42. MeshDataPtr getDummyMeshData() const { return mDummyMeshData; }
  43. /**
  44. * @brief Returns a dummy mesh containing one triangle.
  45. */
  46. HMesh getDummyMesh() const { return mDummyMesh; }
  47. protected:
  48. /**
  49. * @copydoc Module::onStartUp
  50. */
  51. virtual void onStartUp();
  52. private:
  53. MeshDataPtr mDummyMeshData;
  54. HMesh mDummyMesh;
  55. };
  56. }