MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / SpotLight

Method SpotLight

Source/Engine/Level/Actors/SpotLight.cpp:14–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12#include "Engine/Level/Scene/SceneRendering.h"
13
14SpotLight::SpotLight(const SpawnParams& params)
15 : LightWithShadow(params)
16 , _radius(1000.0f)
17 , _outerConeAngle(43.0f)
18 , _innerConeAngle(10.0f)
19{
20 CastVolumetricShadow = false;
21 ShadowsDistance = 2000.0f;
22 ShadowsFadeDistance = 100.0f;
23 ShadowsDepthBias = 0.5f;
24
25 _direction = Vector3::Forward;
26 _cosOuterCone = Math::Cos(_outerConeAngle * DegreesToRadians);
27 _cosInnerCone = Math::Cos(_innerConeAngle * DegreesToRadians);
28 _invCosConeDifference = 1.0f / (_cosInnerCone - _cosOuterCone);
29 const float boundsRadius = Math::Sqrt(1.25f * _radius * _radius - _radius * _radius * _cosOuterCone);
30 _sphere = BoundingSphere(GetPosition() + 0.5f * GetDirection() * _radius, boundsRadius);
31 BoundingBox::FromSphere(_sphere, _box);
32}
33
34float SpotLight::ComputeBrightness() const
35{

Callers

nothing calls this directly

Calls 5

GetDirectionFunction · 0.85
CosFunction · 0.50
SqrtFunction · 0.50
BoundingSphereClass · 0.50
GetPositionFunction · 0.50

Tested by

no test coverage detected