BsGLIndexBuffer.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #pragma once
  2. #include "BsGLPrerequisites.h"
  3. #include "BsIndexBuffer.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief OpenGL implementation of an index buffer.
  8. */
  9. class BS_RSGL_EXPORT GLIndexBufferCore : public IndexBufferCore
  10. {
  11. public:
  12. GLIndexBufferCore(GpuBufferUsage usage, bool useSystemMemory, const IndexBufferProperties& properties);
  13. ~GLIndexBufferCore() { }
  14. /**
  15. * @copydoc IndexBufferCore::readData
  16. */
  17. void readData(UINT32 offset, UINT32 length, void* pDest);
  18. /**
  19. * @copydoc IndexBufferCore::writeData
  20. */
  21. void writeData(UINT32 offset, UINT32 length, const void* pSource,
  22. BufferWriteType writeFlags = BufferWriteType::Normal);
  23. /**
  24. * @brief Returns internal OpenGL index buffer handle.
  25. */
  26. GLuint getGLBufferId() const { return mBufferId; }
  27. protected:
  28. /**
  29. * @copydoc IndexBufferCore::initialize
  30. */
  31. void initialize();
  32. /**
  33. * @copydoc IndexBufferCore::destroy
  34. */
  35. void destroy();
  36. /**
  37. * @copydoc IndexBufferCore::lockImpl
  38. */
  39. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
  40. /**
  41. * @copydoc IndexBufferCore::unlockImpl
  42. */
  43. void unlockImpl();
  44. private:
  45. GLuint mBufferId;
  46. bool mZeroLocked;
  47. };
  48. /**
  49. * @brief OpenGL implementation of an index buffer.
  50. */
  51. class BS_RSGL_EXPORT GLIndexBuffer : public IndexBuffer
  52. {
  53. public:
  54. ~GLIndexBuffer() { }
  55. protected:
  56. friend class GLHardwareBufferManager;
  57. GLIndexBuffer(IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
  58. /**
  59. * @copydoc CoreObject::createCore
  60. */
  61. virtual SPtr<CoreObjectCore> createCore() const;
  62. };
  63. }