TrueReality  v0.1.1912
Vec4f.cpp
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #include <trBase/Vec4f.h>
23 
24 #include <trBase/Vec4d.h>
25 
26 #include <osg/Vec4d>
27 
28 // Specialize Vec4Impl to be Vec4f
29 #define Vec4Impl Vec4f
30 
31 namespace trBase
32 {
34  Vec4f::Vec4f(const osg::Vec4d &v)
35  : mVec(static_cast<double>(v.x()), static_cast<double>(v.y()), static_cast<double>(v.z()), static_cast<double>(v.w()))
36  {
37  }
38 
40  void Vec4f::operator = (const Vec4d& v)
41  {
42  mVec[0] = static_cast<double>(v.X()); mVec[1] = static_cast<double>(v.Y()); mVec[2] = static_cast<double>(v.Z()); mVec[2] = static_cast<double>(v.W());
43  }
44 }
45 
46 // Now compile up Vector via Vec4Impl
47 #include "Vec4Impl.cpp"
value_type & Z()
Returns the Z component of the vector.
void operator=(const Vec4f &v)
Set operator.
Vec4f()
Default constructor.
General purpose 3D double Vector.
Definition: Vec4d.h:47
value_type & W()
Returns the W component of the vector.
osg::Vec4f mVec
Definition: Vec4f.h:359
value_type & X()
Returns the X component of the vector.
value_type & Y()
Returns the Y component of the vector.