Vertices.setAttributes

Automatically calls setAttribute for each member of the struct T.

The second version takes a map that maps the names of the members of T to the names of the attributes. If a name is mapped to null, the member is ignored.

  1. void setAttributes(Buffer!T buffer)
  2. void setAttributes(Buffer!T buffer, string[string] names)
    class Vertices
    void
    setAttributes
    (
    T
    )
    (,
    string[string] names
    )
    if (
    is(T == struct)
    )

Examples

struct Vertex { HVector4f position; Vector3f normal; HVector4 color; }
auto b = new Buffer!Vertex(...);
auto v = new Vertices;

// This:
v.setAttributes(b);
// does the same as:
v.setAttribute("position", b, attributeParametersFor!(Vertex, "position"));
v.setAttribute("normal", b, attributeParametersFor!(Vertex, "normal"));
v.setAttribute("color", b, attributeParametersFor!(Vertex, "color"));

// Also, this:
v.setAttributes(b, ["position":"pos", "normal":null]);
// does the same as:
v.setAttribute("pos", b, attributeParametersFor!(Vertex, "position"));
v.setAttribute("color", b, attributeParametersFor!(Vertex, "color"));

Meta