BsDrawList.h 1.5 KB

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