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

Container for a cubemap mesh stored on the GPU. More...

#include <GREM/graphics_3d/Cubemap3D.hpp>

Classes

struct  Vertex
 Data layout for the attributes of a single vertex of a cubemap mesh. More...
struct  VertexShaderConstants
 Struct of default vertex shader constants. More...
struct  VertexShaderOutputs
 Struct of fields output by the default vertex shader. More...
struct  FragmentShaderOutputs
 Struct of fields output by the default fragment shader. More...
struct  PerspectiveParameters
 Struct of shader parameters representing the perspective viewing the cubemap. More...

Public Types

using Index = uint16_t
 Data type used in the index buffer of a cubemap mesh.
using Mesh = graphics::Mesh<Vertex, Index>
 Cubemap mesh primitive type.
using PerspectiveBuffer = UniformBuffer<PerspectiveParameters, "Cubemap3DPerspective">
 Shader buffer for cubemap perspective parameters.
using VertexShader = graphics::VertexShader<Mesh, VertexShaderConstants, VertexShaderOutputs, PerspectiveBuffer>
 Default vertex shader for drawing cubemaps.
using ShaderPipeline = graphics::ShaderPipeline<Mesh>
 Shader pipeline for drawing cubemaps.

Public Member Functions

 Cubemap3D (Device &device)
 Construct a unit cubemap.
const Mesh & getMesh () const noexcept
 Get the cubemap mesh.

Static Public Member Functions

static Array< mat4, 6 > getSideViewMatrices (vec3 position) noexcept
 Get an array of view matrices for rendering each side of an axis-aligned cubemap from its center at a specific position.

Static Public Attributes

static constexpr VertexShaderConstants DEFAULT_VERTEX_SHADER_CONSTANTS {}
 Default cubemap vertex shader constants.
static constexpr ShaderPipelineOptions DEFAULT_SHADER_PIPELINE_OPTIONS
 Default cubemap graphics pipeline configuration.
static constexpr mat4 SIDE_PROJECTION_MATRIX
 Projection matrix for rendering a side of a cubemap from its center.
static constexpr Array SIDE_FORWARD_DIRECTIONS
 Camera forward directions for rendering each side of an axis-aligned cubemap.
static constexpr Array SIDE_UP_DIRECTIONS
 Camera up vectors for rendering each side of an axis-algined cubemap.

Detailed Description

Container for a cubemap mesh stored on the GPU.

Member Typedef Documentation

◆ Index

Data type used in the index buffer of a cubemap mesh.

◆ Mesh

Cubemap mesh primitive type.

◆ PerspectiveBuffer

Shader buffer for cubemap perspective parameters.

◆ VertexShader

◆ ShaderPipeline

Shader pipeline for drawing cubemaps.

Constructor & Destructor Documentation

◆ Cubemap3D()

grem::graphics::Cubemap3D::Cubemap3D ( Device & device)
inlineexplicit

Construct a unit cubemap.

Parameters
devicedevice to create the cubemap for. Must outlive the cubemap.
Exceptions
graphics::Erroron failure to create the cubemap.
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

◆ getSideViewMatrices()

Array< mat4, 6 > grem::graphics::Cubemap3D::getSideViewMatrices ( vec3 position)
inlinestaticnodiscardnoexcept

Get an array of view matrices for rendering each side of an axis-aligned cubemap from its center at a specific position.

Parameters
positioncenter of the cubemap.
Returns
an array of 6 view matrices, one for each side of the cube, corresponding to SIDE_FORWARD_DIRECTIONS and SIDE_UP_DIRECTIONS.

◆ getMesh()

const Mesh & grem::graphics::Cubemap3D::getMesh ( ) const
inlinenodiscardnoexcept

Get the cubemap mesh.

Returns
a read-only reference to the cubemap mesh.

Member Data Documentation

◆ DEFAULT_VERTEX_SHADER_CONSTANTS

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

Default cubemap vertex shader constants.

◆ DEFAULT_SHADER_PIPELINE_OPTIONS

ShaderPipelineOptions grem::graphics::Cubemap3D::DEFAULT_SHADER_PIPELINE_OPTIONS
staticconstexpr
Initial value:
{
.depthBufferMode = DepthBufferMode::NONE,
.faceCullingMode = FaceCullingMode::NONE,
}
@ NONE
Ignore the depth buffer.
Definition shaders.hpp:59
@ NONE
Ignore facing, don't cull primitives based on their winding order.
Definition shaders.hpp:319

Default cubemap graphics pipeline configuration.

◆ SIDE_PROJECTION_MATRIX

mat4 grem::graphics::Cubemap3D::SIDE_PROJECTION_MATRIX
staticconstexpr
Initial value:
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, -1.0f, -1.0f,
0.0f, 0.0f, 0.0f, 0.0f,
}

Projection matrix for rendering a side of a cubemap from its center.

◆ SIDE_FORWARD_DIRECTIONS

Array grem::graphics::Cubemap3D::SIDE_FORWARD_DIRECTIONS
staticconstexpr
Initial value:
{
vec3{1.0f, 0.0f, 0.0f},
vec3{-1.0f, 0.0f, 0.0f},
vec3{0.0f, -1.0f, 0.0f},
vec3{0.0f, 1.0f, 0.0f},
vec3{0.0f, 0.0f, 1.0f},
vec3{0.0f, 0.0f, -1.0f},
}
vec< 3, float > vec3
Definition math.hpp:439

Camera forward directions for rendering each side of an axis-aligned cubemap.

◆ SIDE_UP_DIRECTIONS

Array grem::graphics::Cubemap3D::SIDE_UP_DIRECTIONS
staticconstexpr
Initial value:
{
vec3{0.0f, -1.0f, 0.0f},
vec3{0.0f, -1.0f, 0.0f},
vec3{0.0f, 0.0f, -1.0f},
vec3{0.0f, 0.0f, 1.0f},
vec3{0.0f, -1.0f, 0.0f},
vec3{0.0f, -1.0f, 0.0f},
}

Camera up vectors for rendering each side of an axis-algined cubemap.


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