Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
419c57e5
Commit
419c57e5
authored
Aug 23, 2011
by
Andreas Neu
Browse files
-Bug fixes in camera coordinate system calculation.
parent
3f055220
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/Scene/Camera.hh
View file @
419c57e5
...
...
@@ -80,20 +80,20 @@ public:
}
~
Camera
(
void
)
{}
inline
float
getAspectRatio
()
const
{
return
(
float
)
mWidth
/
(
float
)
mHeight
;
}
inline
const
glm
::
vec3
&
getUpDirection
()
const
{
return
mUp
;
}
inline
const
glm
::
vec3
&
getRightDirection
()
const
{
return
mRight
;
}
inline
const
glm
::
vec3
&
getForwardDirection
()
const
{
return
mForward
;
}
inline
int_t
getWidth
()
const
{
return
mWidth
;
}
inline
int_t
getHeight
()
const
{
return
mHeight
;
}
inline
float
getFOV
()
const
{
return
mFOV
;
}
inline
float
getNear
()
const
{
return
mNear
;
}
inline
float
getFar
()
const
{
return
mFar
;
}
inline
float
getPitch
()
const
{
return
mPitch
;
}
inline
float
getYaw
()
const
{
return
mYaw
;
}
inline
float
getRoll
()
const
{
return
mRoll
;
}
inline
const
glm
::
vec3
&
getPosition
()
const
{
return
mPosition
;
}
inline
const
glm
::
vec3
&
getTarget
()
const
{
return
mTarget
;
}
inline
float
getAspectRatio
(
void
)
const
{
return
(
float
)
mWidth
/
(
float
)
mHeight
;
}
inline
const
glm
::
vec3
&
getUpDirection
(
void
)
const
{
return
mUp
;
}
inline
const
glm
::
vec3
&
getRightDirection
(
void
)
const
{
return
mRight
;
}
inline
const
glm
::
vec3
&
getForwardDirection
(
void
)
const
{
return
mForward
;
}
inline
int_t
getWidth
(
void
)
const
{
return
mWidth
;
}
inline
int_t
getHeight
(
void
)
const
{
return
mHeight
;
}
inline
float
getFOV
(
void
)
const
{
return
mFOV
;
}
inline
float
getNear
(
void
)
const
{
return
mNear
;
}
inline
float
getFar
(
void
)
const
{
return
mFar
;
}
inline
float
getPitch
(
void
)
const
{
return
mPitch
;
}
inline
float
getYaw
(
void
)
const
{
return
mYaw
;
}
inline
float
getRoll
(
void
)
const
{
return
mRoll
;
}
inline
const
glm
::
vec3
&
getPosition
(
void
)
const
{
return
mPosition
;
}
inline
const
glm
::
vec3
&
getTarget
(
void
)
const
{
return
mTarget
;
}
inline
void
setWidth
(
int_t
_width
)
{
mWidth
=
_width
;
}
inline
void
setHeight
(
int_t
_height
)
{
mHeight
=
_height
;
}
...
...
@@ -136,12 +136,14 @@ public:
{
mPitch
=
_pitch
;
updateLocalCoordinateSystemByOrientation
();
mTarget
=
mPosition
+
glm
::
length
(
mTarget
-
mPosition
)
*
mForward
;
}
inline
void
setYaw
(
float
_yaw
)
{
mYaw
=
_yaw
;
updateLocalCoordinateSystemByOrientation
();
mTarget
=
mPosition
+
glm
::
length
(
mTarget
-
mPosition
)
*
mForward
;
}
inline
void
setRoll
(
float
_roll
)
...
...
@@ -177,8 +179,8 @@ public:
private:
void
updateLocalCoordinateSystemByTarget
(
const
glm
::
vec3
&
_up
=
glm
::
vec3
(
0.0
f
,
1.0
f
,
0.0
f
));
void
updateLocalCoordinateSystemByOrientation
(
bool
_moveTarget
=
true
);
void
updateOrientationByLocalCoordinateSystem
();
void
updateLocalCoordinateSystemByOrientation
(
void
);
void
updateOrientationByLocalCoordinateSystem
(
void
);
glm
::
vec3
mRight
;
glm
::
vec3
mUp
;
...
...
src/ACGL/Scene/Camera.cc
View file @
419c57e5
...
...
@@ -58,7 +58,7 @@ void Camera::updateLocalCoordinateSystemByTarget(const glm::vec3& _up)
}
void
Camera
::
updateLocalCoordinateSystemByOrientation
(
bool
_moveTarget
)
void
Camera
::
updateLocalCoordinateSystemByOrientation
(
void
)
{
//Calculate the full rotation in the right order:
//rot => 1. mYaw (y) -> 2. mPitch (x) -> 3. mRoll (z)
...
...
@@ -71,11 +71,6 @@ void Camera::updateLocalCoordinateSystemByOrientation(bool _moveTarget)
mRight
=
rotation
*
glm
::
vec3
(
1.0
f
,
0.0
f
,
0.0
f
);
mUp
=
rotation
*
glm
::
vec3
(
0.0
f
,
1.0
f
,
0.0
f
);
mForward
=
rotation
*
glm
::
vec3
(
0.0
f
,
0.0
f
,
-
1.0
f
);
if
(
_moveTarget
)
{
mTarget
=
mPosition
+
(
rotation
*
(
mTarget
-
mPosition
));
}
}
void
Camera
::
updateOrientationByLocalCoordinateSystem
(
void
)
...
...
Write
Preview
Supports
Markdown
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