refactor the debug gizmo draw method
This commit is contained in:
@@ -117,11 +117,11 @@ USGWristTrackerComponent::USGWristTrackerComponent(const FObjectInitializer& Obj
|
|||||||
bOverridePluginWristTrackingDebugSettings = false;
|
bOverridePluginWristTrackingDebugSettings = false;
|
||||||
bDrawWristTrackerDebugGizmo = false;
|
bDrawWristTrackerDebugGizmo = false;
|
||||||
WristTrackerDebugGizmoSettings = FSGDebugGizmoSettings(
|
WristTrackerDebugGizmoSettings = FSGDebugGizmoSettings(
|
||||||
4.0f, 1.0f,
|
4.0f, 1.0f,
|
||||||
FColor(1.0f, 0.0f, 0.0f, 1.0f),
|
FColor(1.0f, 0.0f, 0.0f, 1.0f),
|
||||||
FColor(0.0f, 1.0f, 0.0f, 1.0f),
|
FColor(0.0f, 1.0f, 0.0f, 1.0f),
|
||||||
FColor(0.0f, 0.0f, 1.0f, 1.0f),
|
FColor(0.0f, 0.0f, 1.0f, 1.0f),
|
||||||
false, 1.1f, 0
|
false, 1.1f, 0
|
||||||
);
|
);
|
||||||
bDrawWristTrackerDebugGizmo = false;
|
bDrawWristTrackerDebugGizmo = false;
|
||||||
|
|
||||||
@@ -539,11 +539,7 @@ void USGWristTrackerComponent::FImpl::DrawDebugGizmo()
|
|||||||
const FRotator& Rotation{Owner->GetComponentRotation()};
|
const FRotator& Rotation{Owner->GetComponentRotation()};
|
||||||
const FSGDebugGizmoSettings& DebugGizmoSettings{Owner->GetWristTrackerDebugGizmoSettings()};
|
const FSGDebugGizmoSettings& DebugGizmoSettings{Owner->GetWristTrackerDebugGizmoSettings()};
|
||||||
|
|
||||||
FSGDebugGizmo::Draw(
|
FSGDebugGizmo::Draw(World, Location, Rotation, DebugGizmoSettings);
|
||||||
World, Location, Rotation,
|
|
||||||
DebugGizmoSettings.Length, DebugGizmoSettings.Thickness,
|
|
||||||
DebugGizmoSettings.XAxisColor, DebugGizmoSettings.YAxisColor, DebugGizmoSettings.ZAxisColor,
|
|
||||||
DebugGizmoSettings.bPersistentLines, DebugGizmoSettings.LifeTimeModifier, DebugGizmoSettings.DepthPriority);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void USGWristTrackerComponent::FImplDeleter::operator()(const FImpl* P) const
|
void USGWristTrackerComponent::FImplDeleter::operator()(const FImpl* P) const
|
||||||
|
|||||||
@@ -41,23 +41,20 @@
|
|||||||
#include "Math/Rotator.h"
|
#include "Math/Rotator.h"
|
||||||
#include "Math/Vector.h"
|
#include "Math/Vector.h"
|
||||||
|
|
||||||
#include "SGLog/SGLog.h"
|
void FSGDebugGizmo::Draw(const UWorld* World, const FVector& Location, const FRotator& Rotation,
|
||||||
|
const FSGDebugGizmoSettings& Settings)
|
||||||
void FSGDebugGizmo::Draw(
|
|
||||||
const UWorld* World,
|
|
||||||
const FVector& Location, const FRotator& Rotation,
|
|
||||||
const float Length, const float Thickness,
|
|
||||||
const FColor& XAxisColor, const FColor& YAxisColor, const FColor& ZAxisColor,
|
|
||||||
const bool bPersistentLines, const float LifeTimeModifier, const uint8 DepthPriority)
|
|
||||||
{
|
{
|
||||||
const float LifeTime = UGameplayStatics::GetWorldDeltaSeconds(World) * LifeTimeModifier;
|
const float LifeTime = UGameplayStatics::GetWorldDeltaSeconds(World) * Settings.LifeTimeModifier;
|
||||||
|
|
||||||
const FVector XAxisLineEnd(Location + Rotation.RotateVector(FVector(Length, 0.0f, 0.0f)));
|
const FVector XAxisLineEnd(Location + Rotation.RotateVector(FVector(Settings.Length, 0.0f, 0.0f)));
|
||||||
DrawDebugLine(World, Location, XAxisLineEnd, XAxisColor, bPersistentLines, LifeTime, DepthPriority, Thickness);
|
DrawDebugLine(World, Location, XAxisLineEnd,
|
||||||
|
Settings.XAxisColor, Settings.bPersistentLines, LifeTime, Settings.DepthPriority, Settings.Thickness);
|
||||||
|
|
||||||
const FVector YAxisLineEnd(Location + Rotation.RotateVector(FVector{0.0f, Length, 0.0f}));
|
const FVector YAxisLineEnd(Location + Rotation.RotateVector(FVector{0.0f, Settings.Length, 0.0f}));
|
||||||
DrawDebugLine(World, Location, YAxisLineEnd, YAxisColor, bPersistentLines, LifeTime, DepthPriority, Thickness);
|
DrawDebugLine(World, Location, YAxisLineEnd,
|
||||||
|
Settings.YAxisColor, Settings.bPersistentLines, LifeTime, Settings.DepthPriority, Settings.Thickness);
|
||||||
|
|
||||||
const FVector ZAxisLineEnd{Location + Rotation.RotateVector(FVector{0.0f, 0.0f, Length})};
|
const FVector ZAxisLineEnd{Location + Rotation.RotateVector(FVector{0.0f, 0.0f, Settings.Length})};
|
||||||
DrawDebugLine(World, Location, ZAxisLineEnd, ZAxisColor, bPersistentLines, LifeTime, DepthPriority, Thickness);
|
DrawDebugLine(World, Location, ZAxisLineEnd,
|
||||||
|
Settings.ZAxisColor, Settings.bPersistentLines, LifeTime, Settings.DepthPriority, Settings.Thickness);
|
||||||
}
|
}
|
||||||
@@ -35,20 +35,15 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "SGSettings/SGDebugGizmoSettings.h"
|
||||||
|
|
||||||
class SENSEGLOVEDEBUG_API FSGDebugGizmo final
|
class SENSEGLOVEDEBUG_API FSGDebugGizmo final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Draw(
|
static void Draw(
|
||||||
const UWorld* World,
|
const UWorld* World,
|
||||||
const FVector& Location, const FRotator& Rotation,
|
const FVector& Location, const FRotator& Rotation,
|
||||||
float Length = 1.0f,
|
const FSGDebugGizmoSettings& Settings);
|
||||||
float Thickness = 1.0f,
|
|
||||||
const FColor& XAxisColor = FColor(1.0f, 0.0f, 0.0f, 1.0f),
|
|
||||||
const FColor& YAxisColor = FColor(0.0f, 1.0f, 0.0f, 1.0f),
|
|
||||||
const FColor& ZAxisColor = FColor(0.0f, 0.0f, 1.0f, 1.0f),
|
|
||||||
bool bPersistentLines = false,
|
|
||||||
float LifeTimeModifier = 1.1f,
|
|
||||||
uint8 DepthPriority = 0);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FSGDebugGizmo() = delete;
|
FSGDebugGizmo() = delete;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ public class SenseGloveDebug : ModuleRules
|
|||||||
"CoreUObject",
|
"CoreUObject",
|
||||||
"Engine",
|
"Engine",
|
||||||
"SenseGloveLog",
|
"SenseGloveLog",
|
||||||
|
"SenseGloveSettings",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user