Пример #1
0
        public void DrawSceneDepth(SceneRenderTask task, GPUTexture output, List <Actor> customActors = null, ActorsSources actorsSource = ActorsSources.Scenes)
        {
#if UNIT_TEST_COMPILANT
            throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set.");
#else
            // Get unmanaged actors
            var actors = GetActors(customActors, out int actorsCount);

            Internal_DrawSceneDepth(unmanagedPtr, GetUnmanagedPtr(task), GetUnmanagedPtr(output), actors, actorsCount, actorsSource);
#endif
        }
Пример #2
0
        /// <inheritdoc />
        public override void Render(GPUContext context, SceneRenderTask task, RenderTarget input, RenderTarget output)
        {
            // TODO: apply frustum culling to skip rendering if canvas is not in a viewport

            Profiler.BeginEventGPU("UI Canvas");

            // Calculate rendering matrix (world*view*projection)
            Matrix viewProjection;
            Matrix world;

            Canvas.GetWorldMatrix(out world);
            Matrix view;

            Matrix.Multiply(ref world, ref task.View.View, out view);
            Matrix.Multiply(ref view, ref task.View.Projection, out viewProjection);

            // Pick a depth buffer
            RenderTarget depthBuffer = Canvas.IgnoreDepth ? null : task.Buffers.DepthBuffer;

            // Render GUI in 3D
            Render2D.CallDrawing(Canvas.GUI, context, input, depthBuffer, ref viewProjection);

            Profiler.EndEventGPU();
        }
Пример #3
0
 /// <summary>
 /// Draws scene objects depth (to the output Z buffer). The output must be depth texture to write hardware depth to it.
 /// </summary>
 /// <param name="context">The GPU commands context to use.</param>
 /// <param name="task">Render task to use it's view description and the render buffers.</param>
 /// <param name="output">The output texture. Must be valid and created.</param>
 /// <param name="customActors">The custom set of actors to render. If empty, the loaded scenes will be rendered.</param>
 public static void DrawSceneDepth(GPUContext context, SceneRenderTask task, GPUTexture output, List <Actor> customActors)
 {
     Internal_DrawSceneDepth(FlaxEngine.Object.GetUnmanagedPtr(context), FlaxEngine.Object.GetUnmanagedPtr(task), FlaxEngine.Object.GetUnmanagedPtr(output), Utils.ExtractArrayFromList(customActors));
 }
Пример #4
0
 /// <summary>
 /// Draws scene objects depth (to the output Z buffer). The output must be depth texture to write hardware depth to it.
 /// </summary>
 /// <param name="context">The GPU commands context to use.</param>
 /// <param name="task">Render task to use it's view description and the render buffers.</param>
 /// <param name="output">The output texture. Must be valid and created.</param>
 /// <param name="customActors">The custom set of actors to render. If empty, the loaded scenes will be rendered.</param>
 public static void DrawSceneDepth(GPUContext context, SceneRenderTask task, GPUTexture output, Actor[] customActors)
 {
     Internal_DrawSceneDepth(FlaxEngine.Object.GetUnmanagedPtr(context), FlaxEngine.Object.GetUnmanagedPtr(task), FlaxEngine.Object.GetUnmanagedPtr(output), customActors);
 }
Пример #5
0
 /// <summary>
 /// Captures the specified render task backbuffer contents and saves it to the file.
 /// Remember that downloading data from the GPU may take a while so screenshot may be taken one or more frames later due to latency.
 /// </summary>
 /// <param name="target">The target task to capture it's backbuffer.</param>
 /// <param name="path">The custom file location. Use null or empty to use default one.</param>
 public static void Capture(SceneRenderTask target = null, string path = null)
 {
     Internal_Capture1(FlaxEngine.Object.GetUnmanagedPtr(target), path);
 }
Пример #6
0
        /// <summary>
        /// Draws postFx material to the render target.
        /// </summary>
        /// <param name="material">The material to render. It must be a post fx material.</param>
        /// <param name="output">The output texture. Must be valid and created.</param>
        /// <param name="input">The input texture. It's optional.</param>
        /// <param name="sceneRenderTask">Render task to use it's view description and the render buffers.</param>
        public void DrawPostFxMaterial(MaterialBase material, GPUTexture output, GPUTexture input, SceneRenderTask sceneRenderTask)
        {
#if UNIT_TEST_COMPILANT
            throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set.");
#else
            Internal_DrawPostFxMaterial1(unmanagedPtr, GetUnmanagedPtr(material), GetUnmanagedPtr(output), GetUnmanagedPtr(input), ref sceneRenderTask.View, Object.GetUnmanagedPtr(sceneRenderTask.Buffers));
#endif
        }