예제 #1
0
        public void DrawScene(RenderTask task, GPUTexture output, RenderBuffers buffers, ref RenderView view, List <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
            var actors = GetActors(customActors, out int actorsCount);

            // Get unmanaged postFx
            var postFx = GetPostFx(customPostFx, out int postFxCount);

            Internal_DrawScene(unmanagedPtr, GetUnmanagedPtr(task), GetUnmanagedPtr(output), GetUnmanagedPtr(buffers), ref view, actors, actorsCount, actorsSource, postFx, postFxCount);
#endif
        }
예제 #2
0
        internal override void OnRender(GPUContext context)
        {
            // Create buffers if missing
            if (Buffers == null)
            {
                Buffers = RenderBuffers.New();
            }

            // Prepare view
            OnBegin(context);
            Viewport viewport = new Viewport(Vector2.Zero, Buffers.Size);

            if (Camera != null)
            {
                View.CopyFrom(Camera, ref viewport);
            }

            // Get custom post effects to render (registered ones and from the current camera)
            _postFx.Clear();
            foreach (var e in CustomPostFx)
            {
                _postFx.Add(e);
            }
            if (AllowGlobalCustomPostFx)
            {
                foreach (var e in GlobalCustomPostFx)
                {
                    _postFx.Add(e);
                }
            }
            if (Camera != null)
            {
                var perCameraPostFx = Camera.GetScripts <PostProcessEffect>();
                for (int i = 0; i < perCameraPostFx.Length; i++)
                {
                    _postFx.Add(perCameraPostFx[i]);
                }
            }

            // Call scene rendering
            context.DrawScene(this, Output, Buffers, ref View, CustomActors, ActorsSource, _postFx);
            FrameCount++;

            // Finish
            OnEnd(context);
        }
예제 #3
0
        public void DrawPostFxMaterial(MaterialBase material, GPUTexture output, GPUTexture input, RenderView view, RenderBuffers buffers = null)
        {
#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, FlaxEngine.Object.GetUnmanagedPtr(material), FlaxEngine.Object.GetUnmanagedPtr(output), FlaxEngine.Object.GetUnmanagedPtr(input), ref view, FlaxEngine.Object.GetUnmanagedPtr(buffers));
#endif
        }