ReflectionProxyComponent.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright (C) 2009-2016, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #pragma once
  6. #include <anki/scene/SceneComponent.h>
  7. #include <anki/collision/Plane.h>
  8. namespace anki
  9. {
  10. /// @addtogroup scene
  11. /// @{
  12. /// Reflection proxy component.
  13. class ReflectionProxyComponent : public SceneComponent
  14. {
  15. public:
  16. /// Reflection proxy face. One out of many
  17. class Face
  18. {
  19. public:
  20. Array<Vec4, 4> m_vertices;
  21. Plane m_plane;
  22. };
  23. ReflectionProxyComponent(SceneNode* node, U faceCount)
  24. : SceneComponent(SceneComponent::Type::REFLECTION_PROXY, node)
  25. {
  26. ANKI_ASSERT(faceCount > 0);
  27. m_faces.create(getAllocator(), faceCount);
  28. }
  29. ~ReflectionProxyComponent()
  30. {
  31. m_faces.destroy(getAllocator());
  32. }
  33. static Bool classof(const SceneComponent& c)
  34. {
  35. return c.getType() == Type::REFLECTION_PROXY;
  36. }
  37. void setQuad(
  38. U index, const Vec4& a, const Vec4& b, const Vec4& c, const Vec4& d);
  39. const DArray<Face>& getFaces() const
  40. {
  41. ANKI_ASSERT(m_faces.getSize() > 0);
  42. return m_faces;
  43. }
  44. ANKI_USE_RESULT Error update(
  45. SceneNode& node, F32 prevTime, F32 crntTime, Bool& updated) final;
  46. private:
  47. DArray<Face> m_faces; ///< Quads.
  48. Bool8 m_dirty = true;
  49. };
  50. /// @}
  51. } // end namespace anki