Main MRPT website > C++ reference for MRPT 1.5.7
CCamera.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 #include "opengl-precomp.h" // Precompiled header
11 
12 #include <mrpt/opengl/CCamera.h>
13 #include <mrpt/utils/CStream.h>
14 
15 #include "opengl_internals.h"
16 
17 using namespace mrpt;
18 using namespace mrpt::opengl;
19 using namespace mrpt::utils;
20 using namespace mrpt::math;
21 using namespace std;
22 
24 
25 
26 /*--------------------------------------------------------------
27  CCamera
28  ---------------------------------------------------------------*/
30  m_pointingX(0),m_pointingY(0),m_pointingZ(0),
31  m_distanceZoom(10),
32  m_azimuthDeg(45),m_elevationDeg(45),
33  m_projectiveModel(true),
34  m_projectiveFOVdeg(30),
35  m_6DOFMode(false)
36 {
37 }
38 
39 /*---------------------------------------------------------------
40  Implements the writing to a CStream capability of
41  CSerializable objects
42  ---------------------------------------------------------------*/
44 {
45  if (version)
46  *version = 1;
47  else
48  {
49  // Save data:
50  out << m_pointingX << m_pointingY << m_pointingZ
51  << m_distanceZoom
52  << m_azimuthDeg << m_elevationDeg
53  << m_projectiveModel << m_projectiveFOVdeg;
54  }
55 }
56 
57 /*---------------------------------------------------------------
58  Implements the reading from a CStream capability of
59  CSerializable objects
60  ---------------------------------------------------------------*/
62 {
63  switch(version)
64  {
65  case 1:
66  {
67  // Load data:
68  in >> m_pointingX >> m_pointingY >> m_pointingZ
69  >> m_distanceZoom
70  >> m_azimuthDeg >> m_elevationDeg
71  >> m_projectiveModel >> m_projectiveFOVdeg;
72  }
73  break;
74  case 0:
75  {
76  in >> m_pointingX >> m_pointingY >> m_pointingZ
77  >> m_distanceZoom
78  >> m_azimuthDeg >> m_elevationDeg;
79  } break;
80  default:
82 
83  };
84 }
85 
86 
87 /** In this class, returns a fixed box (max,max,max), (-max,-max,-max). */
89 {
90  bb_min = mrpt::math::TPoint3D(std::numeric_limits<double>::max(),std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
91  bb_max = mrpt::math::TPoint3D(-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max(),-std::numeric_limits<double>::max());
92 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
The base class of 3D objects that can be directly rendered through OpenGL.
Definition: CRenderizable.h:44
STL namespace.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Definition: CCamera.cpp:61
int version
Definition: mrpt_jpeglib.h:898
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
In this class, returns a fixed box (max,max,max), (-max,-max,-max).
Definition: CCamera.cpp:88
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLuint in
Definition: glext.h:6301
The namespace for 3D scene representation and rendering.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
Definition: CCamera.cpp:43
Lightweight 3D point.
A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camer...
Definition: CCamera.h:31



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019