-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmyobj.h
More file actions
72 lines (59 loc) · 1.56 KB
/
myobj.h
File metadata and controls
72 lines (59 loc) · 1.56 KB
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
72
#ifndef __MYOBJ_H__
#define __MYOBJ_H__
#include "error.h"
#include <ode/ode.h>
class MyObject;
typedef MyObject *MyObjectID;
// this is also a linked list
class MyObject {
protected:
dWorldID world;
dSpaceID space;
int drawFlag;
public:
int show_forces; // whether Draw displays force vectors
MyObjectID next;
dGeomID *geom;
dBodyID *body;
dJointID *joint;
int g_num;
int b_num;
int j_num;
int camera_ind; // index to body LookHere uses
void Display();
MyObject(dWorldID n_world, dSpaceID n_space, int b_num =
0, int j_num = 0, int g_num = 0);
void Init(int b_num = 0, int j_num = 0, int g_num = 0);
void Merge(MyObjectID b, int reallocate = 0);
virtual void setDrawFlag(int flag) { drawFlag = flag;};
virtual int getDrawFlag() { return drawFlag;};
void toggleDrawFlag() { setDrawFlag(1-getDrawFlag()); }
virtual void Draw(); // draw geom[*] using mydraw drawGeom
void DrawChain(); // draw this and next if not null
void LookHere(); // aimCamera(body[camera_body])
void SetCameraBody(int num) {
camera_ind = num;
CONSTRAIN_INT(camera_ind, 0, b_num);
};
void ZeroUserData(); // for all_bodies dBodySetData(body[i],0)
void DestroyContents();
virtual ~ MyObject(); // doesn't destroy the contents = dGeomDestroy, dBodyDestroy, dJointDestroy
};
// a linked list of MyObject
class MyContainer {
public:
MyObjectID first;
MyContainer() {
first = 0;
};
void Add(MyObjectID obj) {
if (!first) {
first = obj;
} else {
obj->next = first;
first = obj;
}
}
};
typedef MyContainer *MyContainerID;
#endif // __MYOBJ_H__