Start to implement stereo support with adaptive stereoscopic depth

This commit is contained in:
Emil Axelsson
2018-02-14 15:05:52 +01:00
parent 2cd16e54b1
commit 499879c84e
12 changed files with 160 additions and 71 deletions
@@ -84,6 +84,10 @@ private:
properties::FloatProperty _minimumAllowedDistance;
properties::FloatProperty _sensitivity;
properties::BoolProperty _useAdaptiveStereoscopicDepth;
properties::FloatProperty _stereoscopicDepthOfFocusSurface;
properties::FloatProperty _staticViewScaleExponent;
MouseStates _mouseStates;
SceneGraphNode* _focusNode = nullptr;
@@ -193,6 +197,14 @@ private:
const glm::dvec3& cameraPosition,
const SurfacePositionHandle& positionHandle);
/**
* Get the vector from the camera to the surface of the focus object in world space.
*/
glm::dvec3 cameraToSurfaceVector(
const glm::dvec3& cameraPos,
const glm::dvec3& centerPos,
const SurfacePositionHandle& posHandle);
/**
* Calculates a SurfacePositionHandle given a camera position in world space.
*/
@@ -82,6 +82,8 @@ public:
void update() override;
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
void performRaycasterTasks(const std::vector<RaycasterTask>& tasks);
void performDeferredTasks(const std::vector<DeferredcasterTask>& tasks);
/**
* Update render data
+5 -4
View File
@@ -91,7 +91,7 @@ public:
void setPositionVec3(Vec3 pos);
void setFocusPositionVec3(Vec3 pos);
void setRotation(Quat rotation);
void setScaling(glm::vec2 scaling);
void setScaling(float scaling);
void setMaxFov(float fov);
void setParent(SceneGraphNode* parent);
@@ -106,12 +106,13 @@ public:
const Vec3& viewDirectionWorldSpace() const;
const Vec3& lookUpVectorCameraSpace() const;
const Vec3& lookUpVectorWorldSpace() const;
const glm::vec2& scaling() const;
const Mat4& viewRotationMatrix() const;
const Mat4& viewScaleMatrix() const;
const Quat& rotationQuaternion() const;
float maxFov() const;
float sinMaxFov() const;
SceneGraphNode* parent() const;
float scaling() const;
// @TODO this should simply be called viewMatrix!
// Or it needs to be changed so that it actually is combined. Right now it is
@@ -186,10 +187,9 @@ private:
SyncData<Vec3> _position;
SyncData<Quat> _rotation;
SyncData<glm::vec2> _scaling;
SyncData<float> _scaling;
SceneGraphNode* _parent;
// _focusPosition to be removed
Vec3 _focusPosition;
float _maxFov;
@@ -198,6 +198,7 @@ private:
mutable Cached<Vec3> _cachedViewDirection;
mutable Cached<Vec3> _cachedLookupVector;
mutable Cached<Mat4> _cachedViewRotationMatrix;
mutable Cached<Mat4> _cachedViewScaleMatrix;
mutable Cached<Mat4> _cachedCombinedViewMatrix;
mutable Cached<float> _cachedSinMaxFov;