Skip to content
Snippets Groups Projects
Commit 25a55854 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

- removed unneeded validate check in trace

- added on scene changed broadcasts back in, not complete yet
- fixed UI not rotating to correct head position
parent 66288e26
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
...@@ -103,18 +103,6 @@ void FOptiXContextManager::PreRenderViewFamily_RenderThread(FRHICommandListImmed ...@@ -103,18 +103,6 @@ void FOptiXContextManager::PreRenderViewFamily_RenderThread(FRHICommandListImmed
ParseUpdateQueue(RHICmdList); ParseUpdateQueue(RHICmdList);
ParseCubemapUpdateQueue(RHICmdList); ParseCubemapUpdateQueue(RHICmdList);
try
{
NativeContext->validate();
}
catch (optix::Exception& E)
{
FString Message = FString(E.getErrorString().c_str());
UE_LOG(OptiXContextManagerLog, Error, TEXT("OptiX Error: %s"), *Message);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("OptiX Error %s"), *Message));
}
// launch the laser trace if needed (todo) // launch the laser trace if needed (todo)
LaunchLaser(RHICmdList); LaunchLaser(RHICmdList);
} }
...@@ -249,7 +237,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate ...@@ -249,7 +237,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList) void FOptiXContextManager::LaunchLaser(FRHICommandListImmediate & RHICmdList)
{ {
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::LaunchLaser")) TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("FOptiXContextManager::LaunchLaser"))
if (/*bSceneChanged && */ bIsInitializedLaser && !CVarDisableLaserTrace.GetValueOnRenderThread()) if (bSceneChanged && bIsInitializedLaser && !CVarDisableLaserTrace.GetValueOnRenderThread())
{ {
// Analyze this // Analyze this
......
...@@ -150,6 +150,7 @@ void UOptiXLaserComponent::BeginPlay() ...@@ -150,6 +150,7 @@ void UOptiXLaserComponent::BeginPlay()
SetWavelength(Wavelength); SetWavelength(Wavelength);
SetLaserWidth(LaserWidth); SetLaserWidth(LaserWidth);
FOptiXModule::Get().GetOptiXContextManager()->OnSceneChangedDelegate.Broadcast();
//FOptiXModule::Get().GetOptiXContextManager()->bIsInitializedLaser.AtomicSet(true); //FOptiXModule::Get().GetOptiXContextManager()->bIsInitializedLaser.AtomicSet(true);
} }
......
...@@ -33,6 +33,7 @@ void UOptiXObjectComponent::BeginPlay() ...@@ -33,6 +33,7 @@ void UOptiXObjectComponent::BeginPlay()
UE_LOG(LogTemp, Display, TEXT("OptiX Component BeginPlay")); UE_LOG(LogTemp, Display, TEXT("OptiX Component BeginPlay"));
bWantsOnUpdateTransform = true; bWantsOnUpdateTransform = true;
FOptiXModule::Get().GetOptiXContextManager()->OnSceneChangedDelegate.Broadcast();
} }
void UOptiXObjectComponent::EndPlay(const EEndPlayReason::Type EndPlayReason) void UOptiXObjectComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
...@@ -160,6 +161,7 @@ void UOptiXCubemapComponent::BeginPlay() ...@@ -160,6 +161,7 @@ void UOptiXCubemapComponent::BeginPlay()
//QueueOptiXContextUpdate(); //QueueOptiXContextUpdate();
bWantsOnUpdateTransform = true; bWantsOnUpdateTransform = true;
FOptiXModule::Get().GetOptiXContextManager()->OnSceneChangedDelegate.Broadcast();
} }
void UOptiXCubemapComponent::EndPlay(const EEndPlayReason::Type EndPlayReason) void UOptiXCubemapComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
......
...@@ -15,14 +15,13 @@ AOptiXVRPawn::AOptiXVRPawn() ...@@ -15,14 +15,13 @@ AOptiXVRPawn::AOptiXVRPawn()
{ {
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it. // Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true; PrimaryActorTick.bCanEverTick = true;
} }
// Called when the game starts or when spawned // Called when the game starts or when spawned
void AOptiXVRPawn::BeginPlay() void AOptiXVRPawn::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
//HMDLocation = UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetViewTarget()->GetActorLocation();
} }
// Called every frame // Called every frame
...@@ -38,7 +37,6 @@ void AOptiXVRPawn::Tick(float DeltaTime) ...@@ -38,7 +37,6 @@ void AOptiXVRPawn::Tick(float DeltaTime)
void AOptiXVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) void AOptiXVRPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{ {
Super::SetupPlayerInputComponent(PlayerInputComponent); Super::SetupPlayerInputComponent(PlayerInputComponent);
} }
void AOptiXVRPawn::UpdateTranslation(UPrimitiveComponent* Interaction) void AOptiXVRPawn::UpdateTranslation(UPrimitiveComponent* Interaction)
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "Blueprint/UserWidget.h" #include "Blueprint/UserWidget.h"
#include "Runtime/Engine/Classes/Materials/MaterialInstanceDynamic.h" #include "Runtime/Engine/Classes/Materials/MaterialInstanceDynamic.h"
#include "OptiXVRPawn.h"
#include "StatsDefines.h" #include "StatsDefines.h"
ASelectableActorBase::ASelectableActorBase(const FObjectInitializer& ObjectInitializer) ASelectableActorBase::ASelectableActorBase(const FObjectInitializer& ObjectInitializer)
...@@ -348,6 +347,8 @@ void ASelectableActorBase::BeginPlay() ...@@ -348,6 +347,8 @@ void ASelectableActorBase::BeginPlay()
{ {
Super::BeginPlay(); Super::BeginPlay();
OptiXVRPawn = Cast<AOptiXVRPawn>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
ArrowX->CreateAndSetMaterialInstanceDynamicFromMaterial(0, ArrowX->GetMaterial(0)); ArrowX->CreateAndSetMaterialInstanceDynamicFromMaterial(0, ArrowX->GetMaterial(0));
ArrowX->CreateAndSetMaterialInstanceDynamicFromMaterial(1, ArrowX->GetMaterial(1)); ArrowX->CreateAndSetMaterialInstanceDynamicFromMaterial(1, ArrowX->GetMaterial(1));
ArrowY->CreateAndSetMaterialInstanceDynamicFromMaterial(0, ArrowY->GetMaterial(0)); ArrowY->CreateAndSetMaterialInstanceDynamicFromMaterial(0, ArrowY->GetMaterial(0));
...@@ -380,8 +381,8 @@ void ASelectableActorBase::Tick(float DeltaTime) ...@@ -380,8 +381,8 @@ void ASelectableActorBase::Tick(float DeltaTime)
Super::Tick(DeltaTime); Super::Tick(DeltaTime);
TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("ASelectableActorBase::Tick")) TRACE_CPUPROFILER_EVENT_SCOPE(TEXT("ASelectableActorBase::Tick"))
//FVector PlayerLocation = UGameplayStatics::GetPlayerPawn(GetWorld(), 0)->GetActorLocation();
FVector PlayerLocation = UGameplayStatics::GetPlayerPawn(GetWorld(), 0)->GetActorLocation(); FVector PlayerLocation = OptiXVRPawn->HMDLocation;
{ {
FVector Diff = PlayerLocation - DegreeWidgetV->GetComponentTransform().GetLocation(); FVector Diff = PlayerLocation - DegreeWidgetV->GetComponentTransform().GetLocation();
FVector Projected = FVector::VectorPlaneProject(Diff, FVector(0, 0, 1)); FVector Projected = FVector::VectorPlaneProject(Diff, FVector(0, 0, 1));
...@@ -436,7 +437,6 @@ void ASelectableActorBase::EnableTranslation() ...@@ -436,7 +437,6 @@ void ASelectableActorBase::EnableTranslation()
ArrowY->SetGenerateOverlapEvents(true); ArrowY->SetGenerateOverlapEvents(true);
ArrowZ->SetGenerateOverlapEvents(true); ArrowZ->SetGenerateOverlapEvents(true);
AOptiXVRPawn* OptiXVRPawn = Cast<AOptiXVRPawn>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
if (OptiXVRPawn) if (OptiXVRPawn)
{ {
OptiXVRPawn->UIEventTranslation(); OptiXVRPawn->UIEventTranslation();
...@@ -455,7 +455,6 @@ void ASelectableActorBase::EnableRotation() ...@@ -455,7 +455,6 @@ void ASelectableActorBase::EnableRotation()
ArrowY->SetGenerateOverlapEvents(false); ArrowY->SetGenerateOverlapEvents(false);
ArrowZ->SetGenerateOverlapEvents(false); ArrowZ->SetGenerateOverlapEvents(false);
AOptiXVRPawn* OptiXVRPawn = Cast<AOptiXVRPawn>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
if (OptiXVRPawn) if (OptiXVRPawn)
{ {
OptiXVRPawn->UIEventRotation(); OptiXVRPawn->UIEventRotation();
...@@ -464,7 +463,6 @@ void ASelectableActorBase::EnableRotation() ...@@ -464,7 +463,6 @@ void ASelectableActorBase::EnableRotation()
void ASelectableActorBase::DeselectActor() void ASelectableActorBase::DeselectActor()
{ {
AOptiXVRPawn* OptiXVRPawn = Cast<AOptiXVRPawn>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
if (OptiXVRPawn) if (OptiXVRPawn)
{ {
OptiXVRPawn->UIEventDeselect(); OptiXVRPawn->UIEventDeselect();
...@@ -474,7 +472,6 @@ void ASelectableActorBase::DeselectActor() ...@@ -474,7 +472,6 @@ void ASelectableActorBase::DeselectActor()
void ASelectableActorBase::DeleteActor() void ASelectableActorBase::DeleteActor()
{ {
AOptiXVRPawn* OptiXVRPawn = Cast<AOptiXVRPawn>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
if (OptiXVRPawn) if (OptiXVRPawn)
{ {
OptiXVRPawn->UIEventDelete(); OptiXVRPawn->UIEventDelete();
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "GameFramework/Pawn.h" #include "GameFramework/Pawn.h"
#include "Components/SceneCaptureComponent2D.h" #include "Components/SceneCaptureComponent2D.h"
#include "Camera/CameraComponent.h"
#include "OptiXVRPawn.generated.h" #include "OptiXVRPawn.generated.h"
...@@ -84,4 +86,8 @@ public: ...@@ -84,4 +86,8 @@ public:
UPROPERTY(BlueprintReadWrite, EditAnywhere) UPROPERTY(BlueprintReadWrite, EditAnywhere)
float Damping = 0.1f; float Damping = 0.1f;
// Hacky but who cares, BP write into this
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FVector HMDLocation;
}; };
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "Engine/StaticMeshActor.h" #include "Engine/StaticMeshActor.h"
#include "Components/WidgetComponent.h" #include "Components/WidgetComponent.h"
#include "OptiXVRPawn.h"
#include "SelectableActorBase.generated.h" #include "SelectableActorBase.generated.h"
...@@ -67,6 +68,9 @@ public: ...@@ -67,6 +68,9 @@ public:
public: public:
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
AOptiXVRPawn* OptiXVRPawn;
UPROPERTY(BlueprintReadWrite, EditAnywhere) UPROPERTY(BlueprintReadWrite, EditAnywhere)
USceneComponent* Gizmo; USceneComponent* Gizmo;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment