Files
UnrealEngineUWP/Engine/Source/Editor/ComponentVisualizers/Private/SpotLightComponentVisualizer.cpp
Matthew Griffin bb70b349ce Merging CL 2804086 from //UE4/Release-4.11 to Dev-Main (//UE4/Dev-Main) to isolate copyright update
#lockdown Nick.Penwarden

[CL 2819020 by Matthew Griffin in Main branch]
2016-01-07 08:17:16 -05:00

34 lines
1.4 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "ComponentVisualizersPrivatePCH.h"
#include "SpotLightComponentVisualizer.h"
#include "Components/SpotLightComponent.h"
void FSpotLightComponentVisualizer::DrawVisualization( const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI )
{
if(View->Family->EngineShowFlags.LightRadius)
{
const USpotLightComponent* SpotLightComp = Cast<const USpotLightComponent>(Component);
if(SpotLightComp != NULL)
{
FTransform TransformNoScale = SpotLightComp->ComponentToWorld;
TransformNoScale.RemoveScaling();
// Draw point light source shape
DrawWireCapsule(PDI, TransformNoScale.GetTranslation(), -TransformNoScale.GetUnitAxis( EAxis::Z ), TransformNoScale.GetUnitAxis( EAxis::Y ), TransformNoScale.GetUnitAxis( EAxis::X ),
FColor(231, 239, 0, 255), SpotLightComp->SourceRadius, 0.5f * SpotLightComp->SourceLength + SpotLightComp->SourceRadius, 25, SDPG_World);
// Draw outer light cone
DrawWireSphereCappedCone(PDI, TransformNoScale, SpotLightComp->AttenuationRadius, SpotLightComp->OuterConeAngle, 32, 8, 10, FColor(200, 255, 255), SDPG_World);
// Draw inner light cone (if non zero)
if(SpotLightComp->InnerConeAngle > KINDA_SMALL_NUMBER)
{
DrawWireSphereCappedCone(PDI, TransformNoScale, SpotLightComp->AttenuationRadius, SpotLightComp->InnerConeAngle, 32, 8, 10, FColor(150, 200, 255), SDPG_World);
}
}
}
}