SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLSkybox.h
Go to the documentation of this file.
1 /**
2  * \file SLSkybox
3  * \authors Marcus Hudritsch
4  * \date December 2017
5  * \authors Marcus Hudritsch
6  * \copyright http://opensource.org/licenses/GPL-3.0
7  * \remarks Please use clangformat to format the code. See more code style on
8  * https://github.com/cpvrlab/SLProject4/wiki/SLProject-Coding-Style
9 */
10 
11 #ifndef SLSKYBOX_H
12 #define SLSKYBOX_H
13 
14 #include <SLEnums.h>
15 #include <SLNode.h>
16 
17 class SLSceneView;
18 class SLAssetManager;
19 
20 //-----------------------------------------------------------------------------
21 //! Skybox node class with a SLBox mesh
22 /*! The skybox instance is a node with a SLBox mesh with inwards pointing
23 normals. It gets drawn in SLSceneView::draw3DGL with frozen depth buffer and a
24 special cubemap shader. The box is always with the active camera in its
25 center. It has to be created in SLScene::onLoad and assigned to the skybox
26 pointer of SLSceneView. See the Skybox shader example.
27 */
28 class SLSkybox : public SLNode
29 {
30 public:
31  SLSkybox(SLAssetManager* assetMgr,
32  SLstring shaderPath,
33  SLstring cubeMapXPos,
34  SLstring cubeMapXNeg,
35  SLstring cubeMapYPos,
36  SLstring cubeMapYNeg,
37  SLstring cubeMapZPos,
38  SLstring cubeMapZNeg,
39  SLstring name = "Default Skybox");
40 
42  SLstring shaderPath,
43  SLstring hdrImage,
44  SLVec2i resolution,
45  SLstring name = "HDR Skybox");
46 
47  ~SLSkybox() { ; }
48 
49  // Getters
54  SLfloat exposure() { return _exposure; }
55  SLbool isHDR() { return _isHDR; }
56 
57  // Setters
58  void exposure(float exp) { _exposure = exp; }
59 
61  SLCol4f colorAtDir(const SLVec3f& dir);
62 
63 private:
64  void build();
71  SLbool _isHDR; //!< flag for HDR skyboxes
72  SLbool _isBuilt; //!< flag for late HDR skybox building
73 };
74 //-----------------------------------------------------------------------------
75 #endif //#define SLSKYBOX_H
float SLfloat
Definition: SL.h:173
bool SLbool
Definition: SL.h:175
string SLstring
Definition: SL.h:158
Toplevel holder of the assets meshes, materials, textures and shaders.
Texture object for OpenGL texturing.
Definition: SLGLTexture.h:110
SLNode represents a node in a hierarchical scene graph.
Definition: SLNode.h:147
const SLstring & name() const
Definition: SLObject.h:38
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69
Skybox node class with a SLBox mesh.
Definition: SLSkybox.h:29
~SLSkybox()
Definition: SLSkybox.h:47
SLGLTexture * _environmentCubemap
Definition: SLSkybox.h:65
SLfloat exposure()
Definition: SLSkybox.h:54
SLGLTexture * _hdrTexture
Definition: SLSkybox.h:69
void build()
Builds all texture for HDR image based lighting.
Definition: SLSkybox.cpp:193
SLCol4f colorAtDir(const SLVec3f &dir)
Returns the color in the skybox at the the specified direction dir.
Definition: SLSkybox.cpp:237
SLGLTexture * _irradianceCubemap
Definition: SLSkybox.h:66
SLGLTexture * irradianceCubemap()
Definition: SLSkybox.h:51
SLbool _isHDR
flag for HDR skyboxes
Definition: SLSkybox.h:71
SLSkybox(SLAssetManager *assetMgr, SLstring shaderPath, SLstring cubeMapXPos, SLstring cubeMapXNeg, SLstring cubeMapYPos, SLstring cubeMapYNeg, SLstring cubeMapZPos, SLstring cubeMapZNeg, SLstring name="Default Skybox")
Construct a new SLSkybox::SLSkybox object with 6 images for all sides.
Definition: SLSkybox.cpp:37
void exposure(float exp)
Definition: SLSkybox.h:58
SLGLTexture * brdfLutTexture()
Definition: SLSkybox.h:53
SLGLTexture * roughnessCubemap()
Definition: SLSkybox.h:52
void drawAroundCamera(SLSceneView *sv)
Draw the skybox with a cube map with the camera in its center.
Definition: SLSkybox.cpp:204
SLGLTexture * _roughnessCubemap
Definition: SLSkybox.h:67
SLGLTexture * _brdfLutTexture
Definition: SLSkybox.h:68
SLbool _isBuilt
flag for late HDR skybox building
Definition: SLSkybox.h:72
SLbool isHDR()
Definition: SLSkybox.h:55
SLfloat _exposure
Definition: SLSkybox.h:70
SLGLTexture * environmentCubemap()
Definition: SLSkybox.h:50