Main MRPT website > C++ reference for MRPT 1.9.9
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  CCamera
27  ---------------------------------------------------------------*/
29  : m_pointingX(0),
30  m_pointingY(0),
31  m_pointingZ(0),
32  m_distanceZoom(10),
33  m_azimuthDeg(45),
34  m_elevationDeg(45),
35  m_projectiveModel(true),
36  m_projectiveFOVdeg(30),
37  m_6DOFMode(false)
38 {
39 }
40 
41 /*---------------------------------------------------------------
42  Implements the writing to a CStream capability of
43  CSerializable objects
44  ---------------------------------------------------------------*/
45 void CCamera::writeToStream(mrpt::utils::CStream& out, int* version) const
46 {
47  if (version)
48  *version = 1;
49  else
50  {
51  // Save data:
52  out << m_pointingX << m_pointingY << m_pointingZ << m_distanceZoom
53  << m_azimuthDeg << m_elevationDeg << m_projectiveModel
54  << m_projectiveFOVdeg;
55  }
56 }
57 
58 /*---------------------------------------------------------------
59  Implements the reading from a CStream capability of
60  CSerializable objects
61  ---------------------------------------------------------------*/
63 {
64  switch (version)
65  {
66  case 1:
67  {
68  // Load data:
69  in >> m_pointingX >> m_pointingY >> m_pointingZ >> m_distanceZoom >>
70  m_azimuthDeg >> m_elevationDeg >> m_projectiveModel >>
71  m_projectiveFOVdeg;
72  }
73  break;
74  case 0:
75  {
76  in >> m_pointingX >> m_pointingY >> m_pointingZ >> m_distanceZoom >>
77  m_azimuthDeg >> m_elevationDeg;
78  }
79  break;
80  default:
82  };
83 }
84 
85 /** In this class, returns a fixed box (max,max,max), (-max,-max,-max). */
87  mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const
88 {
89  bb_min = mrpt::math::TPoint3D(
90  std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
91  std::numeric_limits<double>::max());
92  bb_max = mrpt::math::TPoint3D(
93  -std::numeric_limits<double>::max(),
94  -std::numeric_limits<double>::max(),
95  -std::numeric_limits<double>::max());
96 }
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
#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:43
STL namespace.
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
In this class, returns a fixed box (max,max,max), (-max,-max,-max).
Definition: CCamera.cpp:86
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
Definition: CCamera.cpp:45
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
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.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLuint in
Definition: glext.h:7274
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Definition: CCamera.cpp:62
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:30



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019