Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Cave Overlay Plugin
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
Cave Overlay Plugin
Commits
8209a767
Commit
8209a767
authored
5 years ago
by
Sebastian Pape
Browse files
Options
Downloads
Patches
Plain Diff
Constant reference updating
parent
8999b74d
No related branches found
No related tags found
1 merge request
!4
Develop
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/CAVEOverlay/Private/CAVEOverlayController.cpp
+24
-12
24 additions, 12 deletions
Source/CAVEOverlay/Private/CAVEOverlayController.cpp
Source/CAVEOverlay/Public/CAVEOverlayController.h
+1
-0
1 addition, 0 deletions
Source/CAVEOverlay/Public/CAVEOverlayController.h
with
25 additions
and
12 deletions
Source/CAVEOverlay/Private/CAVEOverlayController.cpp
+
24
−
12
View file @
8209a767
...
...
@@ -55,8 +55,8 @@ ACAVEOverlayController::ACAVEOverlayController()
loadAsset
(
TEXT
(
"/CAVEOverlay/StopMaterial"
),
sign_material_
);
loadAsset
(
TEXT
(
"/CAVEOverlay/Plane"
),
plane_mesh_
);
tape_material_dynamic_
=
UMaterialInstanceDynamic
::
Create
(
tape_material_
,
tape_material_
);
sign_material_dynamic_
=
UMaterialInstanceDynamic
::
Create
(
sign_material_
,
sign_material_
);
tape_material_dynamic_
=
UMaterialInstanceDynamic
::
Create
(
tape_material_
,
NULL
);
sign_material_dynamic_
=
UMaterialInstanceDynamic
::
Create
(
sign_material_
,
NULL
);
tape_negative_y
=
createMeshComponent
(
FName
(
"TapeNegY"
),
tape_material_dynamic_
,
plane_mesh_
,
tape_root
);
tape_negative_x
=
createMeshComponent
(
FName
(
"TapeNegX"
),
tape_material_dynamic_
,
plane_mesh_
,
tape_root
);
...
...
@@ -102,24 +102,27 @@ void ACAVEOverlayController::SetDoorMode(DOOR_MODE m)
switch
(
door_current_mode_
)
{
case
DOOR_MODE
::
DOOR_PARTIAL_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
));
if
(
screen_type_
==
SCREEN_MASTER
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
door_opening_width_relative_
,
1
));
if
(
screen_type_
==
SCREEN_MASTER
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
0
,
1
));
overlay_
->
BlackBox
->
SetVisibility
(
ESlateVisibility
::
Visible
);
break
;
case
DOOR_MODE
::
DOOR_OPEN
:
door_current_opening_width_absolute_
=
wall_distance_
*
2
;
if
(
screen_type_
==
SCREEN_DOOR
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
1
,
1
));
if
(
screen_type_
==
SCREEN_DOOR_PARTIAL
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
1
,
1
));
if
(
screen_type_
==
SCREEN_MASTER
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
1
,
1
));
overlay_
->
BlackBox
->
SetVisibility
(
ESlateVisibility
::
Visible
);
break
;
case
DOOR_MODE
::
DOOR_CLOSED
:
door_current_opening_width_absolute_
=
0
;
if
(
screen_type_
==
SCREEN_DOOR
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
0
,
1
));
if
(
screen_type_
==
SCREEN_DOOR_PARTIAL
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
0
,
1
));
if
(
screen_type_
==
SCREEN_MASTER
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
0
,
1
));
overlay_
->
BlackBox
->
SetVisibility
(
ESlateVisibility
::
Hidden
);
break
;
}
if
(
screen_type_
==
SCREEN_
DOOR_PARTI
AL
)
overlay_
->
BlackBox
->
SetRenderScale
(
FVector2D
(
0
,
1
));
//
No black
overlay
if
(
screen_type_
==
SCREEN_
NORM
AL
)
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_
]));
...
...
@@ -141,7 +144,6 @@ void ACAVEOverlayController::BeginPlay()
display_cluster_mode_
=
IDisplayCluster
::
Get
().
GetOperationMode
()
==
EDisplayClusterOperationMode
::
Cluster
;
//Determine the screentype for later usage
screen_type_
=
SCREEN_NORMAL
;
if
(
IDisplayCluster
::
Get
().
GetClusterMgr
()
->
GetNodeId
().
Equals
(
screen_main
,
ESearchCase
::
IgnoreCase
))
{
screen_type_
=
SCREEN_MASTER
;
}
...
...
@@ -151,6 +153,9 @@ void ACAVEOverlayController::BeginPlay()
else
if
(
containsFString
(
screens_door_partial_
,
IDisplayCluster
::
Get
().
GetClusterMgr
()
->
GetNodeId
()))
{
screen_type_
=
SCREEN_DOOR_PARTIAL
;
}
else
{
screen_type_
=
SCREEN_NORMAL
;
}
overlay_
=
CreateWidget
<
UDoorOverlayData
>
(
GetWorld
()
->
GetFirstPlayerController
(),
overlay_class_
);
overlay_
->
AddToViewport
(
0
);
...
...
@@ -158,12 +163,7 @@ void ACAVEOverlayController::BeginPlay()
overlay_
->
CornerText
->
SetText
(
FText
::
FromString
(
""
));
//Set Text to "" until someone presses the key for the first time
player_pawn_
=
Cast
<
AVirtualRealityPawn
>
(
GetWorld
()
->
GetFirstPlayerController
()
->
GetPawn
());
TArray
<
UDisplayClusterSceneComponent
*>
pawn_components
;
player_pawn_
->
GetComponents
<
UDisplayClusterSceneComponent
>
(
pawn_components
);
for
(
UDisplayClusterSceneComponent
*
c
:
pawn_components
)
{
if
(
c
->
GetName
().
Equals
(
"cave_origin"
,
ESearchCase
::
IgnoreCase
))
cave_origin_
=
c
;
if
(
c
->
GetName
().
Equals
(
"shutter_glasses"
,
ESearchCase
::
IgnoreCase
))
cave_origin_
=
c
;
}
refreshPawnComponents
();
}
float
ACAVEOverlayController
::
calculateOpacityFromPosition
(
FVector
position
)
{
...
...
@@ -175,6 +175,15 @@ bool ACAVEOverlayController::positionInDoorOpening(FVector position) {
&&
FMath
::
IsWithinInclusive
(
position
.
Y
,
wall_distance_
+
10
-
door_current_opening_width_absolute_
,
wall_distance_
+
10
);
//Overlap one side 10cm
}
void
ACAVEOverlayController
::
refreshPawnComponents
(){
static
TArray
<
UDisplayClusterSceneComponent
*>
pawn_components
;
player_pawn_
->
GetComponents
<
UDisplayClusterSceneComponent
>
(
pawn_components
);
for
(
UDisplayClusterSceneComponent
*
c
:
pawn_components
)
{
if
(
c
->
GetName
().
Equals
(
"cave_origin"
,
ESearchCase
::
IgnoreCase
))
cave_origin_
=
c
;
if
(
c
->
GetName
().
Equals
(
"shutter_glasses"
,
ESearchCase
::
IgnoreCase
))
shutter_glasses_
=
c
;
}
}
// Called every frame
void
ACAVEOverlayController
::
Tick
(
float
DeltaTime
)
{
...
...
@@ -182,6 +191,9 @@ void ACAVEOverlayController::Tick(float DeltaTime)
if
(
hmd_mode_
||
!
display_cluster_mode_
)
return
;
// Not our business
refreshPawnComponents
();
if
(
!
cave_origin_
||
!
shutter_glasses_
)
return
;
//Display Cluster not initialized
//Move complete actor around
SetActorLocationAndRotation
(
cave_origin_
->
GetComponentLocation
(),
cave_origin_
->
GetComponentQuat
());
...
...
@@ -208,7 +220,7 @@ void ACAVEOverlayController::Tick(float DeltaTime)
//Sign Logic
UDisplayClusterSceneComponent
*
flystick
=
IDisplayCluster
::
Get
().
GetGameMgr
()
->
GetNodeById
(
TEXT
(
"flystick"
));
if
(
flystick
)
{
if
(
flystick
!=
nullptr
)
{
FVector
flystick_position
=
flystick
->
GetRelativeTransform
().
GetLocation
();
bool
flystick_in_door
=
positionInDoorOpening
(
flystick_position
);
float
sign_opacity
=
calculateOpacityFromPosition
(
flystick_position
);
...
...
This diff is collapsed.
Click to expand it.
Source/CAVEOverlay/Public/CAVEOverlayController.h
+
1
−
0
View file @
8209a767
...
...
@@ -71,6 +71,7 @@ private:
bool
positionInDoorOpening
(
FVector
position
);
//Pawn Components
void
refreshPawnComponents
();
AVirtualRealityPawn
*
player_pawn_
;
UDisplayClusterSceneComponent
*
cave_origin_
;
UDisplayClusterSceneComponent
*
shutter_glasses_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment