Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Sphere.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_VISUAL_SPHERE_H_
21 #define OMNI_VISUAL_SPHERE_H_
22 
23 #include <omni/visual/Interface.h>
24 #include <omni/visual/VertexVBO.h>
25 
26 namespace omni
27 {
28  namespace visual
29  {
30  /// Draw Handler for visualizing a centered sphere
31  class Sphere : public Interface
32  {
33  public:
37  };
38 
39  Sphere(qreal _radius = 1.0);
40  ~Sphere();
41 
42  /// Return radius of sphere
43  qreal radius() const;
44 
45  /// Set new sphere radius
46  void setRadius(qreal);
47 
48  /// Return number of stacks (in Z direction)
49  int stacks() const;
50 
51  /// Set number of stacks
52  void setStacks(int _stacks);
53 
54  /// Return slices of sphere
55  int slices() const;
56 
57  /// Set number of slices and update mesh
58  void setSlices(int _slices);
59 
60  /// Return top position where to cut off sphere
61  float top() const;
62 
63  /// Set new top position where to cut off sphere
64  void setTop(float);
65 
66  /// Return bottom position where to cut off sphere
67  float bottom() const;
68 
69  /// Set new bottom position where to cut off sphere
70  void setBottom(float);
71 
72  /// Return tex coords mode; fisheye or equirectangular
74 
75  /// Set tex coords mode, fisheye or equirectangular
77 
78  /// Draws sphere from vertex buffer object
79  void draw() const;
80 
81  /// Regenerates the mesh and updates the vertex buffer objects
82  void update();
83 
84  private:
85  void generateStack(
86  float _top, float _bottom,
87  float _topRadius, float _bottomRadius);
88 
89  int stacks_ = 64;
90  int slices_ = 128;
91 
92  float top_ = 1.0;
93  float bottom_ = -1.0;
94 
95  qreal radius_ = 1.0;
96 
101  };
102  }
103 }
104 
105 #endif /* OMNI_VISUAL_SPHERE_H_ */
int stacks_
Definition: Sphere.h:89
TexCoordsMode texCoordsMode_
Definition: Sphere.h:100
float top_
Definition: Sphere.h:92
void setBottom(float)
Set new bottom position where to cut off sphere.
Definition: Sphere.cpp:84
float bottom_
Definition: Sphere.h:93
qreal radius() const
Return radius of sphere.
Definition: Sphere.cpp:36
float bottom() const
Return bottom position where to cut off sphere.
Definition: Sphere.cpp:79
int slices() const
Return slices of sphere.
Definition: Sphere.cpp:57
Basic visual interface.
Definition: Interface.h:28
VertexVBO::index_buffer_type indices_
Definition: Sphere.h:99
std::vector< uint32_t > index_buffer_type
Index buffer type.
Definition: VertexVBO.h:36
void setStacks(int _stacks)
Set number of stacks.
Definition: Sphere.cpp:51
void setRadius(qreal)
Set new sphere radius.
Definition: Sphere.cpp:41
TexCoordsMode
Definition: Sphere.h:34
VertexVBO::vertex_buffer_type vertices_
Definition: Sphere.h:98
qreal radius_
Definition: Sphere.h:95
VertexVBO vbo_
Definition: Sphere.h:97
int slices_
Definition: Sphere.h:90
void update()
Regenerates the mesh and updates the vertex buffer objects.
Definition: Sphere.cpp:110
void setTexCoordsMode(TexCoordsMode)
Set tex coords mode, fisheye or equirectangular.
Definition: Sphere.cpp:94
void setTop(float)
Set new top position where to cut off sphere.
Definition: Sphere.cpp:73
Utility class for storing and drawing VBO data.
Definition: VertexVBO.h:30
float top() const
Return top position where to cut off sphere.
Definition: Sphere.cpp:68
std::vector< Vertex > vertex_buffer_type
Vertex buffer type.
Definition: VertexVBO.h:33
int stacks() const
Return number of stacks (in Z direction)
Definition: Sphere.cpp:46
~Sphere()
Definition: Sphere.cpp:33
void generateStack(float _top, float _bottom, float _topRadius, float _bottomRadius)
Definition: Sphere.cpp:145
Draw Handler for visualizing a centered sphere.
Definition: Sphere.h:31
Sphere(qreal _radius=1.0)
Definition: Sphere.cpp:27
void setSlices(int _slices)
Set number of slices and update mesh.
Definition: Sphere.cpp:62
TexCoordsMode texCoordsMode() const
Return tex coords mode; fisheye or equirectangular.
Definition: Sphere.cpp:90
void draw() const
Draws sphere from vertex buffer object.
Definition: Sphere.cpp:98
Definition: Sphere.h:36