Exemple #1
0
 public VertexAttribute Add(VertexAttribute attribute)
 {
     attribute.Offset = Stride;
     Stride          += attribute.Stride();
     _attributes.Add(attribute);
     return(attribute);
 }
Exemple #2
0
        public VertexAttribute GetAttribute(VertexUsage usage, int index = 0)
        {
            VertexAttribute attribute = _attributes.FirstOrDefault(a => a.Usage == usage && a.Index == index);

            if (attribute == null)
            {
                throw new InvalidOperationException("VertexAttrubute not found");
            }
            return(attribute);
        }
Exemple #3
0
        public AttributeBinding AddBinding(
            int index,
            VertexUsage usage,
            int usageIndex = 0)
        {
            VertexAttribute  v       = _vertexBuffer.VertexFormat.GetAttribute(usage, usageIndex);
            AttributeBinding binding = new AttributeBinding(index, v.Dimension, v.Type, v.Normalized, _vertexBuffer.VertexFormat.Stride, v.Offset);

            _bindings.Add(binding);
            _dirty = true;
            return(binding);
        }
Exemple #4
0
        public VertexAttribute Add(VertexUsage usage,
                                   VertexAttribPointerType type,
                                   int index,
                                   int dimension,
                                   int offset,
                                   bool normalized)
        {
            VertexAttribute attribute = new VertexAttribute()
            {
                Usage = usage, Type = type, Index = index, Dimension = dimension, Offset = offset, Normalized = normalized
            };

            Stride += attribute.Stride();
            _attributes.Add(attribute);
            return(attribute);
        }