SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLSphere.h
Go to the documentation of this file.
1 /**
2  * \file SLSphere.h
3  * \date July 2014
4  * \authors Marcus Hudritsch
5  * \copyright http://opensource.org/licenses/GPL-3.0
6  * \remarks Please use clangformat to format the code. See more code style on
7  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
8 */
9 
10 #ifndef SLSPHERE_H
11 #define SLSPHERE_H
12 
13 #include <SLSpheric.h>
14 
15 #include <utility>
16 
17 class SLRay;
18 class SLMaterial;
19 class SLAssetManager;
20 
21 //-----------------------------------------------------------------------------
22 /**
23  * @brief SLSphere creates a sphere mesh based on SLSpheric w. 180 deg polar angle.
24  * @remarks It is important that during instantiation NO OpenGL functions (gl*)
25  * get called because this constructor will be most probably called in a parallel
26  * thread from within an SLScene::registerAssetsToLoad or SLScene::assemble
27  * function. All objects that get rendered have to do their OpenGL initialization
28  * when they are used the first time during rendering in the main thread.
29  * For this mesh it means that the objects for OpenGL drawing (_vao, _vaoP,
30  * _vaoN, _vaoT and _vaoS) remain unused until the first frame is rendered.
31  */
32 class SLSphere : public SLSpheric
33 {
34 public:
35  explicit SLSphere(SLAssetManager* assetMgr,
37  SLuint stacks = 32,
38  SLuint slices = 32,
39  SLstring name = "sphere mesh",
40  SLMaterial* mat = nullptr) : SLSpheric(assetMgr,
41  radius,
42  0.0f,
43  180.0f,
44  stacks,
45  slices,
46  std::move(name),
47  mat)
48  {
49  }
50 };
51 //-----------------------------------------------------------------------------
52 #endif // SLSPHERE_H
float SLfloat
Definition: SL.h:173
unsigned int SLuint
Definition: SL.h:171
string SLstring
Definition: SL.h:158
Toplevel holder of the assets meshes, materials, textures and shaders.
Defines a standard CG material with textures and a shader program.
Definition: SLMaterial.h:56
SLMaterial * mat() const
Definition: SLMesh.h:177
const SLstring & name() const
Definition: SLObject.h:38
Ray class with ray and intersection properties.
Definition: SLRay.h:40
SLuint stacks()
Definition: SLRevolver.h:54
SLuint slices()
Definition: SLRevolver.h:55
SLSphere creates a sphere mesh based on SLSpheric w. 180 deg polar angle.
Definition: SLSphere.h:33
SLSphere(SLAssetManager *assetMgr, SLfloat radius, SLuint stacks=32, SLuint slices=32, SLstring name="sphere mesh", SLMaterial *mat=nullptr)
Definition: SLSphere.h:35
SLSphere creates a sphere mesh based on SLRevolver.
Definition: SLSpheric.h:21
SLfloat radius()
Definition: SLSpheric.h:33