Example #1
0
            public HmdMatrix44_t ToHmdMatrix44()
            {
                Matrix4x4     matrix = Matrix4x4.TRS(pos, rot, Vector3.one);
                HmdMatrix44_t pose   = new HmdMatrix44_t();

                pose.m0 = matrix[0, 0];
                pose.m1 = matrix[0, 1];
                pose.m2 = -matrix[0, 2];
                pose.m3 = matrix[0, 3];

                pose.m4 = matrix[1, 0];
                pose.m5 = matrix[1, 1];
                pose.m6 = -matrix[1, 2];
                pose.m7 = matrix[1, 3];

                pose.m8  = -matrix[2, 0];
                pose.m9  = -matrix[2, 1];
                pose.m10 = matrix[2, 2];
                pose.m11 = -matrix[2, 3];

                pose.m12 = matrix[3, 0];
                pose.m13 = matrix[3, 1];
                pose.m14 = -matrix[3, 2];
                pose.m15 = matrix[3, 3];

                return(pose);
            }
Example #2
0
            public RigidTransform(HmdMatrix44_t pose)
            {
                Matrix4x4 matrix = Matrix4x4.identity;

                matrix[0, 0] = pose.m0;
                matrix[0, 1] = pose.m1;
                matrix[0, 2] = -pose.m2;
                matrix[0, 3] = pose.m3;

                matrix[1, 0] = pose.m4;
                matrix[1, 1] = pose.m5;
                matrix[1, 2] = -pose.m6;
                matrix[1, 3] = pose.m7;

                matrix[2, 0] = -pose.m8;
                matrix[2, 1] = -pose.m9;
                matrix[2, 2] = pose.m10;
                matrix[2, 3] = -pose.m11;

                matrix[3, 0] = pose.m12;
                matrix[3, 1] = pose.m13;
                matrix[3, 2] = -pose.m14;
                matrix[3, 3] = pose.m15;

                this.pos = matrix.GetPosition();
                this.rot = matrix.GetRotation();
            }
Example #3
0
    protected Matrix4x4 HMDMatrix4x4ToMatrix4x4(Valve.VR.HmdMatrix44_t input)
    {
        var m = Matrix4x4.identity;

        m[0, 0] = input.m0;
        m[0, 1] = input.m1;
        m[0, 2] = input.m2;
        m[0, 3] = input.m3;

        m[1, 0] = input.m4;
        m[1, 1] = input.m5;
        m[1, 2] = input.m6;
        m[1, 3] = input.m7;

        m[2, 0] = input.m8;
        m[2, 1] = input.m9;
        m[2, 2] = input.m10;
        m[2, 3] = input.m11;

        m[3, 0] = input.m12;
        m[3, 1] = input.m13;
        m[3, 2] = input.m14;
        m[3, 3] = input.m15;

        return(m);
    }
Example #4
0
        // transform a SteamVR matrix format to Unity matrix format
        private Matrix4x4 HMDMatrix4x4ToMatrix4x4(Valve.VR.HmdMatrix44_t hmdMatrix)
        {
            Matrix4x4 m = Matrix4x4.identity;

            m[0, 0] = hmdMatrix.m0;
            m[0, 1] = hmdMatrix.m1;
            m[0, 2] = hmdMatrix.m2;
            m[0, 3] = hmdMatrix.m3;

            m[1, 0] = hmdMatrix.m4;
            m[1, 1] = hmdMatrix.m5;
            m[1, 2] = hmdMatrix.m6;
            m[1, 3] = hmdMatrix.m7;

            m[2, 0] = hmdMatrix.m8;
            m[2, 1] = hmdMatrix.m9;
            m[2, 2] = hmdMatrix.m10;
            m[2, 3] = hmdMatrix.m11;

            m[3, 0] = hmdMatrix.m12;
            m[3, 1] = hmdMatrix.m13;
            m[3, 2] = hmdMatrix.m14;
            m[3, 3] = hmdMatrix.m15;

            return(m);
        }
Example #5
0
 Matrix4 GetHMDMatrixProjectionEye(ref Valve.VR.CVRSystem HMD, Valve.VR.EVREye eye)
 {
     if (HMD == null)
     {
         return(new Matrix4());
     }
     Valve.VR.HmdMatrix44_t M = HMD.GetProjectionMatrix(eye, mNearClip, mFarClip);
     return(UtilOld.steamVRMatrixToMatrix4(M));
 }
    public static Matrix4x4 GetSteamVRProjectionMatrix(Camera cam, Valve.VR.EVREye eye)
    {
        Valve.VR.HmdMatrix44_t proj = SteamVR.instance.hmd.GetProjectionMatrix(eye, cam.nearClipPlane, cam.farClipPlane);
        Matrix4x4 m = new Matrix4x4();

        m.m00 = proj.m0;
        m.m01 = proj.m1;
        m.m02 = proj.m2;
        m.m03 = proj.m3;
        m.m10 = proj.m4;
        m.m11 = proj.m5;
        m.m12 = proj.m6;
        m.m13 = proj.m7;
        m.m20 = proj.m8;
        m.m21 = proj.m9;
        m.m22 = proj.m10;
        m.m23 = proj.m11;
        m.m30 = proj.m12;
        m.m31 = proj.m13;
        m.m32 = proj.m14;
        m.m33 = proj.m15;
        return(m);
    }
Example #7
0
	internal static extern bool VR_IVRTrackedCamera_GetCameraProjection(IntPtr instancePtr, uint nDeviceIndex, float flWidthPixels, float flHeightPixels, float flZNear, float flZFar, ref HmdMatrix44_t pProjection);
Example #8
0
	public override bool GetCameraProjection(uint nDeviceIndex,float flWidthPixels,float flHeightPixels,float flZNear,float flZFar,ref HmdMatrix44_t pProjection)
	{
		CheckIfUsable();
		bool result = VRNativeEntrypoints.VR_IVRTrackedCamera_GetCameraProjection(m_pVRTrackedCamera,nDeviceIndex,flWidthPixels,flHeightPixels,flZNear,flZFar,ref pProjection);
		return result;
	}
Example #9
0
	public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,float flZNear,float flZFar,ref HmdMatrix44_t pProjection)
	{
		EVRTrackedCameraError result = FnTable.GetCameraProjection(nDeviceIndex,eFrameType,flZNear,flZFar,ref pProjection);
		return result;
	}
Example #10
0
 // Token: 0x06001F0C RID: 7948 RVA: 0x0009CE94 File Offset: 0x0009B094
 public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection)
 {
     return(this.FnTable.GetCameraProjection(nDeviceIndex, eFrameType, flZNear, flZFar, ref pProjection));
 }
Example #11
0
        public HmdMatrix44_t ToHmdMatrix44()
        {
            var m = Matrix4x4.TRS(pos, rot, Vector3.one);
            var pose = new HmdMatrix44_t();

            pose.m0 = m[0, 0];
            pose.m1 = m[0, 1];
            pose.m2 = -m[0, 2];
            pose.m3 = m[0, 3];

            pose.m4 = m[1, 0];
            pose.m5 = m[1, 1];
            pose.m6 = -m[1, 2];
            pose.m7 = m[1, 3];

            pose.m8 = -m[2, 0];
            pose.m9 = -m[2, 1];
            pose.m10 = m[2, 2];
            pose.m11 = -m[2, 3];

            pose.m12 = m[3, 0];
            pose.m13 = m[3, 1];
            pose.m14 = -m[3, 2];
            pose.m15 = m[3, 3];

            return pose;
        }
internal static extern bool SteamAPI_vr_IHmd_GetViewMatrix(IntPtr instancePtr, float fSecondsFromNow, ref HmdMatrix44_t pMatLeftView, ref HmdMatrix44_t pMatRightView, ref HmdTrackingResult peResult);
Example #13
0
 public bool GetCameraProjection(uint nDeviceIndex, float flWidthPixels, float flHeightPixels, float flZNear, float flZFar, ref HmdMatrix44_t pProjection)
 {
     return(this.FnTable.GetCameraProjection(nDeviceIndex, flWidthPixels, flHeightPixels, flZNear, flZFar, ref pProjection));
 }
Example #14
0
	public abstract bool GetCameraProjection(uint nDeviceIndex,float flWidthPixels,float flHeightPixels,float flZNear,float flZFar,ref HmdMatrix44_t pProjection);
		public RigidTransform(HmdMatrix44_t pose)
		{
			var m = Matrix4x4.identity;

			m[0, 0] =  pose.m[0 * 4 + 0];
			m[1, 0] =  pose.m[1 * 4 + 0];
			m[2, 0] = -pose.m[2 * 4 + 0];
			m[3, 0] =  pose.m[3 * 4 + 0];

			m[0, 1] =  pose.m[0 * 4 + 1];
			m[1, 1] =  pose.m[1 * 4 + 1];
			m[2, 1] = -pose.m[2 * 4 + 1];
			m[3, 1] =  pose.m[3 * 4 + 1];

			m[0, 2] = -pose.m[0 * 4 + 2];
			m[1, 2] = -pose.m[1 * 4 + 2];
			m[2, 2] =  pose.m[2 * 4 + 2];
			m[3, 2] = -pose.m[3 * 4 + 2];

			m[0, 3] =  pose.m[0 * 4 + 3];
			m[1, 3] =  pose.m[1 * 4 + 3];
			m[2, 3] = -pose.m[2 * 4 + 3];
			m[3, 3] =  pose.m[3 * 4 + 3];

			this.pos = m.GetPosition();
			this.rot = m.GetRotation();
		}
		public HmdMatrix44_t ToHmdMatrix44()
		{
			var m = Matrix4x4.TRS(pos, rot, Vector3.one);
			var pose = new HmdMatrix44_t();
			pose.m = new float[16];

			pose.m[0 * 4 + 0] =  m[0, 0];
			pose.m[1 * 4 + 0] =  m[1, 0];
			pose.m[2 * 4 + 0] = -m[2, 0];
			pose.m[3 * 4 + 0] =  m[3, 0];

			pose.m[0 * 4 + 1] =  m[0, 1];
			pose.m[1 * 4 + 1] =  m[1, 1];
			pose.m[2 * 4 + 1] = -m[2, 1];
			pose.m[3 * 4 + 1] =  m[3, 1];

			pose.m[0 * 4 + 2] = -m[0, 2];
			pose.m[1 * 4 + 2] = -m[1, 2];
			pose.m[2 * 4 + 2] =  m[2, 2];
			pose.m[3 * 4 + 2] = -m[3, 2];

			pose.m[0 * 4 + 3] =  m[0, 3];
			pose.m[1 * 4 + 3] =  m[1, 3];
			pose.m[2 * 4 + 3] = -m[2, 3];
			pose.m[3 * 4 + 3] =  m[3, 3];

			return pose;
		}
Example #17
0
	public bool GetCameraProjection(uint nDeviceIndex,float flWidthPixels,float flHeightPixels,float flZNear,float flZFar,ref HmdMatrix44_t pProjection)
	{
		bool result = FnTable.GetCameraProjection(nDeviceIndex,flWidthPixels,flHeightPixels,flZNear,flZFar,ref pProjection);
		return result;
	}
Example #18
0
        public RigidTransform(HmdMatrix44_t pose)
        {
            var m = Matrix4x4.identity;

            m[0, 0] = pose.m0;
            m[0, 1] = pose.m1;
            m[0, 2] = -pose.m2;
            m[0, 3] = pose.m3;

            m[1, 0] = pose.m4;
            m[1, 1] = pose.m5;
            m[1, 2] = -pose.m6;
            m[1, 3] = pose.m7;

            m[2, 0] = -pose.m8;
            m[2, 1] = -pose.m9;
            m[2, 2] = pose.m10;
            m[2, 3] = -pose.m11;

            m[3, 0] = pose.m12;
            m[3, 1] = pose.m13;
            m[3, 2] = -pose.m14;
            m[3, 3] = pose.m15;

            this.pos = m.GetPosition();
            this.rot = m.GetRotation();
        }
Example #19
0
 public EVRTrackedCameraError GetCameraIntrinsics(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter) => default;                                                                                               // 0x00000001811E10A0-0x00000001811E10D0
 public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection) => default;                                                                                            // 0x00000001811E10D0-0x00000001811E1100