SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLCylinder.h
Go to the documentation of this file.
1 /**
2  * \file SLCylinder.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 SLCYLINDER_H
11 #define SLCYLINDER_H
12 
13 #include <SLRevolver.h>
14 
15 //-----------------------------------------------------------------------------
16 /**
17  * @brief SLCylinder is creates sphere mesh based on its SLRevolver methods
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 SLCylinder : public SLRevolver
27 {
28 public:
29  SLCylinder(SLAssetManager* assetMgr,
30  SLfloat cylinderRadius,
31  SLfloat cylinderHeight,
32  SLuint stacks = 1,
33  SLuint slices = 16,
34  SLbool hasTop = true,
35  SLbool hasBottom = true,
36  SLstring name = "cylinder mesh",
37  SLMaterial* mat = nullptr);
38 
39  // Getters
40  SLfloat radius() { return _radius; }
41  SLfloat height() { return _height; }
42  SLbool hasTop() { return _hasTop; }
43  SLbool hasBottom() { return _hasBottom; }
44 
45 private:
46  SLfloat _radius; //!< radius of cylinder
47  SLfloat _height; //!< height of cylinder
48  SLbool _hasTop; //!< Flag if cylinder has a top
49  SLbool _hasBottom; //!< Flag if cylinder has a bottom
50 };
51 //-----------------------------------------------------------------------------
52 #endif // SLCYLINDER_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.
SLCylinder is creates sphere mesh based on its SLRevolver methods.
Definition: SLCylinder.h:27
SLfloat _height
height of cylinder
Definition: SLCylinder.h:47
SLCylinder(SLAssetManager *assetMgr, SLfloat cylinderRadius, SLfloat cylinderHeight, SLuint stacks=1, SLuint slices=16, SLbool hasTop=true, SLbool hasBottom=true, SLstring name="cylinder mesh", SLMaterial *mat=nullptr)
Definition: SLCylinder.cpp:18
SLbool _hasBottom
Flag if cylinder has a bottom.
Definition: SLCylinder.h:49
SLfloat height()
Definition: SLCylinder.h:41
SLbool hasTop()
Definition: SLCylinder.h:42
SLbool hasBottom()
Definition: SLCylinder.h:43
SLfloat _radius
radius of cylinder
Definition: SLCylinder.h:46
SLbool _hasTop
Flag if cylinder has a top.
Definition: SLCylinder.h:48
SLfloat radius()
Definition: SLCylinder.h:40
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