예제 #1
0
    // InitCameraControllerVariables
    // Made public so that it can be called by classes that require information about the
    // camera to be present when initing variables in 'Start'
    public void InitCameraControllerVariables()
    {
        // Get the IPD value (distance between eyes in meters)
        OVRDevice.GetIPD(ref IPD);

        // Get the values for both IPD and lens distortion correction shift. We don't normally
        // need to set the PhysicalLensOffset once it's been set here.
        OVRDevice.GetPhysicalLensOffsetsFromIPD(IPD, ref IPDOffsetLeft, ref IPDOffsetRight);
        LensOffsetLeft  = IPDOffsetLeft;
        LensOffsetRight = IPDOffsetRight;

        // Using the calculated FOV, based on distortion parameters, yeilds the best results.
        // However, public functions will allow to override the FOV if desired
        VerticalFOV = OVRDevice.VerticalFOV();

        // Store aspect ratio as well
        AspectRatio = OVRDevice.CalculateAspectRatio();

        OVRDevice.GetDistortionCorrectionCoefficients(ref DistK0, ref DistK1, ref DistK2, ref DistK3);

        // Get our initial world orientation of the cameras from the scene (we can grab it from
        // the set FollowOrientation object or this OVRCameraController gameObject)
        if (FollowOrientation != null)
        {
            OrientationOffset = FollowOrientation.rotation;
        }
        else
        {
            OrientationOffset = transform.rotation;
        }
    }
예제 #2
0
    /// <summary>
    /// Inits the camera controller variables.
    /// Made public so that it can be called by classes that require information about the
    /// camera to be present when initing variables in 'Start'
    /// </summary>
    public void InitCameraControllerVariables()
    {
        // Get the IPD value (distance between eyes in meters)
        OVRDevice.GetIPD(ref ipd);

        // Using the calculated FOV, based on distortion parameters, yeilds the best results.
        // However, public functions will allow to override the FOV if desired
        VerticalFOV = CameraLeft.GetComponent <OVRCamera>().GetIdealVFOV();
        // Get aspect ratio as well
        AspectRatio = CameraLeft.GetComponent <OVRCamera>().CalculateAspectRatio();

        // Get our initial world orientation of the cameras from the scene (we can grab it from
        // the set FollowOrientation object or this OVRCameraController gameObject)
        if (FollowOrientation != null)
        {
            OrientationOffset = FollowOrientation.rotation;
        }
        else
        {
            OrientationOffset = transform.rotation;
        }

        // Set initial head model
//		OVRDevice.SetHeadModel(EyeCenterPosition.x, EyeCenterPosition.y, EyeCenterPosition.z);
    }
예제 #3
0
    private void Start()
    {
        _initialEyePos = _controller.EyeCenterPosition;
        OVRDevice.GetIPD(ref _initialIPD);
        CameraScale = _defaultSettings.Scale;

        _lastTargetPos = transform.position;
        _lastJump      = -DirtyJumpTime;

        RefreshModeInfo();

        _currentTrackPos      = transform.position;
        _currentTrackRotation = transform.rotation;
    }
    // InitCameraControllerVariables
    // Made public so that it can be called by classes that require information about the
    // camera to be present when initing variables in 'Start'
    public void InitCameraControllerVariables()
    {
        float temp = ipd;

        // Get the IPD value (distance between eyes in meters)
        OVRDevice.GetIPD(ref ipd);

        // Fix so user can specify IPD
        ipd = temp;

        // Get the values for both IPD and lens distortion correction shift. We don't normally
        // need to set the PhysicalLensOffset once it's been set here.
        OVRDevice.CalculatePhysicalLensOffsets(ref LensOffsetLeft, ref LensOffsetRight);

        // Using the calculated FOV, based on distortion parameters, yeilds the best results.
        // However, public functions will allow to override the FOV if desired
        VerticalFOV = OVRDevice.VerticalFOV();

        // Store aspect ratio as well
        AspectRatio = OVRDevice.CalculateAspectRatio();

        OVRDevice.GetDistortionCorrectionCoefficients(ref DistK0, ref DistK1, ref DistK2, ref DistK3);

        // Check to see if we should render in portrait mode
        if (PortraitMode != true)
        {
            PortraitMode = OVRDevice.RenderPortraitMode();
        }

        PrevPortraitMode = false;

        // Get our initial world orientation of the cameras from the scene (we can grab it from
        // the set FollowOrientation object or this OVRCameraController gameObject)
        if (FollowOrientation != null)
        {
            OrientationOffset = FollowOrientation.rotation;
        }
        else
        {
            OrientationOffset = transform.rotation;
        }
    }