Ejemplo n.º 1
0
        public static void DrawRenderTarget(Rendering.RenderTarget rt, Rectangle rect, Color color, bool withAlpha = false)
        {
#if UNIT_TEST_COMPILANT
            throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set.");
#else
            Internal_DrawRenderTarget(Object.GetUnmanagedPtr(rt), ref rect, ref color, withAlpha);
#endif
        }
Ejemplo n.º 2
0
        public void CopyTexture(RenderTarget dstResource, uint dstSubresource, uint dstX, uint dstY, uint dstZ, RenderTarget srcResource, uint srcSubresource)
        {
#if UNIT_TEST_COMPILANT
            throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set.");
#else
            Internal_CopyTextureRegion4(unmanagedPtr, Object.GetUnmanagedPtr(dstResource), dstSubresource, dstX, dstY, dstZ, Object.GetUnmanagedPtr(srcResource), srcSubresource);
#endif
        }
Ejemplo n.º 3
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>
 public void DrawPostFxMaterial(MaterialBase material, RenderTarget output, RenderTarget input = null)
 {
     DrawPostFxMaterial(material, output.View(), input);
 }
Ejemplo n.º 4
0
        public void DrawPostFxMaterial(MaterialBase material, RenderTargetView view, ref Viewport viewport, RenderTarget input = null)
        {
#if UNIT_TEST_COMPILANT
            throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set.");
#else
            Internal_DrawPostFxMaterial3(unmanagedPtr, Object.GetUnmanagedPtr(material), view, ref viewport, Object.GetUnmanagedPtr(input));
#endif
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Executes the draw calls.
        /// </summary>
        /// <param name="context">The GPU command context.</param>
        /// <param name="task">The render task.</param>
        /// <param name="output">The output texture.</param>
        /// <param name="outputDepth">The output depth texture.</param>
        /// <param name="pass">The rendering pass mode.</param>
        public void ExecuteDrawCalls(GPUContext context, RenderTask task, RenderTarget output, RenderTarget outputDepth, RenderPass pass)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            GPUContext.Internal_ExecuteDrawCalls(context.unmanagedPtr, task.unmanagedPtr, output.unmanagedPtr, Object.GetUnmanagedPtr(outputDepth), DrawCalls, pass);
        }
Ejemplo n.º 6
0
 public Temporary(PixelFormat format, int width, int height, TextureFlags flags, MSAALevel msaa)
 {
     Texture = New();
     Texture.Init(format, width, height, flags, 1, msaa);
 }
Ejemplo n.º 7
0
 public Temporary(PixelFormat format, int width, int height, TextureFlags flags)
 {
     Texture = New();
     Texture.Init(format, width, height, flags);
 }
Ejemplo n.º 8
0
        public void DrawScene(RenderTask task, RenderTarget output, RenderBuffers buffers, RenderView view, ViewFlags flags, ViewMode mode, Actor[] customActors = null, ActorsSources actorsSource = ActorsSources.ScenesAndCustomActors, HashSet <PostProcessEffect> customPostFx = null)
        {
#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
            IntPtr[] actors      = null;
            int      actorsCount = 0;
            if (customActors != null)
            {
                actorsCount = customActors.Length;
                if (_cachedActors == null || _cachedActors.Length < actorsCount)
                {
                    _cachedActors = new IntPtr[Mathf.NextPowerOfTwo(actorsCount)];
                }
                actors = _cachedActors;

                for (int i = 0; i < actorsCount; i++)
                {
                    _cachedActors[i] = GetUnmanagedPtr(customActors[i]);
                }
            }

            // Get unmanaged postFx
            IntPtr[] postFx      = null;
            int      postFxCount = 0;
            if (customPostFx != null && customPostFx.Count > 0)
            {
                if (_cachedPostFxA == null)
                {
                    _cachedPostFxA = new List <PostProcessEffect>();
                }
                _cachedPostFxA.Capacity = Mathf.Max(_cachedPostFxA.Capacity, Mathf.NextPowerOfTwo(customPostFx.Count));

                foreach (var e in customPostFx)
                {
                    if (e && e.CanRender)
                    {
                        _cachedPostFxA.Add(e);
                    }
                }

                _cachedPostFxA.Sort(ComparePostFx);

                postFxCount = _cachedPostFxA.Count;
                if (_cachedPostFxB == null || _cachedPostFxB.Length < postFxCount)
                {
                    _cachedPostFxB = new IntPtr[_cachedPostFxA.Capacity];
                }
                postFx = _cachedPostFxB;

                for (int i = 0; i < postFxCount; i++)
                {
                    _cachedPostFxB[i] = GetUnmanagedPtr(_cachedPostFxA[i]);
                }

                _cachedPostFxA.Clear();
            }

            Internal_DrawScene(unmanagedPtr, GetUnmanagedPtr(task), GetUnmanagedPtr(output), GetUnmanagedPtr(buffers), ref view, flags, mode, actors, actorsCount, actorsSource, postFx, postFxCount);
#endif
        }