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

Removed debug output, setup input the right way, fixed appearing text on all...

Removed debug output, setup input the right way, fixed appearing text on all windows + little refactorings
parent c208932d
Branches
Tags
1 merge request!4Develop
......@@ -116,7 +116,7 @@ void ACAVEOverlayController::CycleDoorType()
void ACAVEOverlayController::SetDoorMode(DOOR_MODE m)
{
switch (door_current_mode_) {
case DOOR_MODE::DOOR_PARTIAL_OPEN:
case DOOR_MODE::DOOR_PARTIALLY_OPEN:
door_current_opening_width_absolute_ = door_opening_width_absolute_;
if (screen_type_ == SCREEN_DOOR) overlay_->BlackBox->SetRenderScale(FVector2D(0, 1));
if (screen_type_ == SCREEN_DOOR_PARTIAL) overlay_->BlackBox->SetRenderScale(FVector2D(door_opening_width_relative_, 1));
......@@ -141,7 +141,10 @@ void ACAVEOverlayController::SetDoorMode(DOOR_MODE m)
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_);
overlay_->CornerText->SetText(FText::FromString(door_mode_names_[door_current_mode_]));
if (screen_type_ == SCREEN_MASTER) {
overlay_->CornerText->SetText(FText::FromString(door_mode_names_[door_current_mode_]));
}
}
// Called when the game starts or when spawned
......@@ -155,11 +158,10 @@ void ACAVEOverlayController::BeginPlay()
if (!display_cluster_mode_) return; // Not our business
//Actor config
InputComponent->BindAction("nDisplayButton4", EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
InputComponent->BindAction("Action3", EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
InputComponent->BindKey(EKeys::F10, EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
InputComponent->BindKey(FKey("nDisplayButton2"), EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
//Input config
InputComponent->BindKey(FKey("nDisplayButton4"), EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
//
//InputComponent->BindKey(EKeys::F10, EInputEvent::IE_Pressed, this, &ACAVEOverlayController::CycleDoorType);
//Determine the screentype for later usage
if (IDisplayCluster::Get().GetClusterMgr()->GetNodeId().Equals(screen_main, ESearchCase::IgnoreCase)) {
......@@ -186,7 +188,6 @@ void ACAVEOverlayController::BeginPlay()
if (!attached_ && cave_origin_) {
AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
attached_ = true;
UE_LOG(CAVEOverlayLog, Log, TEXT("Attached to CaveOrigin"));
}
}
......@@ -222,7 +223,6 @@ void ACAVEOverlayController::Tick(float DeltaTime)
if (!attached_ && cave_origin_) {
AttachToComponent(cave_origin_, FAttachmentTransformRules::SnapToTargetNotIncludingScale);
attached_ = true;
UE_LOG(CAVEOverlayLog, Log, TEXT("Attached to CaveOrigin"));
}
if (!shutter_glasses_) return; //Display Cluster not initialized
......@@ -236,16 +236,11 @@ void ACAVEOverlayController::Tick(float DeltaTime)
tape_root->SetRelativeLocation(shutter_position * FVector(0, 0, 1)); //Only apply Z
float tape_opacity = calculateOpacityFromPosition(shutter_position);
UE_LOG(CAVEOverlayLog, Log, TEXT("Glasses %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_);
tape_material_dynamic_->SetScalarParameterValue("BarrierOpacity", tape_opacity);
if (FMath::IsWithin(FVector2D(shutter_position).GetAbsMax(), wall_distance_ - wall_warning_distance_, wall_distance_)) { //in warning distance == red tape
tape_material_dynamic_->SetVectorParameterValue("StripeColor", FVector(1, 0, 0));
}
else {
} else {
tape_material_dynamic_->SetVectorParameterValue("StripeColor", FVector(1, 1, 0));
}
} else {
......@@ -269,9 +264,6 @@ 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_y->SetVisibility(FMath::IsWithin(+flystick_position.Y, wall_distance_ - wall_close_distance_, wall_distance_) && !flystick_in_door);
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 {
sign_negative_x->SetVisibility(false);
......
......@@ -49,9 +49,9 @@ private:
const FString screen_main = "node_main";
//Door Mode
enum DOOR_MODE { DOOR_CLOSED = 0, DOOR_OPEN = 1, DOOR_PARTIAL_OPEN = 2, DOOR_NUM_MODES = 3};
const FString door_mode_names_[DOOR_NUM_MODES] = {"Partial Open", "Closed", "Open" };
DOOR_MODE door_current_mode_ = DOOR_PARTIAL_OPEN;
enum DOOR_MODE { DOOR_CLOSED = 0, DOOR_OPEN = 1, DOOR_PARTIALLY_OPEN = 2, DOOR_NUM_MODES = 3};
const FString door_mode_names_[DOOR_NUM_MODES] = {"Closed", "Open", "Partially Open" };
DOOR_MODE door_current_mode_ = DOOR_PARTIALLY_OPEN;
const float door_opening_width_relative_ = 0.522; //%, used for the overlay width on the screen
const float door_opening_width_absolute_ = 165; //cm, used for the non tape part at the door
const float wall_distance_ = 262.5; //cm, distance from center to a wall, *2 = wall width
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment