Ejemplo n.º 1
0
        public void CreateIndirectDrawCommands(BucketManager bucketManager, InstanceDataBuffer instanceData)
        {
            foreach (var commandBuffer in PrimitiveIndirectDrawBuffer.Values)
            {
                if (commandBuffer.Count > 0)
                {
                    return;
                }
                commandBuffer.Clear( );
            }

            foreach (var part in InstanceManager.Parts)
            {
                var bucket        = bucketManager.GetBucketResource(part);
                var primitiveType = part.PrimitiveType;

                var bufferKey = new IndirectCommandBufferKey(bucket, primitiveType);

                if (!PrimitiveIndirectDrawBuffer.ContainsKey(bufferKey))
                {
                    PrimitiveIndirectDrawBuffer[bufferKey] = new IndirectDrawCommandBuffer(primitiveType, bucket);
                }
                PrimitiveIndirectDrawBuffer[bufferKey].AddDrawCommand(part, bucket,
                                                                      instanceData[part]);
            }

            foreach (var indirectDrawCommandBuffers in PrimitiveIndirectDrawBuffer.Values)
            {
                indirectDrawCommandBuffers.CreateCommandBuffer( );
            }
        }
 public BindHandle(IndirectDrawCommandBuffer indirectDrawCommandBuffer)
 {
     GL.BindBuffer(BufferTarget.DrawIndirectBuffer, indirectDrawCommandBuffer.BufferId);
 }