Ejemplo n.º 1
0
        public void RenderScene(Valve.VR.EVREye eye)
        {
            // Clear the screen to white
            GL.ClearColor(.1f, 0f, .1f, 1.0f);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            // use ovrvision camera
            if (enableAR)
            {
                ovrvision_controller.updateCamera(eye);
                Matrix4 vp = new Matrix4();
                switch (eye)
                {
                case Valve.VR.EVREye.Eye_Left:
                    if (ovrvision_controller.foundMarker_L)
                    {
                        ovrvision_controller.drawCubeGL(0);
                    }
                    //ovrvision_controller.drawController(0);

                    ovrvision_controller.getOVRVPMatrix(0, ref vp);
                    //Util.WriteLine(ref mScene.rhinoDoc, vp.ToString());
                    break;

                default:
                    if (ovrvision_controller.foundMarker_R)
                    {
                        ovrvision_controller.drawCubeGL(1);
                    }
                    // ovrvision_controller.drawController(1);

                    ovrvision_controller.getOVRVPMatrix(1, ref vp);
                    break;
                }
                //already transpose
                //vp.Transpose();
                mScene.render(ref vp);
            }
            else
            {
                mHMD.GetEyeToHeadTransform(eye);

                Matrix4 vp;
                switch (eye)
                {
                case Valve.VR.EVREye.Eye_Left:
                    //Util.WriteLine(ref mScene.rhinoDoc, mScene.mHMDPose.ToString());
                    vp = mEyeProjLeft * mEyePosLeft * mScene.mHMDPose;
                    break;

                default:
                    vp = mEyeProjRight * mEyePosRight * mScene.mHMDPose;
                    break;
                }
                vp.Transpose();
                mScene.render(ref vp);
            }
        }
Ejemplo n.º 2
0
 Matrix4 GetHMDMatrixPoseEye(ref Valve.VR.CVRSystem HMD, Valve.VR.EVREye eye)
 {
     if (HMD == null)
     {
         return(new Matrix4());
     }
     Valve.VR.HmdMatrix34_t M = HMD.GetEyeToHeadTransform(eye);
     return(UtilOld.steamVRMatrixToMatrix4(M).Inverted());
 }
Ejemplo n.º 3
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));
 }
Ejemplo n.º 4
0
    public void Set(SteamVR vr, Valve.VR.EVREye eye)
    {
        int i = (int)eye;

        if (hiddenAreaMeshes[i] == null)
        {
            hiddenAreaMeshes[i] = SteamVR_Utils.CreateHiddenAreaMesh(vr.hmd.GetHiddenAreaMesh(eye, EHiddenAreaMeshType.k_eHiddenAreaMesh_Standard), vr.textureBounds[i]);
        }
        meshFilter.mesh = hiddenAreaMeshes[i];
    }
Ejemplo n.º 5
0
 public void updateCamera(Valve.VR.EVREye eye)
 {
     Ovrvision.UpdateCamera();
     if (eye == Valve.VR.EVREye.Eye_Left)
     {
         Ovrvision.UpdateLeft();
         drawCameraView(0);
     }
     else
     {
         Ovrvision.UpdateRight();
         drawCameraView(1);
     }
 }
Ejemplo n.º 6
0
    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);
    }