GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::graphics::Sky3D Class Reference

Skybox in 3D space. More...

#include <GREM/graphics_3d/Sky3D.hpp>

Classes

struct  FragmentShaderConstants
 Struct of default fragment shader constants. More...
struct  Parameters
 Struct of shader parameters representing the sky's appearance. More...

Public Types

using Mesh = Cubemap3D::Mesh
 Type of a skybox mesh.
using VertexShaderConstants = Cubemap3D::VertexShaderConstants
 Struct of default vertex shader constants.
using VertexShaderOutputs = Cubemap3D::VertexShaderOutputs
 Struct of fields output by the default vertex shader.
using FragmentShaderOutputs = Cubemap3D::FragmentShaderOutputs
 Struct of fields output by the default fragment shader.
using ParameterBuffer = UniformBuffer<Parameters, "Sky3DParameters">
 Shader buffer for sky parameters.
using ShaderPipeline = graphics::ShaderPipeline<Mesh>
 Shader pipeline for drawing skyboxes.

Public Member Functions

 Sky3D (Device &device, const Sky3DOptions &options={})
 Construct a sky.
 Sky3D (Device &device, Texture radianceMap, Texture irradianceMap, Texture reflectionMap, const Sky3DOptions &options)
 Construct a pre-baked sky.
void setSky (const Sky3DOptions &newOptions)
 Set the sky to the default invisible texture with new options.
void setSky (Texture newRadianceMap, Texture newIrradianceMap, Texture newReflectionMap, const Sky3DOptions &newOptions)
 Set the sky to a pre-baked sky.
const Texture & getRadianceMap () const noexcept
 Get the radiance map of the sky.
const Texture & getIrradianceMap () const noexcept
 Get the irradiance map of the sky.
const Texture & getReflectionMap () const noexcept
 Get the reflection map of the sky.
Sky3DOptions getOptions () const noexcept
 Get the configuration options of the sky.

Static Public Attributes

static constexpr VertexShaderConstants DEFAULT_VERTEX_SHADER_CONSTANTS {}
 Default skybox vertex shader constants.
static constexpr FragmentShaderConstants DEFAULT_FRAGMENT_SHADER_CONSTANTS
 Default skybox fragment shader constants.
static constexpr ShaderPipelineOptions DEFAULT_SHADER_PIPELINE_OPTIONS
 Default skybox graphics pipeline configuration.

Detailed Description

Skybox in 3D space.

Member Typedef Documentation

◆ Mesh

Type of a skybox mesh.

◆ VertexShaderConstants

Struct of default vertex shader constants.

◆ VertexShaderOutputs

Struct of fields output by the default vertex shader.

◆ FragmentShaderOutputs

Struct of fields output by the default fragment shader.

◆ ParameterBuffer

Shader buffer for sky parameters.

◆ ShaderPipeline

Shader pipeline for drawing skyboxes.

Constructor & Destructor Documentation

◆ Sky3D() [1/2]

grem::graphics::Sky3D::Sky3D ( Device & device,
const Sky3DOptions & options = {} )
explicit

Construct a sky.

Parameters
devicedevice to create the sky for. Must outlive the sky.
optionssky options, see Sky3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ Sky3D() [2/2]

grem::graphics::Sky3D::Sky3D ( Device & device,
Texture radianceMap,
Texture irradianceMap,
Texture reflectionMap,
const Sky3DOptions & options )

Construct a pre-baked sky.

Parameters
devicedevice to create the sky for. Must outlive the sky.
radianceMappre-baked radiance map for sky color. Must be a valid sampled cube texture in an RGB(A) color format, or empty.
irradianceMappre-baked irradiance map for sky lighting. Must be a valid sampled cube texture in an RGB(A) color format, or empty.
reflectionMappre-baked reflection map for sky reflections. Must be a valid sampled cube texture in an RGB(A) color format, or empty.
optionssky options, see Sky3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

Member Function Documentation

◆ setSky() [1/2]

void grem::graphics::Sky3D::setSky ( const Sky3DOptions & newOptions)

Set the sky to the default invisible texture with new options.

Parameters
newOptionssky options, see Sky3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ setSky() [2/2]

void grem::graphics::Sky3D::setSky ( Texture newRadianceMap,
Texture newIrradianceMap,
Texture newReflectionMap,
const Sky3DOptions & newOptions )

Set the sky to a pre-baked sky.

Parameters
newRadianceMappre-baked radiance map for sky color. Must be a valid sampled cube texture in an RGB(A) color format with straight alpha, or empty.
newIrradianceMappre-baked irradiance map for sky lighting. Must be a valid sampled cube texture in an RGB(A) color format with straight alpha, or empty.
newReflectionMappre-baked reflection map for sky reflections. Must be a valid sampled cube texture in an RGB(A) color format with straight alpha, or empty.
newOptionssky options, see Sky3DOptions.
Exceptions
graphics::Errorif resource creation failed.
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ getRadianceMap()

const Texture & grem::graphics::Sky3D::getRadianceMap ( ) const
inlinenodiscardnoexcept

Get the radiance map of the sky.

Returns
a read-only reference to the radiance map cube texture, which will be empty if the sky has not been baked since its last modification.

◆ getIrradianceMap()

const Texture & grem::graphics::Sky3D::getIrradianceMap ( ) const
inlinenodiscardnoexcept

Get the irradiance map of the sky.

Returns
a read-only reference to the irradiance map cube texture, which will be empty if the sky has not been baked since its last modification.

◆ getReflectionMap()

const Texture & grem::graphics::Sky3D::getReflectionMap ( ) const
inlinenodiscardnoexcept

Get the reflection map of the sky.

Returns
a read-only reference to the reflection map cube texture, which will be empty if the sky has not been baked since its last modification.

◆ getOptions()

Sky3DOptions grem::graphics::Sky3D::getOptions ( ) const
inlinenodiscardnoexcept

Get the configuration options of the sky.

Returns
the current configuration options.

Member Data Documentation

◆ DEFAULT_VERTEX_SHADER_CONSTANTS

VertexShaderConstants grem::graphics::Sky3D::DEFAULT_VERTEX_SHADER_CONSTANTS {}
staticconstexpr

Default skybox vertex shader constants.

◆ DEFAULT_FRAGMENT_SHADER_CONSTANTS

FragmentShaderConstants grem::graphics::Sky3D::DEFAULT_FRAGMENT_SHADER_CONSTANTS
staticconstexpr
Initial value:
{
.SKY_HDR = false,
}

Default skybox fragment shader constants.

◆ DEFAULT_SHADER_PIPELINE_OPTIONS

ShaderPipelineOptions grem::graphics::Sky3D::DEFAULT_SHADER_PIPELINE_OPTIONS
staticconstexpr
Initial value:
{
.depthTestPredicate = DepthTestPredicate::LESS_OR_EQUAL,
.faceCullingMode = FaceCullingMode::NONE,
}
@ NONE
Ignore facing, don't cull primitives based on their winding order.
Definition shaders.hpp:319
@ LESS_OR_EQUAL
The depth test passes if and only if the new depth value is less than or equal to the old depth value...
Definition shaders.hpp:108

Default skybox graphics pipeline configuration.


The documentation for this class was generated from the following file: