Exemple #1
0
 /// <summary>
 /// Sets a new binding
 /// </summary>
 /// <param name="buffer">VertexBufferObject for the binding</param>
 public int SetBinding(VertexBufferObject buffer)
 {
     return SetBinding(buffer, 0, 0);
 }
Exemple #2
0
        /// <summary>
        /// Sets a new binding
        /// </summary>
        /// <param name="buffer">VertexBufferObject for the binding</param>
        /// <param name="vertexOffset">Vertex offset in the buffer</param>
        /// <param name="frequency">Number of instance to draw</param>
        /// <returns>Returns the index at which the binding is stored</returns>
        public int SetBinding(VertexBufferObject buffer, int vertexOffset, int frequency)
        {
            int index = _bindings.Count;
            SetBinding(buffer, vertexOffset, frequency, index);

            return index;
        }
Exemple #3
0
        /// <summary>
        /// Sets a new binding
        /// </summary>
        /// <param name="buffer">VertexBufferObject for the binding</param>
        /// <param name="vertexOffset">Vertex offset in the buffer</param>
        /// <param name="frequency">Number of instance to draw</param>
        /// <param name="index">Index where to insert the binding</param>
        public void SetBinding(VertexBufferObject buffer, int vertexOffset, int frequency, int index)
        {
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            BindingInfo inf = new BindingInfo
            {
                BufferObject = buffer,
                VertexOffset = vertexOffset,
                Frequency = frequency
            };

            if(index >= _bindings.Count)
                _bindings.Add(inf);
            else
                _bindings.Insert(index, inf);

            buffer.VertexBufferAllocated += BufferAllocated;
            ResizeBindingArray();
        }