Klamp't  0.8.1
WorldGUI.h
1 #ifndef INTERFACE_WORLD_VIEW_GUI_H
2 #define INTERFACE_WORLD_VIEW_GUI_H
3 
4 #include "Modeling/World.h"
5 #include "NavigationGUI.h"
6 #include <KrisLibrary/math3d/Ray3D.h>
7 using namespace Math3D;
8 
22 {
23 public:
25  virtual ~WorldGUIBackend();
26 
27  bool LoadCommandLine(int argc,const char** argv);
28  bool LoadFile(const char* fn);
29  bool ReloadFile(const char* fn);
30  bool SaveWorld(const char* fn,const char* elementPath=NULL);
31  //backend overloads
32  virtual void Start();
33  virtual bool OnIdle();
34  virtual bool OnCommand(const string& cmd,const string& args);
35  //GLNavigationBackend overloads
36  virtual void SetWorldLights() { world->SetGLLights(); }
37  Robot* ClickRobot(int x,int y,int& body,Vector3& localpt) const;
38  Robot* ClickRobot(const Ray3D& r,int& body,Vector3& localpt) const;
39  RigidObject* ClickObject(int x,int y,Vector3& localpt) const;
40  RigidObject* ClickObject(const Ray3D& r,Vector3& localpt) const;
41  virtual void RefreshIdle() { SendPauseIdle(0); }
42  virtual void RenderWorld();
43 
44  virtual void DoFreeDrag(int dx,int dy,int button)
45  {
46  if(button == 0) DragRotate(dx,dy);
47  }
48 
49  virtual void DoCtrlDrag(int dx,int dy,int button)
50  {
51  if(button == 0) DragPan(dx,dy);
52  }
53 
54  virtual void DoAltDrag(int dx,int dy,int button)
55  {
56  if(button == 0) DragZoom(dx,dy);
57  }
58 
59  virtual void DoShiftDrag(int dx,int dy,int button)
60  {
61  if(button == 0) { camera.dist *= (1 + 0.01*Real(dy)); SendRefresh(); }
62  }
63 
64  virtual bool OnMouseWheel(int dwheel);
65 
66  RobotWorld* world;
67 };
68 
69 
70 
71 #endif
The main robot type used in RobotSim.
Definition: Robot.h:79
The main world class containing multiple robots, objects, and static geometries (terrains). Lights and other viewport information may also be stored here.
Definition: World.h:20
A generic gui with a RobotWorld which allows clicking on entities and loading files.
Definition: WorldGUI.h:21
virtual void DoCtrlDrag(int dx, int dy, int button)
Overload this for control-dragging.
Definition: WorldGUI.h:49
virtual void DoAltDrag(int dx, int dy, int button)
Overload this for alt-dragging.
Definition: WorldGUI.h:54
A (static) rigid object that may be manipulated.
Definition: RigidObject.h:13
virtual void DoFreeDrag(int dx, int dy, int button)
Overload this for regular (non-modified) dragging.
Definition: WorldGUI.h:44
A backend that manages a camera and performs OpenGL scene management.
Definition: NavigationGUI.h:49
virtual void DoShiftDrag(int dx, int dy, int button)
Overload this for shift-dragging.
Definition: WorldGUI.h:59