33#ifndef DVD_LIGHT_POOL_H_
34#define DVD_LIGHT_POOL_H_
53class SceneRenderState;
97 std::array<PointShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_POINT_LIGHTS>
_pointLights{};
98 std::array<SpotShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_SPOT_LIGHTS>
_spotLights{};
99 std::array<CSMShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_DIRECTIONAL_LIGHTS>
_dirLights{};
108 std::array<Light*, Config::Lighting::MAX_SHADOW_CASTING_LIGHTS>
_entries{};
115 using LightList = eastl::fixed_vector<Light*, 32u, true>;
135 bool clear() noexcept;
181 [GUID](
Light*
const light)
noexcept {
182 return light && light->
getGUID() == GUID;
215 using LightData = std::array<LightProperties, Config::Lighting::MAX_ACTIVE_LIGHTS_PER_FRAME>;
FORCE_INLINE I64 getGUID() const noexcept
A light object placed in the scene at a certain position.
void debugLight(Light *light)
nullptr = disabled
std::array< LightData, to_base(RenderStage::COUNT)> _sortedLightProperties
SharedMutex _movedSceneVolumesLock
U32 uploadLightList(RenderStage stage, const LightList &lights, const mat4< F32 > &viewMatrix)
void drawLightImpostors(GFX::CommandBuffer &bufferInOut) const
Light * getLight(I64 lightGUID, LightType type) const
static ShaderBuffer * LightBuffer()
LightList & getLights(const LightType type)
void uploadLightData(RenderStage stage, const CameraSnapshot &cameraSnapshot, GFX::MemoryBarrierCommand &memCmdInOut)
void preRenderAllPasses(const Camera *playerCamera)
static Handle< ShaderProgram > s_lightImpostorShader
std::array< U32, to_base(LightType::COUNT)> LightCountPerType
void generateShadowMaps(const Camera &playerCamera, GFX::CommandBuffer &bufferInOut, GFX::MemoryBarrierCommand &memCmdInOut)
static ShaderBuffer_uptr s_lightBuffer
void toggleLightType(const LightType type) noexcept
disable or enable a specific light type
static ShaderBuffer * SceneBuffer()
std::array< LightProperties, Config::Lighting::MAX_ACTIVE_LIGHTS_PER_FRAME > LightData
POINTER_R(Light, debugLight, nullptr)
static bool IsLightInViewFrustum(const Frustum &frustum, const Light *light) noexcept
void sortLightData(RenderStage stage, const CameraSnapshot &cameraSnapshot)
std::array< SceneData, to_base(RenderStage::COUNT)> _sortedSceneProperties
std::array< Light::ShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_LIGHTS > LightShadowProperties
LightList::const_iterator findLight(const I64 GUID, const LightType type) const
ShadowProperties _shadowBufferData
void onVolumeMoved(const BoundingSphere &volume, bool staticSource)
std::array< LightList, to_base(LightType::COUNT)> _lights
bool frameEnded(const FrameEvent &evt) override
frameEnded is called after the buffers have been swapped
Time::ProfileTimer & _shadowPassTimer
bool removeLight(const Light &light)
remove a light from the manager
bool isShadowCacheInvalidated(const vec3< F32 > &cameraPosition, Light *light)
U32 sortedLightCount(const RenderStage stage) const
static ShaderBuffer_uptr s_shadowBuffer
static ShaderBuffer_uptr s_sceneBuffer
eastl::fixed_vector< Light *, 32u, true > LightList
static void DestroyStaticData()
static U8 GetShadowBindSlotOffset(const ShadowType type) noexcept
Get the appropriate shadow bind slot for every light's shadow.
std::array< bool, to_base(LightType::COUNT)> _lightTypeState
static ShaderBuffer * ShadowBuffer()
static void InitStaticData(PlatformContext &context)
static std::array< U8, to_base(ShadowType::COUNT)> s_shadowLocation
std::array< LightList, to_base(RenderStage::COUNT)> _sortedLights
bool addLight(Light &light)
Add a new light to the manager.
static Handle< Texture > s_lightIconsTexture
std::array< U32, to_base(RenderStage::COUNT)> _sortedLightPropertiesCount
U32 getActiveLightCount(const RenderStage stage, const LightType type) const noexcept
Retrieve the number of active lights in the scene;.
std::array< LightCountPerType, to_base(RenderStage::COUNT)> _activeLightCount
PROPERTY_RW(bool, lightImpostorsEnabled, false)
bool frameStarted(const FrameEvent &evt) override
LightList::const_iterator findLightLocked(const I64 GUID, const LightType type) const
bool lightTypeEnabled(const LightType type) const noexcept
void toggleLightType(const LightType type, const bool state) noexcept
eastl::fixed_vector< MovingVolume, Config::MAX_VISIBLE_NODES, true > _movedSceneVolumes
PlatformContext & context() noexcept
Scene & parentScene() noexcept
All the information needed for a single light's shadowmap.
constexpr U8 MAX_CSM_SPLITS_PER_LIGHT
Used for CSM or PSSM to determine the maximum number of frustum splits.
FColour4 WHITE
Random stuff added for convenience.
Handle console commands that start with a forward slash.
constexpr U32 to_U32(const T value)
std::shared_mutex SharedMutex
std::shared_lock< mutex > SharedLock
LightType
The different types of lights supported.
constexpr auto to_base(const Type value) -> Type
std::array< vec4< F32 >, Config::Lighting::MAX_CSM_SPLITS_PER_LIGHT > _position
std::array< mat4< F32 >, Config::Lighting::MAX_CSM_SPLITS_PER_LIGHT > _vpMatrix
vec4< F32 > _ambientColour
std::array< Light *, Config::Lighting::MAX_SHADOW_CASTING_LIGHTS > _entries
std::array< PointShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_POINT_LIGHTS > _pointLights
std::array< SpotShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_SPOT_LIGHTS > _spotLights
std::array< CSMShadowProperties, Config::Lighting::MAX_SHADOW_CASTING_DIRECTIONAL_LIGHTS > _dirLights
bufferPtr data() const noexcept