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

Method DrawLightsDebug

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

Source from the content-addressed store, hash-verified

223}
224
225void SpotLight::DrawLightsDebug(RenderView& view)
226{
227 const BoundingSphere sphere(_sphere.Center - view.Origin, _sphere.Radius);
228 if (!view.CullingFrustum.Intersects(sphere) || !EnumHasAnyFlags(view.Flags, ViewFlags::SpotLights))
229 return;
230
231 const auto color = Color::Yellow;
232 Vector3 right = _transform.GetRight();
233 Vector3 up = _transform.GetUp();
234 Vector3 forward = GetDirection();
235 float radius = GetScaledRadius();
236 float discRadius = radius * Math::Tan(_outerConeAngle * DegreesToRadians);
237 float falloffDiscRadius = radius * Math::Tan(_innerConeAngle * DegreesToRadians);
238 Vector3 position = GetPosition();
239
240 DEBUG_DRAW_LINE(position, position + forward * radius + up * discRadius, color, 0, true);
241 DEBUG_DRAW_LINE(position, position + forward * radius - up * discRadius, color, 0, true);
242 DEBUG_DRAW_LINE(position, position + forward * radius + right * discRadius, color, 0, true);
243 DEBUG_DRAW_LINE(position, position + forward * radius - right * discRadius, color, 0, true);
244
245 DEBUG_DRAW_LINE(position, position + forward * radius + up * falloffDiscRadius, color * 0.6f, 0, true);
246 DEBUG_DRAW_LINE(position, position + forward * radius - up * falloffDiscRadius, color * 0.6f, 0, true);
247 DEBUG_DRAW_LINE(position, position + forward * radius + right * falloffDiscRadius, color * 0.6f, 0, true);
248 DEBUG_DRAW_LINE(position, position + forward * radius - right * falloffDiscRadius, color * 0.6f, 0, true);
249
250 DEBUG_DRAW_CIRCLE(position + forward * radius, forward, discRadius, color, 0, true);
251 DEBUG_DRAW_CIRCLE(position + forward * radius, forward, falloffDiscRadius, color * 0.6f, 0, true);
252}
253#endif
254
255void SpotLight::Serialize(SerializeStream& stream, const void* otherObj)

Callers

nothing calls this directly

Calls 7

EnumHasAnyFlagsFunction · 0.85
GetDirectionFunction · 0.85
GetRightMethod · 0.80
GetUpMethod · 0.80
TanFunction · 0.50
GetPositionFunction · 0.50
IntersectsMethod · 0.45

Tested by

no test coverage detected