Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Vertex2D.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_GEOMETRY_VERTEX2D_H_
21 #define OMNI_GEOMETRY_VERTEX2D_H_
22 
23 #include <QVector2D>
24 
25 namespace omni {
26  namespace geometry {
27  /// A Warp vertex is a geometry entity with a position, normal and texture
28  // coordinates
29  struct Vertex2D {
30  /// Default constructor
31  Vertex2D();
32 
33  /// Construct with position and texture coordinates
34  Vertex2D(
35  const QVector2D& _pos,
36  const QVector2D& _texCoord);
37 
38  /// Set new position
39  void setPos(QVector2D const& _pos);
40 
41  /// Return reference to position
42  QVector2D & pos();
43 
44  /// Return const reference to position
45  QVector2D const& pos() const;
46 
47  /// Set new texture coordinates
48  void setTexCoord(QVector2D const& _texCoord);
49 
50  /// Return reference to texture coordinates
51  QVector2D & texCoord();
52 
53  /// Return const reference to texture coordinates
54  QVector2D const& texCoord() const;
55 
56  inline static constexpr size_t texCoordOffset()
57  {
58  return 0;
59  }
60 
61  inline static constexpr size_t posOffset()
62  {
63  return sizeof(QVector2D);
64  }
65 
66  private:
67  QVector2D texCoord_;
68  QVector2D pos_;
69  };
70  }
71  using geometry::Vertex2D;
72 }
73 
74 #endif /* OMNI_GEOMETRY_VERTEX2D_H_ */
QVector2D texCoord_
Definition: Vertex2D.h:67
QVector2D & pos()
Return reference to position.
Definition: Vertex2D.cpp:37
QVector2D & texCoord()
Return reference to texture coordinates.
Definition: Vertex2D.cpp:49
void setPos(QVector2D const &_pos)
Set new position.
Definition: Vertex2D.cpp:33
A Warp vertex is a geometry entity with a position, normal and texture.
Definition: Vertex2D.h:29
static constexpr size_t posOffset()
Definition: Vertex2D.h:61
void setTexCoord(QVector2D const &_texCoord)
Set new texture coordinates.
Definition: Vertex2D.cpp:45
QVector2D pos_
Definition: Vertex2D.h:68
static constexpr size_t texCoordOffset()
Definition: Vertex2D.h:56
Vertex2D()
Default constructor.
Definition: Vertex2D.cpp:24