mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-26 14:55:39 +00:00
Remove projection offset, add the hmd head matrix. Also tidy up a few things.
This commit is contained in:
parent
e7bafe3c7b
commit
f91aa639d6
20 changed files with 126 additions and 113 deletions
|
|
@ -597,15 +597,27 @@ void OpenVRTransformToRotPos(MatrixF mat, QuatF &outRot, Point3F &outPos)
|
|||
outPos = pos;// Point3F(-pos.x, pos.z, -pos.y);
|
||||
}
|
||||
|
||||
void OpenVRProvider::getFrameEyePose(IDevicePose *pose, U32 eye) const
|
||||
void OpenVRProvider::getFrameEyePose(IDevicePose *pose, S32 eyeId) const
|
||||
{
|
||||
AssertFatal(eye >= 0 && eye < 2, "Out of bounds eye");
|
||||
AssertFatal(eyeId >= -1 && eyeId < 2, "Out of bounds eye");
|
||||
|
||||
MatrixF mat = mHMDRenderState.mEyePose[eye] * mHMDRenderState.mHMDPose; // same order as in the openvr example
|
||||
if (eyeId == -1)
|
||||
{
|
||||
// NOTE: this is codename for "head"
|
||||
MatrixF mat = mHMDRenderState.mHMDPose; // same order as in the openvr example
|
||||
|
||||
OpenVRTransformToRotPos(mat, pose->orientation, pose->position);
|
||||
pose->velocity = Point3F(0);
|
||||
pose->angularVelocity = Point3F(0);
|
||||
OpenVRTransformToRotPos(mat, pose->orientation, pose->position);
|
||||
pose->velocity = Point3F(0);
|
||||
pose->angularVelocity = Point3F(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixF mat = mHMDRenderState.mEyePose[eyeId] * mHMDRenderState.mHMDPose; // same order as in the openvr example
|
||||
|
||||
OpenVRTransformToRotPos(mat, pose->orientation, pose->position);
|
||||
pose->velocity = Point3F(0);
|
||||
pose->angularVelocity = Point3F(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool OpenVRProvider::providesEyeOffsets() const
|
||||
|
|
@ -633,16 +645,6 @@ void OpenVRProvider::getFovPorts(FovPort *out) const
|
|||
dMemcpy(out, mHMDRenderState.mEyeFov, sizeof(mHMDRenderState.mEyeFov));
|
||||
}
|
||||
|
||||
bool OpenVRProvider::providesProjectionOffset() const
|
||||
{
|
||||
return mHMD != NULL;
|
||||
}
|
||||
|
||||
const Point2F& OpenVRProvider::getProjectionOffset() const
|
||||
{
|
||||
return Point2F(0, 0);
|
||||
}
|
||||
|
||||
void OpenVRProvider::getStereoViewports(RectI *out) const
|
||||
{
|
||||
out[0] = mHMDRenderState.mEyeViewport[0];
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ public:
|
|||
/// @name Display handling
|
||||
/// {
|
||||
virtual bool providesFrameEyePose() const;
|
||||
virtual void getFrameEyePose(IDevicePose *pose, U32 eye) const;
|
||||
virtual void getFrameEyePose(IDevicePose *pose, S32 eyeId) const;
|
||||
|
||||
virtual bool providesEyeOffsets() const;
|
||||
/// Returns eye offset not taking into account any position tracking info
|
||||
|
|
@ -166,9 +166,6 @@ public:
|
|||
virtual bool providesFovPorts() const;
|
||||
virtual void getFovPorts(FovPort *out) const;
|
||||
|
||||
virtual bool providesProjectionOffset() const;
|
||||
virtual const Point2F& getProjectionOffset() const;
|
||||
|
||||
virtual void getStereoViewports(RectI *out) const;
|
||||
virtual void getStereoTargets(GFXTextureTarget **out) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ class IDisplayDevice
|
|||
{
|
||||
public:
|
||||
virtual bool providesFrameEyePose() const = 0;
|
||||
virtual void getFrameEyePose(IDevicePose *pose, U32 eye) const = 0;
|
||||
|
||||
/// Get a display pose for the specified eye, or the HMD if eyeId is -1.
|
||||
virtual void getFrameEyePose(IDevicePose *pose, S32 eyeId) const = 0;
|
||||
|
||||
virtual bool providesEyeOffsets() const = 0;
|
||||
/// Returns eye offset not taking into account any position tracking info
|
||||
|
|
@ -59,9 +61,6 @@ public:
|
|||
virtual bool providesFovPorts() const = 0;
|
||||
virtual void getFovPorts(FovPort *out) const = 0;
|
||||
|
||||
virtual bool providesProjectionOffset() const = 0;
|
||||
virtual const Point2F& getProjectionOffset() const = 0;
|
||||
|
||||
virtual void getStereoViewports(RectI *out) const = 0;
|
||||
virtual void getStereoTargets(GFXTextureTarget **out) const = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue