BsMeshManager.h 2.5 KB

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