displayOpenDE.h
1 /*********************************************************************
2 * Rice University Software Distribution License
3 *
4 * Copyright (c) 2010, Rice University
5 * All Rights Reserved.
6 *
7 * For a full description see the file named LICENSE.
8 *
9 *********************************************************************/
10 
11 /* Author: Ioan Sucan */
12 
13 #include <ode/ode.h>
14 #include <drawstuff/drawstuff.h>
15 #include <vector>
16 #include <map>
17 
18 #ifdef __APPLE__
19 #include <OpenGL/gl.h>
20 #else
21 #include <GL/gl.h>
22 #endif
23 
25 class DisplayOpenDESpaces
26 {
27 public:
28 
29  DisplayOpenDESpaces(void)
30  {
31  m_activeColor.r = m_activeColor.g = m_activeColor.b = 0.5;
32  }
33 
34  void drawGeom (dGeomID g, const dReal *pos, const dReal *R, int show_aabb);
35 
36  void displaySpace(dSpaceID space);
37  void displaySpaces(void);
38 
39  void addSpace(dSpaceID space, float r = 0.75, float g = 0.75, float b = 0.75);
40  void clear(void);
41 
42  void setGeomColor(dGeomID geom, float r, float g, float b);
43 
44 protected:
45 
46  struct Color
47  {
48  float r, g, b;
49  };
50 
51  std::vector<dSpaceID> m_spaces;
52  std::vector<Color> m_colors;
53  std::map<dGeomID, Color> m_gcolors;
54 
55  Color m_activeColor;
56 };