IIndexBuffer.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright (C) 2008-2012 Nikolaus Gebhardt
  2. // This file is part of the "Irrlicht Engine".
  3. // For conditions of distribution and use, see copyright notice in irrlicht.h
  4. #ifndef IRR_I_INDEX_BUFFER_H_INCLUDED
  5. #define IRR_I_INDEX_BUFFER_H_INCLUDED
  6. #include "IReferenceCounted.h"
  7. #include "EHardwareBufferFlags.h"
  8. #include "SVertexIndex.h"
  9. namespace irr
  10. {
  11. namespace scene
  12. {
  13. class IIndexBuffer : public virtual IReferenceCounted
  14. {
  15. public:
  16. //! Pointer to first element
  17. virtual void* getData() =0;
  18. //! Const pointer to first element
  19. virtual const void* getData() const =0;
  20. //! Same as getData(), just closer to core::array interface
  21. void* pointer() { return getData(); }
  22. virtual video::E_INDEX_TYPE getType() const =0;
  23. //! Change between 16 and 32 bit indices.
  24. /** This copies all indices to a new buffer of corresponding type.
  25. Be careful - going from 32 to 16 bit will only work correctly
  26. if none of your indices is larger than 16 bit. */
  27. virtual void setType(video::E_INDEX_TYPE IndexType) =0;
  28. //! Number of bytes per element
  29. virtual u32 stride() const =0;
  30. //! Number of elements
  31. virtual u32 size() const =0;
  32. //! Add value to end. Note that for 16 bit index types values shouldn't be larger than u16
  33. virtual void push_back(u32 value) =0;
  34. //! Set value at index. Note that for 16 bit index types values shouldn't be larger than u16
  35. /** Buffer must be already large enough. This is basically the non const version of operator [] */
  36. virtual void setValue(u32 index, u32 value) =0;
  37. //! Access element value at given index
  38. virtual u32 operator [](u32 index) const =0;
  39. virtual u32 getLast() =0;
  40. virtual void set_used(u32 usedNow) =0;
  41. virtual void reallocate(u32 new_size, bool canShrink=true) =0;
  42. virtual u32 allocated_size() const=0;
  43. //! get the current hardware mapping hint
  44. virtual E_HARDWARE_MAPPING getHardwareMappingHint() const =0;
  45. //! set the hardware mapping hint, for driver
  46. virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint ) =0;
  47. //! flags the meshbuffer as changed, reloads hardware buffers
  48. virtual void setDirty() = 0;
  49. //! Get the currently used ID for identification of changes.
  50. /** This shouldn't be used for anything outside the VideoDriver. */
  51. virtual u32 getChangedID() const = 0;
  52. };
  53. } // end namespace scene
  54. } // end namespace irr
  55. #endif