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
221 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:571
static void WindowResized(const CoreGraphics::WindowId windowId, SizeT width, SizeT height)
React to window resize event.
Definition lightcontext.cc:1277
static const void SetScale(const Graphics::GraphicsEntityId id, const Math::vec3 &scale)
Set light scale.
Definition lightcontext.cc:764
static ShadowCasterAllocator shadowCasterAllocator
Definition lightcontext.h:279
static const CoreGraphics::BufferId GetLightIndexBuffer()
get light index lists buffer
Definition lightcontext.cc:975
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:274
static const Math::mat4 GetTransform(const Graphics::GraphicsEntityId id)
get transform
Definition lightcontext.cc:633
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:375
static float GetIntensity(const Graphics::GraphicsEntityId id)
Definition lightcontext.cc:601
static const Math::point GetPosition(const Graphics::GraphicsEntityId id)
Get light position.
Definition lightcontext.cc:694
static void SetRange(const Graphics::GraphicsEntityId id, const float range)
set range of light
Definition lightcontext.cc:581
static const Math::quat GetRotation(const Graphics::GraphicsEntityId id)
Get light rotation.
Definition lightcontext.cc:742
static void GetInnerOuterAngle(const Graphics::GraphicsEntityId id, float &inner, float &outer)
get inner and outer angle for spotlights
Definition lightcontext.cc:830
@ SpotLight_DynamicOffsets
Definition lightcontext.h:209
@ SpotLight_ShadowConstantBufferSet
Definition lightcontext.h:208
@ SpotLight_Transform
Definition lightcontext.h:206
@ SpotLight_ProjectionTexture
Definition lightcontext.h:211
@ SpotLight_ConstantBufferSet
Definition lightcontext.h:207
@ SpotLight_ProjectionTransform
Definition lightcontext.h:212
@ SpotLight_Observer
Definition lightcontext.h:213
@ SpotLight_ConeAngles
Definition lightcontext.h:210
static const CoreGraphics::BufferId GetLightsBuffer()
get light lists buffer
Definition lightcontext.cc:984
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:716
static void SetGlobalLightViewProjTransform(const Graphics::ContextEntityId id, const Math::mat4 &transform)
Set global light shadow transform.
Definition lightcontext.cc:1004
LightType
Definition lightcontext.h:29
Ids::IdAllocator< LightType, Math::vec3, float, bool, float, Ids::Id32 > GenericLightAllocator
Definition lightcontext.h:176
Ids::IdAllocator< Math::vector, Math::vec3, float, Math::vec3, Math::mat4, Math::mat4, Util::Array< Graphics::GraphicsEntityId > > DirectionalLightAllocator
Definition lightcontext.h:268
static void SetColor(const Graphics::GraphicsEntityId id, const Math::vec3 &color)
set color of light
Definition lightcontext.cc:561
static Graphics::ContextEntityId Alloc()
allocate a new slice for this context
Definition lightcontext.cc:1301
static const Math::vec3 GetScale(const Graphics::GraphicsEntityId id)
Get light scale.
Definition lightcontext.cc:798
static void SetIntensity(const Graphics::GraphicsEntityId id, const float intensity)
set intensity of light
Definition lightcontext.cc:591
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:844
static const void SetPosition(const Graphics::GraphicsEntityId id, const Math::point &position)
Set light position.
Definition lightcontext.cc:668
static AreaLightAllocator areaLightAllocator
Definition lightcontext.h:248
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:417
static void SetGlobalLightTransform(const Graphics::ContextEntityId id, const Math::mat4 &transform, const Math::vector &direction)
Set global light transform.
Definition lightcontext.cc:993
static DirectionalLightAllocator directionalLightAllocator
Definition lightcontext.h:269
static PointLightAllocator pointLightAllocator
Definition lightcontext.h:202
static void SetTransform(const Graphics::GraphicsEntityId id, const float azimuth, const float zenith)
Set transform as angles.
Definition lightcontext.cc:611
static void OnRenderDebug(uint32_t flags)
render debug
Definition lightcontext.cc:1348
AreaLightShape
Definition lightcontext.h:37
virtual ~LightContext()
destructor
Definition lightcontext.cc:114
@ Range
Definition lightcontext.h:165
@ TypedLightId
Definition lightcontext.h:166
@ Intensity
Definition lightcontext.h:163
@ Type
Definition lightcontext.h:161
@ Color
Definition lightcontext.h:162
@ ShadowCaster
Definition lightcontext.h:164
static Util::HashTable< Graphics::GraphicsEntityId, uint, 16, 1 > shadowCasterSliceMap
Definition lightcontext.h:280
static const Math::mat4 GetObserverTransform(const Graphics::GraphicsEntityId id)
get the view transform including projections
Definition lightcontext.cc:658
static void SetupTerrainShadows(const CoreGraphics::TextureId terrainShadowMap, const uint worldSize)
Setup terrain shadows.
Definition lightcontext.cc:964
Ids::IdAllocator< Math::mat4 > ShadowCasterAllocator
Definition lightcontext.h:278
static SpotLightAllocator spotLightAllocator
Definition lightcontext.h:226
Ids::IdAllocator< Math::transform44, AreaLightShape, ConstantBufferSet, ConstantBufferSet, Util::FixedArray< uint >, bool, Graphics::GraphicsEntityId > AreaLightAllocator
Definition lightcontext.h:247
static GenericLightAllocator genericLightAllocator
Definition lightcontext.h:177
Ids::IdAllocator< Math::transform44, ConstantBufferSet, ConstantBufferSet, Util::FixedArray< uint >, CoreGraphics::TextureId, Graphics::GraphicsEntityId > PointLightAllocator
Definition lightcontext.h:201
static LightType GetType(const Graphics::GraphicsEntityId id)
get the light type
Definition lightcontext.cc:820
static void Create()
setup light context
Definition lightcontext.cc:123
static void Dealloc(Graphics::ContextEntityId id)
deallocate a slice
Definition lightcontext.cc:1310
@ PointLight_Observer
Definition lightcontext.h:191
@ PointLight_Transform
Definition lightcontext.h:186
@ PointLight_ProjectionTexture
Definition lightcontext.h:190
@ PointLight_DynamicOffsets
Definition lightcontext.h:189
@ PointLight_ConstantBufferSet
Definition lightcontext.h:187
@ PointLight_ShadowConstantBufferSet
Definition lightcontext.h:188
@ DirectionalLight_ViewProjTransform
Definition lightcontext.h:257
@ DirectionalLight_Ambient
Definition lightcontext.h:255
@ DirectionalLight_Direction
Definition lightcontext.h:252
@ DirectionalLight_CascadeObservers
Definition lightcontext.h:258
@ DirectionalLight_Transform
Definition lightcontext.h:256
@ DirectionalLight_Backlight
Definition lightcontext.h:253
@ DirectionalLight_BacklightOffset
Definition lightcontext.h:254
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)
Setup entity as area light.
Definition lightcontext.cc:474
static void OnPrepareView(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
prepare light visibility
Definition lightcontext.cc:860
Ids::IdAllocator< Math::transform44, ConstantBufferSet, ConstantBufferSet, Util::FixedArray< uint >, std::array< float, 2 >, CoreGraphics::TextureId, Math::mat4, Graphics::GraphicsEntityId > SpotLightAllocator
Definition lightcontext.h:225
static void UpdateViewDependentResources(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
prepare light lists
Definition lightcontext.cc:1014
static void RunFrameScriptJobs(const Graphics::FrameContext &ctx)
run framescript when visibility is done
@ AreaLight_DynamicOffsets
Definition lightcontext.h:234
@ AreaLight_TwoSided
Definition lightcontext.h:235
@ AreaLight_ConstantBufferSet
Definition lightcontext.h:232
@ AreaLight_Shape
Definition lightcontext.h:231
@ AreaLight_ShadowConstantBufferSet
Definition lightcontext.h:233
@ AreaLight_Transform
Definition lightcontext.h:230
@ AreaLight_Observer
Definition lightcontext.h:236
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:180
uint offset
Definition lightcontext.h:181
uint slice
Definition lightcontext.h:181
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