PlaneProjection.cpp
Go to the documentation of this file.
1 // (C) Copyright Renaud Detry 2007-2015.
2 // Distributed under the GNU General Public License and under the
3 // BSD 3-Clause License (See accompanying file LICENSE.txt).
4 
5 /** @file */
6 
8 #include <nuklei/Color.h>
9 
10 
11 namespace nuklei
12 {
13  const NUKLEI_UNIQUE_PTR<Color> PlaneProjection::getColor() const
14  {
15  return NUKLEI_UNIQUE_PTR<Color>(new RGBColor(color_[0]/255.,
16  color_[1]/255.,
17  color_[2]/255.));
18  }
19 
20  void PlaneProjection::setColor(const Color& c)
21  {
22  RGBColor rgb(c);
23  color_[0] = rgb.R()*255;
24  color_[1] = rgb.G()*255;
25  color_[2] = rgb.B()*255;
26  }
27 
28  Vector3 PlaneProjection::getCamPosition() const
29  {
30  Vector3 v;
31  for (int i = 0; i < 3; ++i) v[i] = translationVectorData_.at(i);
32  return v;
33  }
34 
35  Quaternion PlaneProjection::getCamOrientation() const
36  {
37  Matrix3 m;
38  for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j)
39  m(i,j) = rotationMatrixData_.at(3*i+j);
40  m = la::normalized(m);
41  return la::quaternionCopy(m);
42  }
43 
44  const NUKLEI_UNIQUE_PTR<Color> StereoPlaneProjection::getColor() const
45  {
46  return NUKLEI_UNIQUE_PTR<Color>(new RGBColor(color_[0]/255.,
47  color_[1]/255.,
48  color_[2]/255.));
49  }
50 
51  void StereoPlaneProjection::setColor(const Color& c)
52  {
53  RGBColor rgb(c);
54  color_[0] = rgb.R()*255;
55  color_[1] = rgb.G()*255;
56  color_[2] = rgb.B()*255;
57  left_.setColor(c);
58  right_.setColor(c);
59  }
60 
61 
62 }
Public namespace.
Definition: Color.cpp:9
© Copyright 2007-2013 Renaud Detry.
Distributed under the terms of the GNU General Public License (GPL).
(See accompanying file LICENSE.txt or copy at http://www.gnu.org/copyleft/gpl.html.)
Revised Sun Sep 13 2020 19:10:06.