BioinstSim  2
 All Classes Functions Variables
openglrender.h
1 #ifndef OPENGLRENDER_H_
2 #define OPENGLRENDER_H_
3 
4 /******************************************************************************/
5 /******************************************************************************/
6 
7 #include "common.h"
8 #include "simobject.h"
9 #include "render.h"
10 #include "agent.h"
11 
12 /******************************************************************************/
13 /******************************************************************************/
14 
15 #include <X11/Xlib.h>
16 #include <X11/Xatom.h>
17 #include <X11/keysym.h>
18 #include <GL/glx.h>
19 
20 
21 /******************************************************************************/
22 /******************************************************************************/
23 
24 class COpenGLRender : public CRender
25 {
26 public:
27  COpenGLRender(const char* pch_agent_color, unsigned int un_number_of_agents, unsigned int un_number_of_simulation_steps);
28  virtual ~COpenGLRender();
29 
30  virtual void SimulationStep(unsigned int un_step_number);
31  virtual void SetOutputStatistics(bool on_off);
32 
33 protected:
34  virtual void StartGraphics();
35  virtual void StopGraphics();
36  virtual void DrawFrame();
37 
38  virtual void HandleEvent (XEvent& event);
39 
40  virtual void CaptureFrame (int num);
41 
42  virtual void DrawAllAgents();
43  virtual void DrawAgent(CAgent* pc_agent, unsigned int un_agent_number);
44 
45  virtual void DrawCircle(double f_center_x, double f_center_y, double f_radius);
46  virtual void DrawSolidCircle(double f_center_x, double f_center_y, double f_radius);
47 
48  virtual void OutputStatistics(unsigned int un_step_number);
49 
50  virtual TColor3f GetColorFromIndex(unsigned int index);
51 
52 protected:
53  virtual void GenerateColors();
54 
55  double m_fCurrentFrame;
56  int m_nWindowWidth;
57  int m_nWindowHeight;
58 
59  double m_fDetailLevel;
60 
61  int m_nCurrentFileFrame;
62 
63  unsigned int m_unNumberOfAgents;
64  unsigned int m_unNumberOfPhysicalLinks;
65  unsigned int m_unMaximumNumberOfPhysicalLinks;
66 
67  bool m_bOutputStatistics;
68 
69  unsigned int m_unNumberOfRobotAgents;
70  unsigned int m_unNumberOfLightAgents;
71 
72  unsigned int m_unNumberOfColors;
73  TColor3f* m_ptColors;
74 
75  bool m_bSetAgentColorsFromFile;
76  unsigned int** m_ppunColors;
77 };
78 
79 /******************************************************************************/
80 /******************************************************************************/
81 
82 #endif