enum IndicatorShapeType
{
IndicatorShapeSphere,
IndicatorShapeCylinder,
};
struct IndicatorShape
{
IndicatorShape() {}
IndicatorShape(IndicatorShapeType _Type, const Vec3f &Pos0, const Vec3f &Pos1, float _Radius, RGBColor _Color)
{
Type = _Type;
Pos[0] = Pos0;
Pos[1] = Pos1;
Color = _Color;
Radius = _Radius;
}
static IndicatorShape Sphere(const Vec3f &Pos, float Radius, RGBColor Color);
static IndicatorShape Cylinder(const Vec3f &P0, const Vec3f &P1, float Radius, RGBColor Color);
Matrix4 TransformMatrix() const;
IndicatorShapeType Type;
Vec3f Pos[2];
RGBColor Color;
float Radius;
};
class Indicator
{
public:
void Init(GraphicsDevice &GD, int SphereRefinement, int Stacks, int Slices);
void RenderCylinder(GraphicsDevice &GD, MatrixController &MC, float Radius, const Vec3f &P1, const Vec3f &P2,
const RGBColor &Color, bool RenderArrow = false, bool ColorNormals = false);
void RenderBox(GraphicsDevice &GD, MatrixController &MC, float Radius, const Rectangle3f &Rect, RGBColor Color);
void RenderArrow(GraphicsDevice &GD, MatrixController &MC, const Vec3f &P1, const Vec3f &P2, const RGBColor &Color, bool ColorNormals = false);
void RenderSphere(GraphicsDevice &GD, MatrixController &MC, float Radius, const Vec3f &P1, const RGBColor &Color);
void GetCameraLine(const Matrix4 &Projection, const Camera &C, float x, float y, Vec3f &P1Out, Vec3f &P2Out);
void DrawCameraLine(GraphicsDevice &GD, MatrixController &MC, const Matrix4 &Projection, float Radius, const RGBColor &Color, const Camera &C, float x, float y);
void DrawCamera(GraphicsDevice &GD, MatrixController &MC, const Matrix4 &Perspective, float Radius, float Length, const Camera &C);
void CreateMesh(const Vector<IndicatorShape> &Shapes, BaseMesh &MOut) const;
private:
RGBColor _CylinderColor;
Mesh _Cylinder, _ArrowHead, _Sphere, _Lozenge, _Box;
};