HMDCameraRightGap() public method

public HMDCameraRightGap ( ) : Vector3
return Vector3
Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (!OvrPro.camStatus)
        {
            return;
        }

        // Initialize camera plane object(Left)
        CameraLeft       = this.transform.Find("LeftCamera").gameObject;
        CameraRight      = this.transform.Find("RightCamera").gameObject;
        CameraPlaneLeft  = CameraLeft.transform.Find("LeftImagePlane").gameObject;
        CameraPlaneRight = CameraRight.transform.Find("RightImagePlane").gameObject;

        CameraLeft.transform.localPosition  = Vector3.zero;
        CameraRight.transform.localPosition = Vector3.zero;
        CameraLeft.transform.localRotation  = Quaternion.identity;
        CameraRight.transform.localRotation = Quaternion.identity;

        //Create cam texture
        CameraTexLeft  = new Texture2D(OvrPro.imageSizeW, OvrPro.imageSizeH, TextureFormat.BGRA32, false);
        CameraTexRight = new Texture2D(OvrPro.imageSizeW, OvrPro.imageSizeH, TextureFormat.BGRA32, false);
        //Cam setting
        CameraTexLeft.wrapMode  = TextureWrapMode.Clamp;
        CameraTexRight.wrapMode = TextureWrapMode.Clamp;

        CameraTexLeft.Apply();
        CameraTexRight.Apply();

        CameraTexLeftPtr  = CameraTexLeft.GetNativeTexturePtr();
        CameraTexRightPtr = CameraTexRight.GetNativeTexturePtr();

        //Mesh
        Mesh m = CreateCameraPlaneMesh();

        CameraPlaneLeft.GetComponent <MeshFilter>().mesh  = m;
        CameraPlaneRight.GetComponent <MeshFilter>().mesh = m;

        //SetShader
        SetShader(camViewShader);

        CameraPlaneLeft.GetComponent <Renderer>().materials[0].SetTexture("_MainTex", CameraTexLeft);
        CameraPlaneRight.GetComponent <Renderer>().materials[0].SetTexture("_MainTex", CameraTexRight);
        CameraPlaneLeft.GetComponent <Renderer>().materials[1].SetTexture("_MainTex", CameraTexLeft);
        CameraPlaneRight.GetComponent <Renderer>().materials[1].SetTexture("_MainTex", CameraTexRight);

        CameraRightGap = OvrPro.HMDCameraRightGap();

        //Plane reset
        CameraPlaneLeft.transform.localScale     = new Vector3(OvrPro.aspectW, -OvrPro.aspectH, 1.0f);
        CameraPlaneRight.transform.localScale    = new Vector3(OvrPro.aspectW, -OvrPro.aspectH, 1.0f);
        CameraPlaneLeft.transform.localPosition  = new Vector3(-0.032f, 0.0f, OvrPro.GetFloatPoint() + IMAGE_ZOFFSET);
        CameraPlaneRight.transform.localPosition = new Vector3(CameraRightGap.x - 0.040f, 0.0f, OvrPro.GetFloatPoint() + IMAGE_ZOFFSET);

        UnityEngine.XR.InputTracking.Recenter();

        //yield return StartCoroutine("CallPluginAtEndOfFrames");
    }