-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPhysicsDebugDraw.h
55 lines (42 loc) · 2 KB
/
PhysicsDebugDraw.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// +------------------------------------------------------------+
// | University Racer |
// | Projekt do PGR a GMU, FIT VUT v Brne, 2011 |
// +------------------------------------------------------------+
// | Autori: Tomáš Kimer, [email protected] |
// | Tomáš Sychra, [email protected] |
// | David Šabata, [email protected] |
// +------------------------------------------------------------+
#ifndef PHYSICSDEBUGDRAW_H
#define PHYSICSDEBUGDRAW_H
#include <iostream>
#include <vector>
#include <glm/gtc/type_ptr.hpp>
#include <btBulletDynamicsCommon.h>
/**
* Pomocna trida pro debug vykresleni koliznich teles pouzitych v simulaci; kresleni pouze pomoci car.
*/
class PhysicsDebugDraw : public btIDebugDraw
{
public:
struct LINE {
LINE(glm::vec3 a, glm::vec3 b, glm::vec3 color) : a(a), b(b), color(color) {};
glm::vec3 a;
glm::vec3 b;
glm::vec3 color;
};
PhysicsDebugDraw(void): m_debugMode(1) {}
~PhysicsDebugDraw(void) {}
virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color);
virtual void drawContactPoint(const btVector3& PointOnB, const btVector3& normalOnB, btScalar distance, int lifeTime, const btVector3& color) {}
virtual void drawTriangle(const btVector3 & a, const btVector3 & b, const btVector3 & c, const btVector3 & color, btScalar alpha) {}
void reportErrorWarning(const char * warningString) { std::cout << "Physics debugger warning: " << warningString << std::endl; }
virtual void draw3dText(const btVector3& location,const char* textString) {}
virtual void setDebugMode(int debugMode) { m_debugMode = debugMode; }
virtual int getDebugMode() const { return m_debugMode; }
std::vector<LINE> & GetLines() { return lines; }
private:
// pole pomocnych car k vykresleni - caru definuji dva body a barva
std::vector<LINE> lines;
int m_debugMode;
};
#endif