public static DynamicIndexBuffer Create(ushort[] indices, BufferFlags flags = BufferFlags.None)
        {
            var index_buffer = new DynamicIndexBuffer
            {
                Handle = GraphicsContext.CreateDynamicIndexBuffer(indices, flags)
            };

            GraphicsContext.RegisterAllocatedResource(index_buffer);

            return(index_buffer);
        }
        public static DynamicIndexBuffer Create(int index_count)
        {
            var index_buffer = new DynamicIndexBuffer
            {
                Handle = GraphicsContext.CreateDynamicIndexBuffer(index_count)
            };

            GraphicsContext.RegisterAllocatedResource(index_buffer);

            return(index_buffer);
        }
Exemple #3
0
        public VertexStream(VertexStreamMode stream_mode = VertexStreamMode.Stream)
        {
            if (stream_mode == VertexStreamMode.Static)
            {
                throw new Exception("Invalid VertexStream mode for this constructor: A static VertexStream must be constructed with a pre made vertex array");
            }

            m_stream_mode = stream_mode;

            m_vertices = new Vertex[INITIAL_MAX_BUFFER];
            m_indices  = new ushort[INITIAL_MAX_BUFFER];

            if (stream_mode == VertexStreamMode.Dynamic)
            {
                m_dynamic_vertex_buffer = DynamicVertexBuffer.Create(m_vertices, m_vertex_layout);
                m_dynamic_index_buffer  = DynamicIndexBuffer.Create(m_indices);
            }

            m_vertex_count = 0;
            m_index_count  = 0;
        }