Skip to content
Snippets Groups Projects
Commit 631651a3 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Adding more debug output

parent 054a75e6
No related branches found
No related tags found
1 merge request!4Develop
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "CAVEOverlayController.h" #include "CAVEOverlayController.h"
//DEFINE_LOG_CATEGORY(CAVEOverlayLog); DEFINE_LOG_CATEGORY(CAVEOverlayLog);
template<std::size_t SIZE> bool containsFString(const std::array<FString, SIZE> &a, const FString &s) { template<std::size_t SIZE> bool containsFString(const std::array<FString, SIZE> &a, const FString &s) {
for (FString cs : a) { for (FString cs : a) {
...@@ -24,7 +24,7 @@ UStaticMeshComponent* ACAVEOverlayController::createMeshComponent(const FName &n ...@@ -24,7 +24,7 @@ UStaticMeshComponent* ACAVEOverlayController::createMeshComponent(const FName &n
template<typename T> bool loadAsset(const FString &path, T* &result) { template<typename T> bool loadAsset(const FString &path, T* &result) {
ConstructorHelpers::FObjectFinder<T> loader(*path); ConstructorHelpers::FObjectFinder<T> loader(*path);
result = loader.Object; result = loader.Object;
//if(!loader.Succeeded()) UE_LOG(CAVEOverlayLog, Error, TEXT("Could not find %s. Have you renamed it?"), *path); if(!loader.Succeeded()) UE_LOG(CAVEOverlayLog, Error, TEXT("Could not find %s. Have you renamed it?"), *path);
return loader.Succeeded(); return loader.Succeeded();
} }
...@@ -40,7 +40,7 @@ ACAVEOverlayController::ACAVEOverlayController() ...@@ -40,7 +40,7 @@ ACAVEOverlayController::ACAVEOverlayController()
if (WidgetClassFinder.Succeeded()) { if (WidgetClassFinder.Succeeded()) {
overlay_class_ = WidgetClassFinder.Class; overlay_class_ = WidgetClassFinder.Class;
} else { } else {
//UE_LOG(CAVEOverlayLog, Error, TEXT("Could not find the DoorOverlay class. Have you renamed it?")); UE_LOG(CAVEOverlayLog, Error, TEXT("Could not find the DoorOverlay class. Have you renamed it?"));
} }
//Creation of subcomponents //Creation of subcomponents
...@@ -56,8 +56,8 @@ ACAVEOverlayController::ACAVEOverlayController() ...@@ -56,8 +56,8 @@ ACAVEOverlayController::ACAVEOverlayController()
loadAsset("/CAVEOverlay/StopMaterial", sign_material_); loadAsset("/CAVEOverlay/StopMaterial", sign_material_);
loadAsset("/CAVEOverlay/Plane", plane_mesh_); loadAsset("/CAVEOverlay/Plane", plane_mesh_);
tape_material_dynamic_ = UMaterialInstanceDynamic::Create(tape_material_, tape_root); tape_material_dynamic_ = UMaterialInstanceDynamic::Create(tape_material_, NULL);
sign_material_dynamic_ = UMaterialInstanceDynamic::Create(sign_material_, sign_root); sign_material_dynamic_ = UMaterialInstanceDynamic::Create(sign_material_, NULL);
tape_negative_y = createMeshComponent("TapeNegY", tape_material_dynamic_, plane_mesh_, tape_root); tape_negative_y = createMeshComponent("TapeNegY", tape_material_dynamic_, plane_mesh_, tape_root);
tape_negative_x = createMeshComponent("TapeNegX", tape_material_dynamic_, plane_mesh_, tape_root); tape_negative_x = createMeshComponent("TapeNegX", tape_material_dynamic_, plane_mesh_, tape_root);
...@@ -125,7 +125,7 @@ void ACAVEOverlayController::SetDoorMode(DOOR_MODE m) ...@@ -125,7 +125,7 @@ void ACAVEOverlayController::SetDoorMode(DOOR_MODE m)
} }
if (screen_type_ == SCREEN_NORMAL) overlay_->BlackBox->SetRenderScale(FVector2D(0, 1)); //no overlay if (screen_type_ == SCREEN_NORMAL) overlay_->BlackBox->SetRenderScale(FVector2D(0, 1)); //no overlay
//UE_LOG(CAVEOverlayLog, Log, TEXT("Switched door state to '%s'. New opening width is %f."), *door_mode_names_[door_current_mode_], door_current_opening_width_absolute_); UE_LOG(CAVEOverlayLog, Log, TEXT("Switched door state to '%s'. New opening width is %f."), *door_mode_names_[door_current_mode_], door_current_opening_width_absolute_);
overlay_->CornerText->SetText(FText::FromString(door_mode_names_[door_current_mode_])); overlay_->CornerText->SetText(FText::FromString(door_mode_names_[door_current_mode_]));
} }
...@@ -207,13 +207,16 @@ void ACAVEOverlayController::Tick(float DeltaTime) ...@@ -207,13 +207,16 @@ void ACAVEOverlayController::Tick(float DeltaTime)
tape_root->SetRelativeLocation(shutter_position * FVector(0, 0, 1)); //Only apply Z tape_root->SetRelativeLocation(shutter_position * FVector(0, 0, 1)); //Only apply Z
float tape_opacity = calculateOpacityFromPosition(shutter_position); float tape_opacity = calculateOpacityFromPosition(shutter_position);
tape_material_dynamic_->SetScalarParameterValue(FName("BarrierOpacity"), tape_opacity); tape_material_dynamic_->SetScalarParameterValue("BarrierOpacity", tape_opacity);
UE_LOG(CAVEOverlayLog, Log, TEXT("Flystick %p, pos (%f,%f,%f), opacity %f"), shutter_glasses_, shutter_position.X, shutter_position.Y, shutter_position.Z, tape_opacity);
UE_LOG(CAVEOverlayLog, Log, TEXT("TapeMaterial %p"), tape_material_dynamic_);
if (FMath::IsWithin(FVector2D(shutter_position).GetAbsMax(), wall_distance_ - wall_warning_distance_, wall_distance_)) { //in warning distance == red tape if (FMath::IsWithin(FVector2D(shutter_position).GetAbsMax(), wall_distance_ - wall_warning_distance_, wall_distance_)) { //in warning distance == red tape
tape_material_dynamic_->SetVectorParameterValue(FName("StripeColor"), FVector(1, 0, 0)); tape_material_dynamic_->SetVectorParameterValue("StripeColor", FVector(1, 0, 0));
} }
else { else {
tape_material_dynamic_->SetVectorParameterValue(FName("StripeColor"), FVector(1, 1, 0)); tape_material_dynamic_->SetVectorParameterValue("StripeColor", FVector(1, 1, 0));
} }
} else { } else {
tape_root->SetVisibility(false, true); tape_root->SetVisibility(false, true);
...@@ -236,7 +239,10 @@ void ACAVEOverlayController::Tick(float DeltaTime) ...@@ -236,7 +239,10 @@ void ACAVEOverlayController::Tick(float DeltaTime)
sign_positive_x->SetVisibility(FMath::IsWithin(+flystick_position.X, wall_distance_ - wall_close_distance_, wall_distance_) && !flystick_in_door); sign_positive_x->SetVisibility(FMath::IsWithin(+flystick_position.X, wall_distance_ - wall_close_distance_, wall_distance_) && !flystick_in_door);
sign_positive_y->SetVisibility(FMath::IsWithin(+flystick_position.Y, wall_distance_ - wall_close_distance_, wall_distance_) && !flystick_in_door); sign_positive_y->SetVisibility(FMath::IsWithin(+flystick_position.Y, wall_distance_ - wall_close_distance_, wall_distance_) && !flystick_in_door);
sign_material_dynamic_->SetScalarParameterValue(FName("SignOpacity"), sign_opacity); UE_LOG(CAVEOverlayLog, Log, TEXT("Flystick %p, pos (%f,%f,%f), inDoor %d, opacity %f"), flystick, flystick_position.X, flystick_position.Y, flystick_position.Z, flystick_in_door, sign_opacity);
UE_LOG(CAVEOverlayLog, Log, TEXT("SignMaterial %p"), sign_material_dynamic_);
sign_material_dynamic_->SetScalarParameterValue("SignOpacity", sign_opacity);
} else { } else {
sign_negative_x->SetVisibility(false); sign_negative_x->SetVisibility(false);
sign_negative_y->SetVisibility(false); sign_negative_y->SetVisibility(false);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "DisplayCluster/Public/DisplayClusterSceneComponent.h" #include "DisplayCluster/Public/DisplayClusterSceneComponent.h"
#include "CAVEOverlayController.generated.h" #include "CAVEOverlayController.generated.h"
//DECLARE_LOG_CATEGORY_EXTERN(CAVEOverlayLog, Log, All); DECLARE_LOG_CATEGORY_EXTERN(CAVEOverlayLog, Log, All);
UCLASS() UCLASS()
class CAVEOVERLAY_API ACAVEOverlayController : public AActor class CAVEOVERLAY_API ACAVEOverlayController : public AActor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment