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-2018, 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>
14 
15 #include "opengl_internals.h"
16 
17 using namespace mrpt;
18 using namespace mrpt::opengl;
19 
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 
43 {
44  // Save data:
45  out << m_pointingX << m_pointingY << m_pointingZ << m_distanceZoom
46  << m_azimuthDeg << m_elevationDeg << m_projectiveModel
47  << m_projectiveFOVdeg;
48 }
49 
51 {
52  switch (version)
53  {
54  case 1:
55  {
56  // Load data:
57  in >> m_pointingX >> m_pointingY >> m_pointingZ >> m_distanceZoom >>
58  m_azimuthDeg >> m_elevationDeg >> m_projectiveModel >>
59  m_projectiveFOVdeg;
60  }
61  break;
62  case 0:
63  {
64  in >> m_pointingX >> m_pointingY >> m_pointingZ >> m_distanceZoom >>
65  m_azimuthDeg >> m_elevationDeg;
66  }
67  break;
68  default:
70  };
71 }
72 
73 /** In this class, returns a fixed box (max,max,max), (-max,-max,-max). */
75  mrpt::math::TPoint3D& bb_min, mrpt::math::TPoint3D& bb_max) const
76 {
77  bb_min = mrpt::math::TPoint3D(
78  std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
79  std::numeric_limits<double>::max());
80  bb_max = mrpt::math::TPoint3D(
81  -std::numeric_limits<double>::max(),
82  -std::numeric_limits<double>::max(),
83  -std::numeric_limits<double>::max());
84 }
#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
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
Definition: CCamera.cpp:50
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:74
unsigned char uint8_t
Definition: rptypes.h:41
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:90
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
Definition: CCamera.cpp:41
This base provides a set of functions for maths stuff.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:48
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
Definition: CCamera.cpp:42
GLuint in
Definition: glext.h:7274
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
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: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019