Exemplo n.º 1
0
        unsafe public override void Render(Renderer.IndirectDrawEncoder encoder, SceneRenderPipeline sp)
        {
            if (!IsVisible)
            {
                return;
            }

            if (NvmResource == null || !NvmResource.IsLoaded || NvmResource.Get() == null)
            {
                return;
            }

            if (NvmResource.TryLock())
            {
                var resource   = NvmResource.Get();
                var geombuffer = resource.GeomBuffer;

                if (geombuffer.AllocStatus != VertexIndexBufferAllocator.VertexIndexBufferHandle.Status.Resident)
                {
                    NvmResource.Unlock();
                    return;
                }

                uint indexStart = geombuffer.IAllocationStart / 4u;
                var  args       = new Renderer.IndirectDrawIndexedArgumentsPacked();
                args.FirstInstance = WorldBuffer.AllocationStart / (uint)sizeof(InstanceData);
                args.VertexOffset  = (int)(geombuffer.VAllocationStart / Resource.CollisionLayout.SizeInBytes);
                args.InstanceCount = 1;
                args.FirstIndex    = indexStart;
                args.IndexCount    = geombuffer.IAllocationSize / 4u;
                encoder.AddDraw(ref args, geombuffer.BufferIndex, RenderPipeline, PerObjRS, IndexFormat.UInt32);
                NvmResource.Unlock();
            }
        }
Exemplo n.º 2
0
 //public abstract void Render(GraphicsDevice gd, CommandList cl, SceneRenderPipeline sp);
 public abstract void Render(Renderer.IndirectDrawEncoder encoder, SceneRenderPipeline sp);