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 <drawstuff/drawstuff.h>
14 #include <ode/ode.h>
15 #include <map>
16 #include <vector>
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  DisplayOpenDESpaces(void)
29  {
30  m_activeColor.r = m_activeColor.g = m_activeColor.b = 0.5;
31  }
32 
33  void drawGeom(dGeomID g, const dReal *pos, const dReal *R, int show_aabb);
34 
35  void displaySpace(dSpaceID space);
36  void displaySpaces(void);
37 
38  void addSpace(dSpaceID space, float r = 0.75, float g = 0.75, float b = 0.75);
39  void clear(void);
40 
41  void setGeomColor(dGeomID geom, float r, float g, float b);
42 
43 protected:
44  struct Color
45  {
46  float r, g, b;
47  };
48 
49  std::vector<dSpaceID> m_spaces;
50  std::vector<Color> m_colors;
51  std::map<dGeomID, Color> m_gcolors;
52 
53  Color m_activeColor;
54 };