| 1234567891011121314151617181920212223242526272829303132333435 |
- $#include "DebugRenderer.h"
- /// Debug geometry rendering component. Should be added only to the root scene node.
- class DebugRenderer : public Component
- {
- public:
- /// Set the camera viewpoint. Call before rendering, or before adding geometry if you want to use culling.
- void SetView(Camera* camera);
- /// Add a line.
- void AddLine(const Vector3& start, const Vector3& end, const Color& color, bool depthTest = true);
- /// Add a line with color already converted to unsigned.
- void AddLine(const Vector3& start, const Vector3& end, unsigned color, bool depthTest = true);
- /// Add a scene node represented as its coordinate axes.
- void AddNode(Node* node, float scale = 1.0f, bool depthTest = true);
- /// Add a bounding box.
- void AddBoundingBox(const BoundingBox& box, const Color& color, bool depthTest = true);
- /// Add a bounding box with transform.
- void AddBoundingBox(const BoundingBox& box, const Matrix3x4& transform, const Color& color, bool depthTest = true);
- /// Add a frustum.
- void AddFrustum(const Frustum& frustum, const Color& color, bool depthTest = true);
- /// Add a polyhedron.
- void AddPolyhedron(const Polyhedron& poly, const Color& color, bool depthTest = true);
- /// Add a sphere.
- void AddSphere(const Sphere& sphere, const Color& color, bool depthTest = true);
- /// Add a skeleton.
- void AddSkeleton(const Skeleton& skeleton, const Color& color, bool depthTest = true);
- /// Return the view transform.
- const Matrix3x4& GetView() const { return view_; }
- /// Return the projection transform.
- const Matrix4& GetProjection() const { return projection_; }
- /// Return the view frustum.
- const Frustum& GetFrustum() const { return frustum_; }
- /// Check whether a bounding box is inside the view frustum.
- bool IsInside(const BoundingBox& box) const;
- };
|