mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
Solve precision problem that causes jagged movement.
This commit is contained in:
@@ -73,9 +73,9 @@ namespace openspace {
|
||||
// now working with float precision. To be changed to double later.
|
||||
// The reason double does not work yet is because of the setUniform function
|
||||
// in ghoul::opengl
|
||||
typedef glm::quat Quat;
|
||||
typedef glm::mat4 Mat4;
|
||||
typedef glm::vec3 Vec3;
|
||||
typedef glm::dquat Quat;
|
||||
typedef glm::dmat4 Mat4;
|
||||
typedef glm::dvec3 Vec3;
|
||||
|
||||
// Static constants
|
||||
static const Vec3 _VIEW_DIRECTION_CAMERA_SPACE;
|
||||
|
||||
@@ -940,10 +940,10 @@ void GlobeBrowsingInteractionMode::updateCameraStateFromMouseStates() {
|
||||
0);
|
||||
glm::dquat rotationDiffCamSpace = glm::dquat(eulerAngles);
|
||||
|
||||
glm::dquat newRotationCamspace =
|
||||
_globalCameraRotation * rotationDiffCamSpace;
|
||||
glm::dquat rotationDiffWorldSpace =
|
||||
newRotationCamspace * glm::inverse(_globalCameraRotation);
|
||||
_globalCameraRotation *
|
||||
rotationDiffCamSpace *
|
||||
glm::inverse(_globalCameraRotation);
|
||||
|
||||
glm::dvec3 rotationDiffVec3 =
|
||||
(distFromCenterToCamera * directionFromSurfaceToCamera)
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace openspace {
|
||||
, _focusPosition()
|
||||
{
|
||||
_scaling.local = glm::vec2(1.f, 0.f);
|
||||
_position.local = Vec3(0, 0, 0);
|
||||
Vec3 eulerAngles(0, 0, 0);
|
||||
_position.local = Vec3(1.0, 1.0, 1.0);
|
||||
Vec3 eulerAngles(1.0, 1.0, 1.0);
|
||||
_rotation.local = Quat(eulerAngles);
|
||||
}
|
||||
|
||||
@@ -153,9 +153,8 @@ namespace openspace {
|
||||
|
||||
const Camera::Mat4& Camera::combinedViewMatrix() const {
|
||||
if (_cachedCombinedViewMatrix.isDirty) {
|
||||
Vec3 cameraPosition = position().vec3();
|
||||
Mat4 cameraTranslation =
|
||||
glm::inverse(glm::translate(Mat4(1.0), cameraPosition));
|
||||
glm::inverse(glm::translate(Mat4(1.0), _position.shared));
|
||||
_cachedCombinedViewMatrix.datum =
|
||||
Mat4(viewRotationMatrix()) * cameraTranslation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user