SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
SGraphicsChai.hpp
1 /* This file is part of scl, a control and simulation library
2 for robots and biomechanical models.
3 
4 scl is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8 
9 Alternatively, you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of
12 the License, or (at your option) any later version.
13 
14 scl is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License and a copy of the GNU General Public License along with
21 scl. If not, see <http://www.gnu.org/licenses/>.
22 */
23 /* \file SGraphicsChai.hpp
24  *
25  * Created on: Aug 6, 2010
26  *
27  * Copyright (C) 2010
28  *
29  * Author: Samir Menon <smenon@stanford.edu>
30  */
31 #ifndef SGRAPHICSCHAI_HPP_
32 #define SGRAPHICSCHAI_HPP_
33 
34 #include <scl/DataTypes.hpp>
35 #include <scl/data_structs/SObject.hpp>
36 #include <scl/data_structs/SRobotIO.hpp>
37 #include <scl/graphics/chai/data_structs/SGraphicsChaiRigidBody.hpp>
38 #include <scl/graphics/chai/data_structs/SGraphicsChaiMuscleSet.hpp>
39 
40 #include <sutil/CMappedList.hpp>
41 #include <sutil/CMappedTree.hpp>
42 
47 namespace chai3d
48 {
49 class cWorld;
50 class cCamera;
51 class cGenericObject;
52 class cMesh;
53 struct cVector3d;
54 }
55 
56 namespace scl
57 {
58 
62 {
63 public:
65  const SRobotIO *io_;
66 };
67 
74 class SGraphicsChai : public SObject
75 {
76 public:
81  chai3d::cWorld* chai_world_;
82 
84  chai3d::cCamera* chai_cam_;
85 
88 
91 
94 
96  bool mouse_mode_cam_; //manipulate the camera or forces
97 
98  sFloat gl_width_, gl_height_;
99  bool mouse_button_pressed_;
100  sInt mouse_x_, mouse_y_, mouse_button_;
101 
102  scl::sFloat mouse_grab_mag_; //magnitude
103  Eigen::Vector3d mouse_grab_pos_;
104  chai3d::cGenericObject* mouse_grab_obj_;
105 
108 
110  SGraphicsChai() : SObject(std::string("SGraphicsChai"))
111  {
112  chai_cam_ = S_NULL;
113  chai_world_ = S_NULL;
114  has_been_init_ = false;
115  //DEFAULTS
116  gl_width_ = 1080;
117  gl_height_ = 800;
118  running_ = false;
119 
120  //Mouse defaults
121  mouse_mode_cam_ = true;
122  mouse_button_pressed_ = false;
123  mouse_x_ = 0;
124  mouse_y_ = 0;
125  mouse_button_ = 0;
126 
127  //For drag and click
128  mouse_grab_mag_ = 0.0;
129  mouse_grab_pos_ = Eigen::Vector3d::Zero();
130  mouse_grab_obj_ = NULL;
131  }
132 };
133 
134 }
135 
136 #endif
sFloat running_
Definition: SGraphicsChai.hpp:107
Definition: SRobotIO.hpp:107
Definition: CMappedList.hpp:85
sutil::CMappedList< std::string, SRobotRenderObj > robots_rendered_
Definition: SGraphicsChai.hpp:87
Definition: SGraphicsChai.hpp:74
chai3d::cCamera * chai_cam_
Definition: SGraphicsChai.hpp:84
sBool has_been_init_
Definition: SObject.hpp:72
sutil::CMappedList< std::string, SGraphicsChaiMuscleSet > muscles_rendered_
Definition: SGraphicsChai.hpp:93
bool mouse_mode_cam_
Definition: SGraphicsChai.hpp:96
Definition: CMappedTree.hpp:66
sutil::CMappedList< std::string, SGraphicsChaiMesh > meshes_rendered_
Definition: SGraphicsChai.hpp:90
chai3d::cWorld * chai_world_
Definition: SGraphicsChai.hpp:81
SGraphicsChai()
Definition: SGraphicsChai.hpp:110
double sFloat
Definition: DataTypes.hpp:72
Definition: SGraphicsChai.hpp:61
int sInt
Definition: DataTypes.hpp:64
Definition: SObject.hpp:43