Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Project_Phoenix
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor 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
Show more breadcrumbs
LuFG VR VIS
VR-Group
Project_Phoenix
Commits
16226a15
Commit
16226a15
authored
7 years ago
by
Thomas Vierjahn
Browse files
Options
Downloads
Patches
Plain Diff
Reorder functions
#372
parent
baa53c73
No related branches found
No related tags found
1 merge request
!104
Feature/#299 check with the cppcheck developers why it complains about passing shared ptr by value
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
library/phx/openvr_controller_system.cpp
+36
-36
36 additions, 36 deletions
library/phx/openvr_controller_system.cpp
with
36 additions
and
36 deletions
library/phx/openvr_controller_system.cpp
+
36
−
36
View file @
16226a15
...
...
@@ -53,42 +53,6 @@ OpenVRControllerSystem::OpenVRControllerSystem(Engine* engine,
resource_manager
.
RegisterResourceType
(
"openVR"
,
std
::
move
(
openvr_loader
));
}
Entity
*
OpenVRControllerSystem
::
AddControllerEntity
(
phx
::
Scene
*
scene
,
ResourcePointer
<
Mesh
>
mesh
,
ResourcePointer
<
Material
>
material
,
OpenVRControllerBehavior
::
Side
side
)
{
Entity
*
controller
=
scene
->
CreateEntity
();
controller
->
AddComponent
<
MeshHandle
>
()
->
SetMesh
(
mesh
);
controller
->
AddComponent
<
Transform
>
();
controller
->
AddComponent
<
MaterialHandle
>
()
->
SetMaterial
(
material
);
controller
->
AddComponent
<
OpenVRControllerBehavior
>
()
->
SetSide
(
side
);
return
controller
;
}
Entity
*
OpenVRControllerSystem
::
AddController
(
phx
::
Scene
*
scene
,
OpenVRControllerBehavior
::
Side
side
)
{
auto
&
resource_manager
=
ResourceManager
::
instance
();
std
::
string
side_string
=
side
==
OpenVRControllerBehavior
::
LEFT
?
"left"
:
"right"
;
ResourceDeclaration
mesh_declaration
{
{
"TYPE"
,
"openVR"
},
{
"OpenVR_type"
,
"mesh"
},
{
"side"
,
side_string
}};
auto
mesh
=
ResourceManager
::
instance
().
DeclareResource
<
Mesh
>
(
mesh_declaration
);
mesh
.
Load
();
ResourceDeclaration
material_declaration
{
{
"TYPE"
,
"openVR"
},
{
"OpenVR_type"
,
"material"
},
{
"side"
,
side_string
}};
auto
material
=
resource_manager
.
DeclareResource
<
Material
>
(
material_declaration
);
material
.
Load
();
if
(
mesh
!=
nullptr
)
{
return
AddControllerEntity
(
scene
,
mesh
,
material
,
side
);
}
return
nullptr
;
}
void
OpenVRControllerSystem
::
Update
(
const
FrameTimer
::
TimeInfo
&
)
{
// check which controllers are active and update their scene representation,
// if necessary
...
...
@@ -142,4 +106,40 @@ void OpenVRControllerSystem::Update(const FrameTimer::TimeInfo&) {
}
}
Entity
*
OpenVRControllerSystem
::
AddController
(
phx
::
Scene
*
scene
,
OpenVRControllerBehavior
::
Side
side
)
{
auto
&
resource_manager
=
ResourceManager
::
instance
();
std
::
string
side_string
=
side
==
OpenVRControllerBehavior
::
LEFT
?
"left"
:
"right"
;
ResourceDeclaration
mesh_declaration
{
{
"TYPE"
,
"openVR"
},
{
"OpenVR_type"
,
"mesh"
},
{
"side"
,
side_string
}};
auto
mesh
=
ResourceManager
::
instance
().
DeclareResource
<
Mesh
>
(
mesh_declaration
);
mesh
.
Load
();
ResourceDeclaration
material_declaration
{
{
"TYPE"
,
"openVR"
},
{
"OpenVR_type"
,
"material"
},
{
"side"
,
side_string
}};
auto
material
=
resource_manager
.
DeclareResource
<
Material
>
(
material_declaration
);
material
.
Load
();
if
(
mesh
!=
nullptr
)
{
return
AddControllerEntity
(
scene
,
mesh
,
material
,
side
);
}
return
nullptr
;
}
Entity
*
OpenVRControllerSystem
::
AddControllerEntity
(
phx
::
Scene
*
scene
,
ResourcePointer
<
Mesh
>
mesh
,
ResourcePointer
<
Material
>
material
,
OpenVRControllerBehavior
::
Side
side
)
{
Entity
*
controller
=
scene
->
CreateEntity
();
controller
->
AddComponent
<
MeshHandle
>
()
->
SetMesh
(
mesh
);
controller
->
AddComponent
<
Transform
>
();
controller
->
AddComponent
<
MaterialHandle
>
()
->
SetMaterial
(
material
);
controller
->
AddComponent
<
OpenVRControllerBehavior
>
()
->
SetSide
(
side
);
return
controller
;
}
}
// namespace phx
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