/*private void OnDrawGizmos()
         * {
         *  UnityEditor.Handles.BeginGUI();
         *  GUI.Label(new Rect(0, 0, 128, 128), rt);
         *  UnityEditor.Handles.EndGUI();
         * }*/
#if SRP_LW3_0_0
        private void RenderPipeline_beginCameraRendering(Camera obj)
        {
            if (obj.name != "Main Camera")
            {
                return;
            }

            RenderTexture.active = rt;
            readTexture.ReadPixels(rect, 0, 0);
            depthR  = readTexture.GetPixel((int)(ViewportGazePoint.x * rect.width), (int)(ViewportGazePoint.y * rect.height)).r;
            depthR *= cam.farClipPlane;
            enabled = false;

            onPostRenderCommand.Invoke(ViewportRay, ViewportRay.direction * depthR);
        }
예제 #2
0
        /*private void OnDrawGizmos()
         * {
         *  UnityEditor.Handles.BeginGUI();
         *  GUI.Label(new Rect(0, 0, 128, 128), rt);
         *  UnityEditor.Handles.EndGUI();
         * }*/

        private void OnPreRender()
        {
            //TODO do i need to blit rt to temp? i don't wait for frames, so no need to put into a temporary variable?
            Graphics.Blit(rt, temp);

            RenderTexture.active = temp;
            readTexture.ReadPixels(rect, 0, 0);
            depthR = readTexture.GetPixel((int)(ViewportGazePoint.x * rect.width), (int)(ViewportGazePoint.y * rect.height)).r;

            depthR *= cam.farClipPlane;
            enabled = false;
            onPostRenderCommand.Invoke(ViewportRay, ViewportRay.direction * depthR);
        }