Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
edge-of-space
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dario Seyb
edge-of-space
Commits
3e95f4ba
Commit
3e95f4ba
authored
Jan 28, 2016
by
Dario Seyb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed in cockpit camera rotation
parent
c8e178d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
38 deletions
+8
-38
src/game/include/engine/scene/PlayerSystem.hpp
src/game/include/engine/scene/PlayerSystem.hpp
+4
-0
src/game/src/engine/scene/PlayerSystem.cpp
src/game/src/engine/scene/PlayerSystem.cpp
+2
-36
src/game/src/engine/scene/scenes/AtmosphereTestScene.cpp
src/game/src/engine/scene/scenes/AtmosphereTestScene.cpp
+2
-2
No files found.
src/game/include/engine/scene/PlayerSystem.hpp
View file @
3e95f4ba
...
...
@@ -81,6 +81,10 @@ public:
m_hasControl
=
val
;
}
glm
::
dmat4
getShipRotation
()
{
return
directionRot
;
}
glm
::
dmat4
getRotation
()
{
return
cameraTransform
->
rotation
;
}
...
...
src/game/src/engine/scene/PlayerSystem.cpp
View file @
3e95f4ba
...
...
@@ -472,52 +472,18 @@ void PlayerSystem::update(float dt) {
glm
::
dmat4
oldDir
=
directionRot
;
directionRot
=
directionRot
*
yprMatrix
;
cameraTransform
->
rotation
=
cameraTransform
->
rotation
*
yprMatrix
;
//cameraTransform->rotation = cameraTransform->rotation * yprMatrix ;
//skyboxCamTransform->rotation = skyboxCamTransform->rotation * yprMatrix;
auto
dir
=
normalize
(
rotate
(
glm
::
dvec3
(
0
,
0
,
-
1
),
directionRot
));
cameraTransform
->
position
+=
glm
::
normalize
(
glm
::
vec3
(
dir
))
*
static_cast
<
double
>
(
dt
)
*
velocity
;
/*
auto
up
=
rotate
(
glm
::
dvec3
(
0
,
1
,
0
),
glm
::
inverse
(
cockpitCamTransform
->
rotation
));
cockpitCamTransform
->
rotation
=
glm
::
rotate
(
cockpitCamTransform
->
rotation
,
mouseMove
.
x
*
0.001
,
up
);
cockpitCamTransform
->
rotation
=
glm
::
rotate
(
cockpitCamTransform
->
rotation
,
mouseMove
.
y
*
0.001
,
glm
::
dvec3
(
1
,
0
,
0
));
glm::dmat4 diff = cockpitCamTransform->rotation * glm::transpose(oldDir);
//cameraTransform->rotation = cameraTransform->rotation * yprMatrix;
cameraTransform->rotation = diff * directionRot;
*/
//cameraTransform->rotation = glm::rotate(cameraTransform->rotation, mouseMove.x * 0.001, up);
//cameraTransform->rotation = glm::rotate(cameraTransform->rotation, mouseMove.y * 0.001, glm::dvec3(1, 0, 0));
cameraTransform
->
rotation
=
directionRot
*
cockpitCamTransform
->
rotation
;
mouseMove
=
glm
::
vec2
(
0
,
0
);
// Roll first
//auto dir = normalize(directionRot * glm::vec4{ 0, 0, -1, 0 });
//cameraTransform->position += glm::normalize(glm::vec3(dir)) * static_cast<double>(dt) * velocity;
//cameraTransform->rotation = glm::rotate(cameraTransform->rotation, rollDir * 0.01, glm::dvec3(0, 0, 1));
//auto up = rotate(glm::dvec3(0, 1, 0), glm::inverse(cameraTransform->rotation));
//auto directionUp = rotate(glm::dvec3(0, 1, 0), glm::inverse(directionRot));
//directionUp = glm::dvec3(normalize(cameraTransform->rotation * glm::vec4{ 0, 1, 0, 0 }));
//cameraTransform->rotation = glm::rotate(cameraTransform->rotation, rotDir.x * 0.01, up);
//cameraTransform->rotation = glm::rotate(cameraTransform->rotation, rotDir.y * 0.01, glm::dvec3(1, 0, 0));
//skyboxCamTransform->rotation = cameraTransform->rotation;
//directionRot = glm::rotate(directionRot, rotDir.x * 0.01, directionUp);
//directionRot = glm::rotate(directionRot, rotDir.y * 0.01, glm::dvec3(1, 0, 0));
}
}
...
...
src/game/src/engine/scene/scenes/AtmosphereTestScene.cpp
View file @
3e95f4ba
...
...
@@ -136,7 +136,7 @@ bool AtmosphereTestScene::startup() {
sunLight
->
dir
=
-
glm
::
normalize
(
m_player
->
getWorldPosition
());
cockpitSunLight
->
dir
=
glm
::
vec3
(
glm
::
dvec4
(
sunLight
->
dir
,
0
)
*
m_player
->
getRotation
());
glm
::
vec3
(
glm
::
dvec4
(
sunLight
->
dir
,
0
)
*
m_player
->
get
Ship
Rotation
());
if
(
isFocusedOnConsole
)
{
if
(
m_console
.
update
(
e
,
m_player
->
getKeyTable
()))
{
...
...
@@ -245,7 +245,7 @@ void AtmosphereTestScene::switchToMainScene() {
sun
.
assign
<
Drawable
>
(
sunGeometry
,
sunMaterial
,
0
,
m_renderer
->
getRenderPassId
(
"Main"
_sh
));
float
scale
=
m_orbitals
->
solarRadius
*
m_orbitals
->
scaleFactor
*
0.1
;
sunTransform
->
scale
=
glm
::
dvec3
(
scale
);
sunLight
=
sun
.
assign
<
Light
>
(
glm
::
vec4
(
1
,
1
,
1
,
3
),
glm
::
vec3
(
1
,
0
,
0
),
sunLight
=
sun
.
assign
<
Light
>
(
glm
::
vec4
(
1
,
1
,
1
,
1.5
),
glm
::
vec3
(
1
,
0
,
0
),
false
,
LightType
::
DIRECTIONAL
,
m_renderer
->
getRenderPassId
(
"Main"
_sh
));
// Let's create a placeholder sun
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment