Ocular Engine
Ocular::Core::LightManager Class Reference

#include <LightManager.hpp>

Public Member Functions

void updateLights (bool cullVisible=true)
void setAmbientLightColor (Color const &color)
Color getAmbientLightColor () const
void setAmbientLightIntensity (float intensity)
float getAmbientLightIntensity () const

Static Public Attributes

static const uint32_t LightBufferSlot = 8
 The GPUBuffer slot used by the LightManager to pass light data.

Protected Member Functions

void registerLightSource (LightSource *light)
void unregisterLightSource (LightSource *light)
void updateUUID (UUID const &uuid)
void getVisibleLights (std::vector< LightSource * > &visibleLights, bool cull)
bool isLightVisible (LightSource const *light, Math::Frustum const &frustum) const
bool isPointLightVisible (LightSource const *light, Math::Frustum const &frustum) const
bool isSpotlightVisible (LightSource const *light, Math::Frustum const &frustum) const
bool isDirectionalLightVisible (LightSource const *light, Math::Frustum const &frustum) const
void buildGPUBuffer (uint32_t visibleCount)
void fillGPUBuffer (std::vector< LightSource * > const &visibleLights)

Protected Attributes

std::unordered_map< std::string, LightSource * > m_Lights
std::vector< GPULightm_GPULights
uint32_t m_BufferLightCapacity
uint32_t m_PrevNumVisible
GPULight m_GPUAmbientLight


class LightSource

Detailed Description

Handles updating the GPU light buffer with current scene's lighting. All light sources are uploaded as instances of the GPULight structures.

Ambient lighting is always passed over in the buffers 0 index, with the number of lights recorded in it's light type property (Buffer[0].parameters.z).

Culling of visible lights is done using simple frustum culling against bounding volumes generated by the light's properties (bounding spheres for point lights).

Directional and ambient lights are not culled as they affect the entire scene by their very definition.

In Direct3D, the light structured buffer is passed over register t8. See LightManager::LightBufferSlot

Member Function Documentation

Color Ocular::Core::LightManager::getAmbientLightColor ( ) const
The current ambient light color.
float Ocular::Core::LightManager::getAmbientLightIntensity ( ) const
The currently ambient light intensity.
void Ocular::Core::LightManager::setAmbientLightColor ( Color const &  color)

Sets the ambient light color.

void Ocular::Core::LightManager::setAmbientLightIntensity ( float  intensity)

Sets the ambient light intensity. Intensity is clamped to [0,1].

void Ocular::Core::LightManager::updateLights ( bool  cullVisible = true)

Updates the GPU light buffer.

For Direct3D, this buffer is passed over register t8.

[in]cullVisibleIf TRUE, only visible lights will be passed to the GPU.

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