예제 #1
0
        public void Initialize(RenderTexture src_rt, Camera src_cam, PostRenderCommandCallback postcallback)
        {
            cam = src_cam;
            rt  = src_rt;
            res = rt.width;
            onPostRenderCommand = postcallback;
            readTexture         = new Texture2D(res, res, TextureFormat.RGBAFloat, false);
            temp    = new RenderTexture(rt.width, rt.height, 0, RenderTextureFormat.ARGBFloat);
            enabled = false;

#if CVR_FOVE
            //fove does it's own rendering stuff and doesn't render singlepass side by side to a texture
            rect = new Rect(0, 0, res, res);
#else
            if (CognitiveVR.CognitiveVR_Preferences.Instance.RenderPassType == 1) //ie singlepass
            {
                //steam renders this side by side with mask
                //oculus renders side by side full size
                rect = new Rect(0, 0, res / 2, res);
            }
            else
            {
                rect = new Rect(0, 0, res, res);
            }
#endif
        }
예제 #2
0
        public void Initialize(RenderTexture src_rt, Camera src_cam, PostRenderCommandCallback postcallback, CommandGaze gaze)
        {
#if UNITY_2018_2_OR_NEWER
            this.gaze = gaze;
#endif
            cam                 = src_cam;
            rt                  = src_rt;
            debugtex            = new Texture2D(rt.width, rt.height, TextureFormat.RGBAFloat, false);
            onPostRenderCommand = postcallback;
#if SRP_LW3_0_0
            readTexture = new Texture2D(rt.width, rt.height, TextureFormat.RGBAFloat, false);
            UnityEngine.Experimental.Rendering.RenderPipeline.beginCameraRendering += RenderPipeline_beginCameraRendering;
#else
            readTexture = new Texture2D(rt.width, rt.width, TextureFormat.RGBAFloat, false);
#endif
            temp    = new RenderTexture(rt.width, rt.height, 0, RenderTextureFormat.ARGBFloat);
            enabled = false;

#if CVR_FOVE
            //fove does it's own rendering stuff and doesn't render singlepass side by side to a texture
            rect = new Rect(0, 0, rt.width, rt.height);
#else
#if UNITY_2017_2_OR_NEWER
            if (CognitiveVR.CognitiveVR_Preferences.Instance.RenderPassType == 1 && UnityEngine.XR.XRSettings.enabled) //ie singlepass
            {
#else
            if (CognitiveVR.CognitiveVR_Preferences.Instance.RenderPassType == 1 && UnityEngine.VR.VRSettings.enabled) //ie singlepass
            {
#endif
#if CVR_OCULUS
                //oculus renders side by side without a mask
                rect = new Rect(0, 0, rt.width / 2, rt.height);
#elif CVR_DEFAULT || CVR_STEAMVR || CVR_STEAMVR2 //eye tracking should use physics gaze!
                //steam renders this side by side with mask
                rect = new Rect(0, 0, rt.width / 2, rt.height);
#else //adhawk, tobii, fove, pupil, neurable, vive pro eye
                rect = new Rect(0, 0, rt.width / 2, rt.height);
#endif
            }
            else
            {
                rect = new Rect(0, 0, rt.width, rt.height);
            }
#endif

#if UNITY_2018_2_OR_NEWER
            if (SystemInfo.supportsAsyncGPUReadback)
            {
                supportsAsyncGPUReadback = true;
            }
#endif
        }

        float depthR;
        Rect rect;

        Vector3 ViewportGazePoint;
        Ray ViewportRay;