BsIndexBuffer.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsHardwareBuffer.h"
  4. #include "BsCoreObject.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Hardware buffer that hold indices that reference vertices in a vertex buffer.
  9. */
  10. class BS_CORE_EXPORT IndexBuffer : public HardwareBuffer, public CoreObject
  11. {
  12. public:
  13. /**
  14. * @brief Type of the indices used, used for determining size.
  15. */
  16. enum IndexType
  17. {
  18. IT_16BIT,
  19. IT_32BIT
  20. };
  21. ~IndexBuffer();
  22. /**
  23. * @brief Returns the type of indices stored.
  24. */
  25. IndexType getType() const { return mIndexType; }
  26. /**
  27. * @brief Returns the number of indices this buffer can hold.
  28. */
  29. UINT32 getNumIndices() const { return mNumIndexes; }
  30. /**
  31. * @brief Returns the size of a single index in bytes.
  32. */
  33. UINT32 getIndexSize() const { return mIndexSize; }
  34. /**
  35. * @copydoc HardwareBufferManager::createIndexBuffer
  36. */
  37. static IndexBufferPtr create(IndexBuffer::IndexType itype, UINT32 numIndexes, GpuBufferUsage usage);
  38. protected:
  39. IndexBuffer(IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage, bool useSystemMemory);
  40. protected:
  41. IndexType mIndexType;
  42. UINT32 mNumIndexes;
  43. UINT32 mIndexSize;
  44. };
  45. }