SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLCone.h
Go to the documentation of this file.
1 /**
2  * \file SLCone.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 SLCONE_H
11 #define SLCONE_H
12 
13 #include <SLRevolver.h>
14 
15 //-----------------------------------------------------------------------------
16 /**
17  * @brief SLCone creates a cone mesh based on SLRevolver
18  * @remarks It is important that during instantiation NO OpenGL functions (gl*)
19  * get called because this constructor will be most probably called in a parallel
20  * thread from within an SLScene::registerAssetsToLoad or SLScene::assemble
21  * function. All objects that get rendered have to do their OpenGL initialization
22  * when they are used the first time during rendering in the main thread.
23  * For this mesh it means that the objects for OpenGL drawing (_vao, _vaoP,
24  * _vaoN, _vaoT and _vaoS) remain unused until the first frame is rendered.
25  */
26 class SLCone : public SLRevolver
27 {
28 public:
29  SLCone(SLAssetManager* assetMgr,
30  SLfloat coneRadius,
31  SLfloat coneHeight,
32  SLuint stacks = 36,
33  SLuint slices = 36,
34  SLbool hasBottom = true,
35  SLstring name = "cone mesh",
36  SLMaterial* mat = nullptr);
37 
38  // Getters
39  SLfloat radius() { return _radius; }
40  SLfloat height() { return _height; }
41  SLbool hasBottom() { return _hasBottom; }
42 
43 protected:
44  SLfloat _radius; //!< radius of cone
45  SLfloat _height; //!< height of cone
46  SLbool _hasBottom; //!< Flag if cone has a bottom
47 };
48 //-----------------------------------------------------------------------------
49 #endif // SLCONE_H
float SLfloat
Definition: SL.h:173
unsigned int SLuint
Definition: SL.h:171
bool SLbool
Definition: SL.h:175
string SLstring
Definition: SL.h:158
Toplevel holder of the assets meshes, materials, textures and shaders.
SLCone creates a cone mesh based on SLRevolver.
Definition: SLCone.h:27
SLfloat height()
Definition: SLCone.h:40
SLfloat radius()
Definition: SLCone.h:39
SLbool hasBottom()
Definition: SLCone.h:41
SLCone(SLAssetManager *assetMgr, SLfloat coneRadius, SLfloat coneHeight, SLuint stacks=36, SLuint slices=36, SLbool hasBottom=true, SLstring name="cone mesh", SLMaterial *mat=nullptr)
Definition: SLCone.cpp:16
SLbool _hasBottom
Flag if cone has a bottom.
Definition: SLCone.h:46
SLfloat _height
height of cone
Definition: SLCone.h:45
SLfloat _radius
radius of cone
Definition: SLCone.h:44
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
SLRevolver is an SLMesh object built out of revolving points.
Definition: SLRevolver.h:38
SLuint stacks()
Definition: SLRevolver.h:54
SLuint slices()
Definition: SLRevolver.h:55