59 ,
const float intensity
61 ,
bool castShadows =
false
69 ,
const float intensity
70 ,
const float innerConeAngle
71 ,
const float outerConeAngle
73 ,
bool castShadows =
false
82 ,
const float intensity
84 ,
bool twoSided =
false
85 ,
bool castShadows =
false
86 ,
bool renderMesh =
false
222 std::array<float, 2>,
Definition graphicscontext.h:165
An ID allocator associates an id with a slice in an N number of arrays.
Definition idallocator.h:39
Definition lightcontext.h:24
static Math::vec3 GetColor(const Graphics::GraphicsEntityId id)
Definition lightcontext.cc:579
static void WindowResized(const CoreGraphics::WindowId windowId, SizeT width, SizeT height)
React to window resize event.
Definition lightcontext.cc:1303
static const void SetScale(const Graphics::GraphicsEntityId id, const Math::vec3 &scale)
Set light scale.
Definition lightcontext.cc:783
static ShadowCasterAllocator shadowCasterAllocator
Definition lightcontext.h:285
static const CoreGraphics::BufferId GetLightIndexBuffer()
get light index lists buffer
Definition lightcontext.cc:1001
static Math::vec3 GetAmbient(const Graphics::GraphicsEntityId id)
Definition lightcontext.cc:355
static void SetAmbient(const Graphics::GraphicsEntityId id, Math::vec3 &ambient)
Definition lightcontext.cc:365
@ ShadowCaster_Transform
Definition lightcontext.h:278
static const Math::mat4 GetTransform(const Graphics::GraphicsEntityId id)
get transform
Definition lightcontext.cc:644
static void SetupPointLight(const Graphics::GraphicsEntityId id, const Math::vec3 &color, const float intensity, const float range, bool castShadows=false, const CoreGraphics::TextureId projection=CoreGraphics::InvalidTextureId)
Setup entity as point light source.
Definition lightcontext.cc:378
static float GetIntensity(const Graphics::GraphicsEntityId id)
Definition lightcontext.cc:609
static const Math::point GetPosition(const Graphics::GraphicsEntityId id)
Get light position.
Definition lightcontext.cc:709
static void SetRange(const Graphics::GraphicsEntityId id, const float range)
set range of light
Definition lightcontext.cc:589
static const Math::quat GetRotation(const Graphics::GraphicsEntityId id)
Get light rotation.
Definition lightcontext.cc:761
static void GetInnerOuterAngle(const Graphics::GraphicsEntityId id, float &inner, float &outer)
get inner and outer angle for spotlights
Definition lightcontext.cc:853
@ SpotLight_DynamicOffsets
Definition lightcontext.h:210
@ SpotLight_ShadowConstantBufferSet
Definition lightcontext.h:209
@ SpotLight_Transform
Definition lightcontext.h:207
@ SpotLight_ProjectionTexture
Definition lightcontext.h:212
@ SpotLight_ConstantBufferSet
Definition lightcontext.h:208
@ SpotLight_ProjectionTransform
Definition lightcontext.h:213
@ SpotLight_Observer
Definition lightcontext.h:214
@ SpotLight_ConeAngles
Definition lightcontext.h:211
static const CoreGraphics::BufferId GetLightsBuffer()
get light lists buffer
Definition lightcontext.cc:1010
static void SetupGlobalLight(const Graphics::GraphicsEntityId id, const Math::vec3 &color, const float intensity, const Math::vec3 &ambient, const Math::vec3 &backlight, const float backlightFactor, const float zenith, const float azimuth, bool castShadows=false)
setup entity as global light
Definition lightcontext.cc:295
static const void SetRotation(const Graphics::GraphicsEntityId id, const Math::quat &rotation)
Set light rotation.
Definition lightcontext.cc:731
static void SetGlobalLightViewProjTransform(const Graphics::ContextEntityId id, const Math::mat4 &transform)
Set global light shadow transform.
Definition lightcontext.cc:1030
LightType
Definition lightcontext.h:29
Ids::IdAllocator< LightType, Math::vec3, float, bool, float, Ids::Id32 > GenericLightAllocator
Definition lightcontext.h:177
Ids::IdAllocator< Math::vector, Math::vec3, float, Math::vec3, Math::mat4, Math::mat4, Util::Array< Graphics::GraphicsEntityId > > DirectionalLightAllocator
Definition lightcontext.h:272
static void SetColor(const Graphics::GraphicsEntityId id, const Math::vec3 &color)
set color of light
Definition lightcontext.cc:569
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition lightcontext.cc:1327
static const Math::vec3 GetScale(const Graphics::GraphicsEntityId id)
Get light scale.
Definition lightcontext.cc:821
static void SetIntensity(const Graphics::GraphicsEntityId id, const float intensity)
set intensity of light
Definition lightcontext.cc:599
static void Discard()
discard light context
Definition lightcontext.cc:286
static void SetInnerOuterAngle(const Graphics::GraphicsEntityId id, float inner, float outer)
set inner and outer angle for spotlights
Definition lightcontext.cc:867
static const void SetPosition(const Graphics::GraphicsEntityId id, const Math::point &position)
Set light position.
Definition lightcontext.cc:679
static AreaLightAllocator areaLightAllocator
Definition lightcontext.h:251
LightContext()
constructor
Definition lightcontext.cc:106
static void SetupSpotLight(const Graphics::GraphicsEntityId id, const Math::vec3 &color, const float intensity, const float innerConeAngle, const float outerConeAngle, const float range, bool castShadows=false, const CoreGraphics::TextureId projection=CoreGraphics::InvalidTextureId)
Setup entity as spot light.
Definition lightcontext.cc:420
static void SetGlobalLightTransform(const Graphics::ContextEntityId id, const Math::mat4 &transform, const Math::vector &direction)
Set global light transform.
Definition lightcontext.cc:1019
static DirectionalLightAllocator directionalLightAllocator
Definition lightcontext.h:273
static PointLightAllocator pointLightAllocator
Definition lightcontext.h:203
static void SetTransform(const Graphics::GraphicsEntityId id, const float azimuth, const float zenith)
Set transform as angles.
Definition lightcontext.cc:619
static void OnRenderDebug(uint32_t flags)
render debug
Definition lightcontext.cc:1374
AreaLightShape
Definition lightcontext.h:37
virtual ~LightContext()
destructor
Definition lightcontext.cc:114
@ Range
Definition lightcontext.h:166
@ TypedLightId
Definition lightcontext.h:167
@ Intensity
Definition lightcontext.h:164
@ Type
Definition lightcontext.h:162
@ Color
Definition lightcontext.h:163
@ ShadowCaster
Definition lightcontext.h:165
static Util::HashTable< Graphics::GraphicsEntityId, uint, 16, 1 > shadowCasterSliceMap
Definition lightcontext.h:286
static const Math::mat4 GetObserverTransform(const Graphics::GraphicsEntityId id)
get the view transform including projections
Definition lightcontext.cc:669
static void SetupTerrainShadows(const CoreGraphics::TextureId terrainShadowMap, const uint worldSize)
Setup terrain shadows.
Definition lightcontext.cc:990
Ids::IdAllocator< Math::mat4 > ShadowCasterAllocator
Definition lightcontext.h:283
static SpotLightAllocator spotLightAllocator
Definition lightcontext.h:227
static GenericLightAllocator genericLightAllocator
Definition lightcontext.h:178
Ids::IdAllocator< Math::transform44, ConstantBufferSet, ConstantBufferSet, Util::FixedArray< uint >, CoreGraphics::TextureId, Graphics::GraphicsEntityId > PointLightAllocator
Definition lightcontext.h:202
static LightType GetType(const Graphics::GraphicsEntityId id)
get the light type
Definition lightcontext.cc:843
Ids::IdAllocator< Math::transform44, AreaLightShape, ConstantBufferSet, ConstantBufferSet, Util::FixedArray< uint >, bool, Graphics::GraphicsEntityId, bool > AreaLightAllocator
Definition lightcontext.h:250
static void Create()
setup light context
Definition lightcontext.cc:123
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition lightcontext.cc:1336
static void SetupAreaLight(const Graphics::GraphicsEntityId id, const AreaLightShape shape, const Math::vec3 &color, const float intensity, const float range, bool twoSided=false, bool castShadows=false, bool renderMesh=false)
Setup entity as area light.
Definition lightcontext.cc:477
@ PointLight_Observer
Definition lightcontext.h:192
@ PointLight_Transform
Definition lightcontext.h:187
@ PointLight_ProjectionTexture
Definition lightcontext.h:191
@ PointLight_DynamicOffsets
Definition lightcontext.h:190
@ PointLight_ConstantBufferSet
Definition lightcontext.h:188
@ PointLight_ShadowConstantBufferSet
Definition lightcontext.h:189
@ DirectionalLight_ViewProjTransform
Definition lightcontext.h:260
@ DirectionalLight_Ambient
Definition lightcontext.h:258
@ DirectionalLight_Direction
Definition lightcontext.h:255
@ DirectionalLight_CascadeObservers
Definition lightcontext.h:261
@ DirectionalLight_Transform
Definition lightcontext.h:259
@ DirectionalLight_Backlight
Definition lightcontext.h:256
@ DirectionalLight_BacklightOffset
Definition lightcontext.h:257
static void OnPrepareView(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
prepare light visibility
Definition lightcontext.cc:886
Ids::IdAllocator< Math::transform44, ConstantBufferSet, ConstantBufferSet, Util::FixedArray< uint >, std::array< float, 2 >, CoreGraphics::TextureId, Math::mat4, Graphics::GraphicsEntityId > SpotLightAllocator
Definition lightcontext.h:226
static void UpdateViewDependentResources(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
prepare light lists
Definition lightcontext.cc:1040
static void RunFrameScriptJobs(const Graphics::FrameContext &ctx)
run framescript when visibility is done
@ AreaLight_DynamicOffsets
Definition lightcontext.h:235
@ AreaLight_TwoSided
Definition lightcontext.h:236
@ AreaLight_ConstantBufferSet
Definition lightcontext.h:233
@ AreaLight_Shape
Definition lightcontext.h:232
@ AreaLight_ShadowConstantBufferSet
Definition lightcontext.h:234
@ AreaLight_RenderMesh
Definition lightcontext.h:238
@ AreaLight_Transform
Definition lightcontext.h:231
@ AreaLight_Observer
Definition lightcontext.h:237
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
Organizes key/value pairs by a hash code.
Definition hashtable.h:42
ImGUI debug interface for inspecting frame scripts.
Definition shaderserverbase.h:52
uint32_t Id32
Definition id.h:138
The lighting subsystem allows for attaching light source functionality to a GraphicsEntityId.
Definition csmutil.cc:19
CoreGraphics::TextureId terrainShadowMap
Definition lightcontext.cc:57
A shader represents an entire shader resource, containing several stages and programs.
texture type
Definition texture.h:25
Definition graphicscontext.h:133
Definition graphicsserver.h:31
The graphics entity is only an Id, to which we can attach GraphicsContexts.
Definition graphicsentity.h:16
Definition lightcontext.h:181
uint offset
Definition lightcontext.h:182
uint slice
Definition lightcontext.h:182
A 4x4 single point precision float matrix.
Definition mat4.h:49
Represents a 3D point in space.
Definition point.h:22
A quaternion is usually used to represent an orientation in 3D space.
Definition quat.h:30
A 3D vector.
Definition vec3.h:40
A vector is a 3D direction in space.
Definition vector.h:22
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31