You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
45 lines
2.3 KiB
C++
45 lines
2.3 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "StereoLayerComponentVisualizer.h"
|
|
#include "SceneManagement.h"
|
|
|
|
#include "Components/StereoLayerComponent.h"
|
|
|
|
|
|
void FStereoLayerComponentVisualizer::DrawVisualization( const UActorComponent* Component, const FSceneView* View, FPrimitiveDrawInterface* PDI )
|
|
{
|
|
const UStereoLayerComponent* StereoLayerComp = Cast<const UStereoLayerComponent>(Component);
|
|
if(StereoLayerComp != NULL)
|
|
{
|
|
FLinearColor YellowColor = FColor(231, 239, 0, 255);
|
|
if(StereoLayerComp->StereoLayerShape == EStereoLayerShape::SLSH_QuadLayer)
|
|
{
|
|
const FVector2D QuadSize = StereoLayerComp->GetQuadSize() / 2.0f;
|
|
const FBox QuadBox(FVector(0.0f, -QuadSize.X, -QuadSize.Y), FVector(0.0f, QuadSize.X, QuadSize.Y));
|
|
|
|
DrawWireBox(PDI, StereoLayerComp->GetComponentTransform().ToMatrixWithScale(), QuadBox, YellowColor, 0);
|
|
}
|
|
else if(StereoLayerComp->StereoLayerShape == EStereoLayerShape::SLSH_CylinderLayer)
|
|
{
|
|
float ArcAngle = StereoLayerComp->CylinderOverlayArc * 180 / (StereoLayerComp->CylinderRadius * PI);
|
|
|
|
FVector X = StereoLayerComp->GetComponentTransform().GetUnitAxis(EAxis::Type::X);
|
|
FVector Y = StereoLayerComp->GetComponentTransform().GetUnitAxis(EAxis::Type::Y);
|
|
FVector Base = StereoLayerComp->GetComponentTransform().GetLocation();
|
|
FVector HalfHeight = FVector(0, 0, StereoLayerComp->CylinderHeight/2);
|
|
|
|
FVector LeftVertex = Base + StereoLayerComp->CylinderRadius * ( FMath::Cos(ArcAngle/2 * (PI/180.0f)) * X + FMath::Sin(ArcAngle/2 * (PI/180.0f)) * Y );
|
|
FVector RightVertex = Base + StereoLayerComp->CylinderRadius * ( FMath::Cos(-ArcAngle/2 * (PI/180.0f)) * X + FMath::Sin(-ArcAngle/2 * (PI/180.0f)) * Y );
|
|
|
|
DrawArc(PDI, Base + HalfHeight, X, Y, -ArcAngle/2, ArcAngle/2, StereoLayerComp->CylinderRadius, 10, YellowColor, 0);
|
|
|
|
DrawArc(PDI, Base - HalfHeight, X, Y, -ArcAngle/2, ArcAngle/2, StereoLayerComp->CylinderRadius, 10, YellowColor, 0);
|
|
|
|
PDI->DrawLine( LeftVertex - HalfHeight, LeftVertex + HalfHeight, YellowColor, 0 );
|
|
|
|
PDI->DrawLine( RightVertex - HalfHeight, RightVertex + HalfHeight, YellowColor, 0 );
|
|
|
|
}
|
|
}
|
|
}
|