Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | Static Private Attributes | List of all members
ForwardLight Class Referencefinal

Store lights data for forward rendering in a GPU buffer. More...

#include <ForwardLight.hpp>

Classes

struct  GPULight
 Represent a light on the GPU for the forward renderer. More...
 

Public Member Functions

 ForwardLight (size_t count)
 
void updateCameraInfos (const glm::mat4 &viewMatrix, const glm::mat4 &projMatrix)
 
void draw (const SpotLight *light) override
 
void draw (const PointLight *light) override
 
void draw (const DirectionalLight *light) override
 
size_t count () const
 
const std::vector< const Texture * > & shadowMaps () const
 
UniformBuffer< GPULight > & data ()
 
virtual void draw (const DirectionalLight *light)=0
 
virtual void draw (const PointLight *light)=0
 
virtual void draw (const SpotLight *light)=0
 

Private Attributes

size_t _currentId = 0
 Current insertion location.
 
size_t _currentCount = 0
 Number of lights to store.
 
UniformBuffer< GPULight_lightsData
 GPU buffer.
 
glm::mat4 _view = glm::mat4(1.0f)
 Cached camera view matrix.
 
glm::mat4 _proj = glm::mat4(1.0f)
 Cached camera projection matrix.
 
glm::mat4 _invView = glm::mat4(1.0f)
 Cached inverse view matrix.
 
std::vector< const Texture * > _shadowMaps
 Shadow maps list.
 

Static Private Attributes

static const size_t _maxLightCount = 50
 Maximum allowed number of lights (see forward_lights.glsl).
 

Detailed Description

Store lights data for forward rendering in a GPU buffer.

Inherits LightRenderer.

Constructor & Destructor Documentation

◆ ForwardLight()

ForwardLight::ForwardLight ( size_t  count)
explicit

Constructor.

Parameters
countnumber of lights that will be submitted

Member Function Documentation

◆ count()

size_t ForwardLight::count ( ) const
inline
Returns
the current number of lights

◆ data()

UniformBuffer< GPULight > & ForwardLight::data ( )
inline
Returns
the GPU lights recorded buffer

◆ draw() [1/3]

void ForwardLight::draw ( const DirectionalLight light)
overridevirtual

Record directional light information for rendering.

Parameters
lightthe light to compute the contribution of

Implements LightRenderer.

◆ draw() [2/3]

void ForwardLight::draw ( const PointLight light)
overridevirtual

Record point light information for rendering.

Parameters
lightthe light to compute the contribution of

Implements LightRenderer.

◆ draw() [3/3]

void ForwardLight::draw ( const SpotLight light)
overridevirtual

Record spot light information for rendering.

Parameters
lightthe light to compute the contribution of

Implements LightRenderer.

◆ shadowMaps()

const std::vector< const Texture * > & ForwardLight::shadowMaps ( ) const
inline
Returns
the shadow maps used by the lights

◆ updateCameraInfos()

void ForwardLight::updateCameraInfos ( const glm::mat4 &  viewMatrix,
const glm::mat4 &  projMatrix 
)

Set the current user view and projection matrices.

Parameters
viewMatrixthe camera view matrix
projMatrixthe camera projection matrix

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