Пример #1
0
        void InitializeContext()
        {
            m_num_video_frames = 0;

            // initialize scratch buffer
            UpdateScratchBuffer();

            // initialize context and stream
            {
                fcAPI.fcGifConfig conf;
                conf.width            = m_scratch_buffer.width;
                conf.height           = m_scratch_buffer.height;
                conf.num_colors       = Mathf.Clamp(m_numColors, 1, 256);
                conf.max_active_tasks = 0;
                m_ctx = fcAPI.fcGifCreateContext(ref conf);
            }

            // initialize command buffer
            {
                int tid = Shader.PropertyToID("_TmpFrameBuffer");
                m_cb      = new CommandBuffer();
                m_cb.name = "GifRecorder: copy frame buffer";
                m_cb.GetTemporaryRT(tid, -1, -1, 0, FilterMode.Bilinear);
                m_cb.Blit(BuiltinRenderTextureType.CurrentActive, tid);
                m_cb.SetRenderTarget(m_scratch_buffer);
                m_cb.DrawMesh(m_quad, Matrix4x4.identity, m_mat_copy, 0, 0);
                m_cb.ReleaseTemporaryRT(tid);
            }
        }
Пример #2
0
        void InitializeContext()
        {
            m_num_video_frames = 0;

            // initialize scratch buffer
            UpdateScratchBuffer();

            // initialize context and stream
            {
                fcAPI.fcGifConfig conf;
                conf.width            = m_scratch_buffer.width;
                conf.height           = m_scratch_buffer.height;
                conf.num_colors       = Mathf.Clamp(m_numColors, 1, 256);
                conf.max_active_tasks = 0;
                m_ctx = fcAPI.fcGifCreateContext(ref conf);
            }

            // initialize command buffer
            {
                m_cb      = new CommandBuffer();
                m_cb.name = "GifOffscreenRecorder: copy frame buffer";
                m_cb.SetRenderTarget(m_scratch_buffer);
                m_cb.SetGlobalTexture("_TmpRenderTarget", m_target);
                m_cb.DrawMesh(m_quad, Matrix4x4.identity, m_mat_copy, 0, 3);
            }
        }
Пример #3
0
        public void BeginRecording()
        {
            if (recording)
            {
                return;
            }

            Reset();

            context = CreateContext(settings);

            recording = true;
        }
Пример #4
0
        void InitializeContext()
        {
            m_num_video_frames = 0;

            // initialize scratch buffer
            UpdateScratchBuffer();

            // initialize context and stream
            {
                fcAPI.fcGifConfig conf;
                conf.width = m_scratch_buffer.width;
                conf.height = m_scratch_buffer.height;
                conf.num_colors = Mathf.Clamp(m_numColors, 1, 256);
                conf.max_active_tasks = 0;
                m_ctx = fcAPI.fcGifCreateContext(ref conf);
            }

            // initialize command buffer
            {
                int tid = Shader.PropertyToID("_TmpFrameBuffer");
                m_cb = new CommandBuffer();
                m_cb.name = "GifRecorder: copy frame buffer";
                m_cb.GetTemporaryRT(tid, -1, -1, 0, FilterMode.Bilinear);
                m_cb.Blit(BuiltinRenderTextureType.CurrentActive, tid);
                m_cb.SetRenderTarget(m_scratch_buffer);
                m_cb.DrawMesh(m_quad, Matrix4x4.identity, m_mat_copy, 0, 0);
                m_cb.ReleaseTemporaryRT(tid);
            }
        }
        void InitializeContext()
        {
            m_num_video_frames = 0;

            // initialize scratch buffer
            UpdateScratchBuffer();

            // initialize context and stream
            {
                fcAPI.fcGifConfig conf;
                conf.width = m_scratch_buffer.width;
                conf.height = m_scratch_buffer.height;
                conf.num_colors = Mathf.Clamp(m_numColors, 1, 256);
                conf.max_active_tasks = 0;
                m_ctx = fcAPI.fcGifCreateContext(ref conf);
            }

            // initialize command buffer
            {
                m_cb = new CommandBuffer();
                m_cb.name = "GifOffscreenRecorder: copy frame buffer";
                m_cb.SetRenderTarget(m_scratch_buffer);
                m_cb.SetGlobalTexture("_TmpRenderTarget", m_target);
                m_cb.DrawMesh(m_quad, Matrix4x4.identity, m_mat_copy, 0, 3);
            }
        }