BsDrawList.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsVector3.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Represents a single drawable object
  8. * stored in a DrawList.
  9. */
  10. struct BS_CORE_EXPORT DrawOperation
  11. {
  12. MaterialPtr material;
  13. MeshBasePtr mesh;
  14. UINT32 submeshIdx;
  15. Vector3 worldPosition;
  16. };
  17. /**
  18. * @brief A container you may use to queue
  19. * custom drawable objects in.
  20. */
  21. class BS_CORE_EXPORT DrawList
  22. {
  23. public:
  24. /**
  25. * @brief Adds a new drawable object.
  26. *
  27. * @param material Material to draw the object with.
  28. * @param mesh Parent mesh of the object.
  29. * @param submeshIdx Index of the sub-mesh to render, in the parent mesh.
  30. * @param worldPosForSort World position of the object that will be used for distance
  31. * sorting before rendering.
  32. */
  33. void add(const MaterialPtr& material, const MeshBasePtr& mesh, UINT32 submeshIdx, const Vector3& worldPosForSort);
  34. /**
  35. * @brief Removes all queued drawable objects.
  36. */
  37. void clear();
  38. /**
  39. * @brief Returns all queued drawable objects.
  40. */
  41. const Vector<DrawOperation>& getDrawOperations() const;
  42. protected:
  43. Vector<DrawOperation> mDrawOperations;
  44. };
  45. }