BsRenderable.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include "BsPrerequisites.h"
  3. #include "BsRenderOperation.h"
  4. #include "CmComponent.h"
  5. #include "CmAABox.h"
  6. namespace BansheeEngine
  7. {
  8. class BS_EXPORT Renderable : public CM::Component
  9. {
  10. public:
  11. void setMesh(CM::HMesh mesh) { mMesh = mesh; }
  12. void setNumMaterials(CM::UINT32 numMaterials);
  13. void setMaterial(CM::UINT32 idx, CM::HMaterial material);
  14. void setLayer(CM::UINT64 layer);
  15. CM::UINT32 getNumRenderOperations() const;
  16. /**
  17. * @note This method relies on getNumRenderOperations() being called and ensuring that idx doesn't exceed
  18. * the number returned by that method
  19. */
  20. RenderOperation getRenderOperation(CM::UINT32 idx) const;
  21. CM::UINT64 getLayer() const { return mLayer; }
  22. void updateWorldBounds();
  23. private:
  24. CM::HMesh mMesh;
  25. CM::Vector<CM::HMaterial>::type mMaterials;
  26. CM::UINT64 mLayer;
  27. CM::Vector<CM::AABox>::type mWorldBounds;
  28. /************************************************************************/
  29. /* COMPONENT OVERRIDES */
  30. /************************************************************************/
  31. protected:
  32. friend class CM::SceneObject;
  33. /** Standard constructor.
  34. */
  35. Renderable(const CM::HSceneObject& parent);
  36. public:
  37. virtual void update() {}
  38. /************************************************************************/
  39. /* RTTI */
  40. /************************************************************************/
  41. public:
  42. friend class RenderableRTTI;
  43. static CM::RTTITypeBase* getRTTIStatic();
  44. virtual CM::RTTITypeBase* getRTTI() const;
  45. protected:
  46. Renderable() {} // Serialization only
  47. };
  48. }