| 223 | } |
| 224 | |
| 225 | void 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 | |
| 255 | void SpotLight::Serialize(SerializeStream& stream, const void* otherObj) |
nothing calls this directly
no test coverage detected