Beispiel #1
0
    private void applyOffset()
    {
        var displayMgr = MiddleVR.VRDisplayMgr;

        // For each vrCameraStereo, apply the new transform matrix to right cameras screen
        for (uint i = 0, iEnd = displayMgr.GetCamerasNb(); i < iEnd; ++i)
        {
            vrCamera cam = displayMgr.GetCameraByIndex(i);
            if (cam.IsA("CameraStereo"))
            {
                vrCameraStereo stereoCam = displayMgr.GetCameraStereoById(cam.GetId());

                vrVec3 pos = stereoCam.GetCameraRight().GetScreen().GetPositionLocal();
                pos.SetX(pos.x() + xDist);
                pos.SetY(pos.y() + yDist);
                stereoCam.GetCameraRight().GetScreen().SetPositionLocal(pos);

                /*
                 * stereoCam.GetCameraRight().SetPositionLocal(new vrVec3(xDist, yDist, 0));
                 * stereoCam.GetCameraRight().SetRollLocal(roll);
                 * stereoCam.GetCameraRight().SetYawLocal(yaw);
                 * if ((frameCounter / 4) > 20)
                 * {
                 *  quat = stereoCam.GetCameraRight().GetOrientationLocal();
                 *  frameCounter = 0;
                 * }
                 * else
                 *  frameCounter++;
                 * GetComponent<TextMesh>().text = quat.x() + ", " + quat.y() + ", " + quat.z() + ", " + quat.w();
                 * quat.SetY(roll);
                 * quat.SetZ(yaw);
                 * stereoCam.GetCameraRight().SetOrientationLocal(quat);
                 */
            }
        }
    }