Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ViewConfig.h
Go to the documentation of this file.
1 /*
2 
3 License
4 
5 Menge
6 Copyright © and trademark ™ 2012-14 University of North Carolina at Chapel Hill.
7 All rights reserved.
8 
9 Permission to use, copy, modify, and distribute this software and its documentation
10 for educational, research, and non-profit purposes, without fee, and without a
11 written agreement is hereby granted, provided that the above copyright notice,
12 this paragraph, and the following four paragraphs appear in all copies.
13 
14 This software program and documentation are copyrighted by the University of North
15 Carolina at Chapel Hill. The software program and documentation are supplied "as is,"
16 without any accompanying services from the University of North Carolina at Chapel
17 Hill or the authors. The University of North Carolina at Chapel Hill and the
18 authors do not warrant that the operation of the program will be uninterrupted
19 or error-free. The end-user understands that the program was developed for research
20 purposes and is advised not to rely exclusively on the program for any reason.
21 
22 IN NO EVENT SHALL THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE AUTHORS
23 BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
24 DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
25 DOCUMENTATION, EVEN IF THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL OR THE
26 AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS SPECIFICALLY
29 DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
30 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY STATUTORY WARRANTY
31 OF NON-INFRINGEMENT. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
32 THE UNIVERSITY OF NORTH CAROLINA AT CHAPEL HILL AND THE AUTHORS HAVE NO OBLIGATIONS
33 TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
34 
35 Any questions or comments should be sent to the authors {menge,geom}@cs.unc.edu
36 
37 */
38 
44 #ifndef __VIEW_CONFIG_H__
45 #define __VIEW_CONFIG_H__
46 
47 #include <string>
48 #include <vector>
49 #include "CoreConfig.h"
50 #include "GLCamera.h"
51 #include "GLLight.h"
52 #include "Logger.h"
53 
54 namespace Menge {
55 
56  namespace Vis {
57 
58  // forward declarations
59  class Watermark;
60 
64  class CameraParam {
65  public:
70  _posX = _posY = _tgtX = _tgtY = _tgtZ = 0.0f;
71  _posZ = 10.f;
72  _farPlane = 200.f;
73  _nearPlane = 0.01f;
74  _orthoScale = 1.f;
75  _fov = 0.f;
76  _projType = SceneGraph::GLCamera::ORTHO;
77  }
78 
82  float _posX;
83 
87  float _posY;
88 
92  float _posZ;
93 
97  float _tgtX;
98 
102  float _tgtY;
103 
107  float _tgtZ;
108 
112  float _farPlane;
113 
117  float _nearPlane;
118 
122  float _orthoScale;
123 
127  float _fov;
128 
135  };
136 
138 
142  class LightParam {
143  public:
148  _r = _g = _b = 1.f;
149  _x = _y = _z = 1.f;
150  _w = 0.f; // 0 --> directional, 1 --> point
151  }
152 
156  float _r;
157 
161  float _g;
162 
166  float _b;
167 
171  float _a;
172 
176  float _x;
177 
181  float _y;
182 
186  float _z;
187 
192  float _w;
193 
198  };
199 
201 
207  class MENGE_API ViewConfig {
208  public:
212  ViewConfig();
213 
217  ~ViewConfig();
218 
225  bool readXML( const std::string & fileName );
226 
230  void setDefaults();
231 
238  void setCamera( SceneGraph::GLCamera & camera, size_t i=0 ) const;
239 
246  void setCameras( std::vector< SceneGraph::GLCamera > & cameras ) const;
247 
254  void setLight( SceneGraph::GLLight & light, size_t i=0 ) const;
255 
262  void setLights( std::vector< SceneGraph::GLLight > & lights ) const;
263 
267  std::string _viewFldr;
268 
272  int _width;
273 
277  int _height;
278 
282  std::string _bgImg;
283 
288 
292  std::string _fontName;
293 
297  float _fontColor[4];
298 
302  std::vector< CameraParam > _camSpecs;
303 
307  std::vector< LightParam > _lightSpecs;
308  };
309  } // namespace Vis
310 
318  MENGE_API Logger & operator<< ( Logger & out, const Vis::ViewConfig & cfg );
319 } // namespace Menge
320 
321 #endif // __VIEW_CONFIG_H__
Watermark * _waterMark
The optional watermark.
Definition: ViewConfig.h:287
float _g
The green channel of the light's diffuse color.
Definition: ViewConfig.h:161
float _r
The red channel of the light's diffuse color.
Definition: ViewConfig.h:156
float _posX
Camera x-position in world space.
Definition: ViewConfig.h:82
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
CamEnum
Determines the projection matrix of the 3D camera.
Definition: GLCamera.h:62
Logger & operator<<(Logger &out, const BFSM::PropertyOperand op)
Friend function for printing string versions of the PropertyOperand enum.
Definition: FSMEnumeration.cpp:43
A simple light for defining OpenGL lighting properties.
Sets up the proper compiler directives for platform and dll export/import.
float _nearPlane
Distance to camera's near plane.
Definition: ViewConfig.h:117
A set of parameters specifying a single camera.
Definition: ViewConfig.h:64
float _posY
Camera y-position in world space.
Definition: ViewConfig.h:87
SceneGraph::GLLight::LightSpace _space
The space in which the light lives.
Definition: ViewConfig.h:197
A set of parameters specifying a single light.
Definition: ViewConfig.h:142
The namespace containing visualization functionality for the pedestrian simulation.
Definition: GLViewer.h:64
int _height
Height of viewport (in pixels).
Definition: ViewConfig.h:277
float _w
The w-value of the light position. Determines if the light Is a point or directional light...
Definition: ViewConfig.h:192
float _tgtZ
Camera's target z-position in world space.
Definition: ViewConfig.h:107
float _z
The z-value of the light position.
Definition: ViewConfig.h:186
An html logger - writes messages to a formatted html file.
Definition: Logger.h:59
SceneGraph::GLCamera::CamEnum _projType
The camera's projection type (perspective or orthographic).
Definition: ViewConfig.h:134
LightSpace
Defines the space of the camera: world or camera.
Definition: GLLight.h:66
LightParam()
Default constructor.
Definition: ViewConfig.h:147
float _tgtX
Camera's target x-position in world space.
Definition: ViewConfig.h:97
The OpenGL light class. Defines a light for the basic OpenGL pipeline.
Definition: GLLight.h:58
float _x
The x-value of the light position.
Definition: ViewConfig.h:176
The specificaiton of a message logger for menge, such that all messages to the system get properly re...
std::string _fontName
Font name.
Definition: ViewConfig.h:292
float _tgtY
Camera's target y-position in world space.
Definition: ViewConfig.h:102
CameraParam()
Default constructor.
Definition: ViewConfig.h:69
float _orthoScale
The "scale" factor applid to the camera in orthographic view.
Definition: ViewConfig.h:122
float _farPlane
Distance to camera's far plane.
Definition: ViewConfig.h:112
The class for controlling the view camera: it's position, orientation field of view, projection matrix, etc.
Definition: GLCamera.h:57
float _b
The blue channel of the light's diffuse color.
Definition: ViewConfig.h:166
std::string _viewFldr
The folder the view configuration file is located in.
Definition: ViewConfig.h:267
The specification of an OpenGL GLViewer for a scene.
Definition: ViewConfig.h:207
A class for handling the watermark functionality.
Definition: Watermark.h:74
std::vector< LightParam > _lightSpecs
The set of cameras for the configuration.
Definition: ViewConfig.h:307
std::vector< CameraParam > _camSpecs
The set of cameras for the configuration.
Definition: ViewConfig.h:302
float _y
The y-value of the light position.
Definition: ViewConfig.h:181
int _width
Width of viewport (in pixels).
Definition: ViewConfig.h:272
float _posZ
Camera z-position in world space.
Definition: ViewConfig.h:92
Class to handle camera transformations in OpenGL.
float _fov
The camera's horizontal field of view (in degrees).
Definition: ViewConfig.h:127
std::string _bgImg
The name of the background image to use.
Definition: ViewConfig.h:282
float _a
The alpha channel of the lights' diffuse color.
Definition: ViewConfig.h:171