예제 #1
0
        public void BeginCamera(Camera camera)
        {
            m_camera        = camera;
            m_threadGroupsX = Mathf.CeilToInt((float)camera.pixelWidth / THREADS_PER_GROUP);
            m_threadGroupsY = Mathf.CeilToInt((float)camera.pixelHeight / THREADS_PER_GROUP);

            m_renderTarget = _renderTargetsRepository.GetRT(camera);

            m_shapeData.Clear();
            m_shapes.GetShapeData(m_shapeData);
            _buffer = new ComputeBuffer(m_shapeData.Count, ShapeData.GetStructSize());
            _buffer.SetData(m_shapeData);
        }
예제 #2
0
        private void DrawGameView(ScriptableRenderContext context, Camera camera)
        {
            RenderTexture renderTarget = _renderTargetsRepository.GetRT(camera);
            CommandBuffer commands     = CommandBufferPool.Get(camera.name);

            commands.SetRenderTarget(renderTarget);
            commands.ClearRenderTarget(true, true, Color.black);
            ExecuteBuffer(context, commands);
            context.DrawSkybox(camera);

            commands.BeginSample("Raymarching");
            m_raymarcher.BeginCamera(camera);
            m_raymarcher.Render(commands, renderTarget);
            commands.EndSample("Raymarching");
            ExecuteBuffer(context, commands);
            m_raymarcher.EndCamera();

            commands.SetRenderTarget((RenderTexture)null);
            RenderScreenQuad(commands, renderTarget);
            ExecuteBuffer(context, commands);

            CommandBufferPool.Release(commands);
        }