25 #ifndef __I6ENGINE_MODULES_DEBUG_H__
26 #define __I6ENGINE_MODULES_DEBUG_H__
30 #include "OGRE/OgreSingleton.h"
32 typedef std::pair<Ogre::Vector3, Ogre::ColourValue>
VertexPair;
34 #define DEFAULT_ICOSPHERE_RECURSION_LEVEL 1
55 return (v1 == o.
v1 && v2 == o.
v2) || (v1 == o.
v2 && v2 == o.
v1);
62 void create(
int recursionLevel);
64 int addToVertices(std::list<VertexPair> *target,
const Ogre::Vector3 & position,
const Ogre::ColourValue & colour,
float scale);
68 int addVertex(
const Ogre::Vector3 & vertex);
69 void addLineIndices(
int index0,
int index1);
70 void addTriangleLines(
int index0,
int index1,
int index2);
71 int getMiddlePoint(
int index0,
int index1);
72 void addFace(
int index0,
int index1,
int index2);
74 void removeLineIndices(
int index0,
int index1);
76 std::vector<Ogre::Vector3> vertices;
77 std::list<LineIndices> lineIndices;
78 std::list<int> triangleIndices;
79 std::list<TriangleIndices> faces;
80 std::map<long, int> middlePointIndexCache;
84 class Debug :
public Ogre::Singleton<Debug> {
86 Debug(Ogre::SceneManager * _sceneManager,
float _fillAlpha);
94 void drawLine(
const Ogre::Vector3 &start,
const Ogre::Vector3 &end,
const Ogre::ColourValue &colour);
95 void drawCircle(
const Ogre::Vector3 ¢re,
float radius,
int segmentsCount,
const Ogre::ColourValue& colour,
bool isFilled =
false);
96 void drawCylinder(
const Ogre::Vector3 ¢re,
float radius,
int segmentsCount,
float height,
const Ogre::ColourValue& colour,
bool isFilled =
false);
97 void drawQuad(
const Ogre::Vector3 *vertices,
const Ogre::ColourValue& colour,
bool isFilled =
false);
98 void drawCuboid(
const Ogre::Vector3 *vertices,
const Ogre::ColourValue& colour,
bool isFilled =
false);
99 void drawSphere(
const Ogre::Vector3 ¢re,
float radius,
const Ogre::ColourValue& colour,
bool isFilled =
false);
119 Ogre::SceneManager * sceneManager;
123 Ogre::ManualObject * manualObject;
127 std::list<VertexPair> lineVertices, triangleVertices;
128 std::list<int> lineIndices, triangleIndices;
130 int linesIndex, trianglesIndex;
135 void buildLine(
const Ogre::Vector3 & start,
const Ogre::Vector3 & end,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
136 void buildQuad(
const Ogre::Vector3 * vertices,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
137 void buildFilledQuad(
const Ogre::Vector3 * vertices,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
138 void buildFilledTriangle(
const Ogre::Vector3 *vertices,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
139 void buildCuboid(
const Ogre::Vector3 * vertices,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
140 void buildFilledCuboid(
const Ogre::Vector3 * vertices,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
142 void buildCircle(
const Ogre::Vector3 & centre,
float radius,
int segmentsCount,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
143 void buildFilledCircle(
const Ogre::Vector3 & centre,
float radius,
int segmentsCount,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
145 void buildCylinder(
const Ogre::Vector3 & centre,
float radius,
int segmentsCount,
float height,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
146 void buildFilledCylinder(
const Ogre::Vector3 & centre,
float radius,
int segmentsCount,
float height,
const Ogre::ColourValue & colour,
float alpha = 1.0f);
148 int addLineVertex(
const Ogre::Vector3 & vertex,
const Ogre::ColourValue & colour);
149 void addLineIndices(
int index1,
int index2);
151 int addTriangleVertex(
const Ogre::Vector3 & vertex,
const Ogre::ColourValue & colour);
152 void addTriangleIndices(
int index1,
int index2,
int index3);
154 void addQuadIndices(
int index1,
int index2,
int index3,
int index4);
static Debug & getSingleton(void)
void addToLineIndices(int baseIndex, std::list< int > *target)
void setEnabled(bool _isEnabled)
std::pair< Ogre::Vector3, Ogre::ColourValue > VertexPair
static Debug * getSingletonPtr(void)
LineIndices(int _v1, int _v2)
void drawCuboid(const Ogre::Vector3 *vertices, const Ogre::ColourValue &colour, bool isFilled=false)
void create(int recursionLevel)
void drawCylinder(const Ogre::Vector3 ¢re, float radius, int segmentsCount, float height, const Ogre::ColourValue &colour, bool isFilled=false)
int addToVertices(std::list< VertexPair > *target, const Ogre::Vector3 &position, const Ogre::ColourValue &colour, float scale)
Debug(Ogre::SceneManager *_sceneManager, float _fillAlpha)
void drawQuad(const Ogre::Vector3 *vertices, const Ogre::ColourValue &colour, bool isFilled=false)
void drawLine(const Ogre::Vector3 &start, const Ogre::Vector3 &end, const Ogre::ColourValue &colour)
TriangleIndices(int _v1, int _v2, int _v3)
void drawCircle(const Ogre::Vector3 ¢re, float radius, int segmentsCount, const Ogre::ColourValue &colour, bool isFilled=false)
bool operator<(const TriangleIndices &o) const
void drawSphere(const Ogre::Vector3 ¢re, float radius, const Ogre::ColourValue &colour, bool isFilled=false)
void addToTriangleIndices(int baseIndex, std::list< int > *target)
bool operator==(const LineIndices &o) const