DebugRenderer.pkg 1.9 KB

1234567891011121314151617181920212223242526272829303132333435
  1. $#include "DebugRenderer.h"
  2. /// Debug geometry rendering component. Should be added only to the root scene node.
  3. class DebugRenderer : public Component
  4. {
  5. public:
  6. /// Set the camera viewpoint. Call before rendering, or before adding geometry if you want to use culling.
  7. void SetView(Camera* camera);
  8. /// Add a line.
  9. void AddLine(const Vector3& start, const Vector3& end, const Color& color, bool depthTest = true);
  10. /// Add a line with color already converted to unsigned.
  11. void AddLine(const Vector3& start, const Vector3& end, unsigned color, bool depthTest = true);
  12. /// Add a scene node represented as its coordinate axes.
  13. void AddNode(Node* node, float scale = 1.0f, bool depthTest = true);
  14. /// Add a bounding box.
  15. void AddBoundingBox(const BoundingBox& box, const Color& color, bool depthTest = true);
  16. /// Add a bounding box with transform.
  17. void AddBoundingBox(const BoundingBox& box, const Matrix3x4& transform, const Color& color, bool depthTest = true);
  18. /// Add a frustum.
  19. void AddFrustum(const Frustum& frustum, const Color& color, bool depthTest = true);
  20. /// Add a polyhedron.
  21. void AddPolyhedron(const Polyhedron& poly, const Color& color, bool depthTest = true);
  22. /// Add a sphere.
  23. void AddSphere(const Sphere& sphere, const Color& color, bool depthTest = true);
  24. /// Add a skeleton.
  25. void AddSkeleton(const Skeleton& skeleton, const Color& color, bool depthTest = true);
  26. /// Return the view transform.
  27. const Matrix3x4& GetView() const { return view_; }
  28. /// Return the projection transform.
  29. const Matrix4& GetProjection() const { return projection_; }
  30. /// Return the view frustum.
  31. const Frustum& GetFrustum() const { return frustum_; }
  32. /// Check whether a bounding box is inside the view frustum.
  33. bool IsInside(const BoundingBox& box) const;
  34. };