예제 #1
0
        public void Render(RenderContext context, IPipeline pipeline, IViewport viewport, CommandList cl, ILocation locationObject)
        {
            var groupLocation = (GroupLocation)locationObject;

            var i  = groupLocation.Index;
            var bg = groupLocation.Group;

            cl.SetVertexBuffer(0, _buffer.VertexBuffers[i]);
            cl.SetIndexBuffer(_buffer.IndexBuffers[i], IndexFormat.UInt32);
            pipeline.Bind(context, cl, bg.Binding);
            _buffer.IndirectBuffers[i].DrawIndexed(cl, bg.Offset * IndSize, bg.Count, 20);
        }
예제 #2
0
        public void Render(RenderContext context, IPipeline pipeline, IViewport viewport, CommandList cl)
        {
            for (var i = 0; i < _buffer.NumBuffers; i++)
            {
                var groups = _buffer.IndirectBufferGroups[i].Where(x => x.Pipeline == pipeline.Type && !x.HasTransparency).Where(x => x.Camera == CameraType.Both || x.Camera == viewport.Camera.Type).ToList();
                if (!groups.Any())
                {
                    continue;
                }

                cl.SetVertexBuffer(0, _buffer.VertexBuffers[i]);
                cl.SetIndexBuffer(_buffer.IndexBuffers[i], IndexFormat.UInt32);
                foreach (var bg in groups)
                {
                    pipeline.Bind(context, cl, bg.Binding);
                    _buffer.IndirectBuffers[i].DrawIndexed(cl, bg.Offset * IndSize, bg.Count, 20);
                }
            }
        }