IVertexBuffer.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #pragma once
  5. #include "IReferenceCounted.h"
  6. #include "irrArray.h"
  7. #include "EHardwareBufferFlags.h"
  8. #include "S3DVertex.h"
  9. namespace irr
  10. {
  11. namespace scene
  12. {
  13. class IVertexBuffer : public virtual IReferenceCounted
  14. {
  15. public:
  16. //! Get type of vertex data which is stored in this meshbuffer.
  17. /** \return Vertex type of this buffer. */
  18. virtual video::E_VERTEX_TYPE getType() const = 0;
  19. //! Get access to vertex data. The data is an array of vertices.
  20. /** Which vertex type is used can be determined by getVertexType().
  21. \return Pointer to array of vertices. */
  22. virtual const void *getData() const = 0;
  23. //! Get access to vertex data. The data is an array of vertices.
  24. /** Which vertex type is used can be determined by getVertexType().
  25. \return Pointer to array of vertices. */
  26. virtual void *getData() = 0;
  27. //! Get amount of vertices in meshbuffer.
  28. /** \return Number of vertices in this buffer. */
  29. virtual u32 getCount() const = 0;
  30. //! returns position of vertex i
  31. virtual const core::vector3df &getPosition(u32 i) const = 0;
  32. //! returns position of vertex i
  33. virtual core::vector3df &getPosition(u32 i) = 0;
  34. //! returns normal of vertex i
  35. virtual const core::vector3df &getNormal(u32 i) const = 0;
  36. //! returns normal of vertex i
  37. virtual core::vector3df &getNormal(u32 i) = 0;
  38. //! returns texture coord of vertex i
  39. virtual const core::vector2df &getTCoords(u32 i) const = 0;
  40. //! returns texture coord of vertex i
  41. virtual core::vector2df &getTCoords(u32 i) = 0;
  42. //! get the current hardware mapping hint
  43. virtual E_HARDWARE_MAPPING getHardwareMappingHint() const = 0;
  44. //! set the hardware mapping hint, for driver
  45. virtual void setHardwareMappingHint(E_HARDWARE_MAPPING newMappingHint) = 0;
  46. //! flags the meshbuffer as changed, reloads hardware buffers
  47. virtual void setDirty() = 0;
  48. //! Get the currently used ID for identification of changes.
  49. /** This shouldn't be used for anything outside the VideoDriver. */
  50. virtual u32 getChangedID() const = 0;
  51. //! Used by the VideoDriver to remember the buffer link.
  52. virtual void setHWBuffer(void *ptr) const = 0;
  53. virtual void *getHWBuffer() const = 0;
  54. };
  55. } // end namespace scene
  56. } // end namespace irr