public VertexAttribute Add(VertexAttribute attribute) { attribute.Offset = Stride; Stride += attribute.Stride(); _attributes.Add(attribute); return(attribute); }
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); }
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); }
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); }