-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBulletDebugDrawer.h
71 lines (61 loc) · 2.04 KB
/
BulletDebugDrawer.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include <GL/glew.h>
#include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp>
#include "ShaderProgram.h"
#include "Line.h"
#include "Helper.h"
class BulletDebugDrawer_DeprecatedOpenGL : public btIDebugDraw{
public:
int m;
void SetMatrices(glm::mat4 pViewMatrix, glm::mat4 pProjectionMatrix)
{
glUseProgram(0); // Use Fixed-function pipeline (no shaders)
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(&pViewMatrix[0][0]);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(&pProjectionMatrix[0][0]);
}
virtual void drawLine(const btVector3& from,const btVector3& to,const btVector3& color)
{
glColor3f(color.x(), color.y(), color.z());
glBegin(GL_LINES);
glVertex3f(from.x(), from.y(), from.z());
glVertex3f(to.x(), to.y(), to.z());
glEnd();
}
virtual void drawContactPoint(const btVector3 &,const btVector3 &,btScalar,int,const btVector3 &){}
virtual void reportErrorWarning(const char *){}
virtual void draw3dText(const btVector3 &,const char *){}
virtual void setDebugMode(int p){ m = p;}
int getDebugMode(void) const {return 3;}
};
//class BulletDebugDrawer : public btIDebugDraw {
//
//public:
//
// int m;
// ShaderProgram *debugdrawShaderProgram;
// Line *l;
//
// void SetMatrices(glm::mat4 pViewMatrix, glm::mat4 pProjectionMatrix)
// {
// glm::mat4 mvpMatrix = pProjectionMatrix * pViewMatrix;
// debugdrawShaderProgram->SetUniform("uMVPMatrix", mvpMatrix);
// }
//
// virtual void drawLine(const btVector3& from, const btVector3& to, const btVector3& color)
// {
// debugdrawShaderProgram->SetUniform("uColor", glm::vec4(color.getX(), color.getY(), color.getZ(), 1));
// l->Update(glm::vec3(from.getX(), from.getY(), from.getZ()), glm::vec3(to.getX(), to.getY(), to.getZ()));
// l->Render();
// }
//
// virtual void drawContactPoint(const btVector3 &, const btVector3 &, btScalar, int, const btVector3 &) {}
// virtual void reportErrorWarning(const char *) {}
// virtual void draw3dText(const btVector3 &, const char *) {}
//
// virtual void setDebugMode(int p) { m = p; }
// int getDebugMode(void) const { return 3; }
//
//};