diff options
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/attribs')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/attribs/AttributeSet.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/attribs/AttributeSet.java b/src/main/java/makamys/neodymium/renderer/attribs/AttributeSet.java index ebf9c4c..e90bfac 100644 --- a/src/main/java/makamys/neodymium/renderer/attribs/AttributeSet.java +++ b/src/main/java/makamys/neodymium/renderer/attribs/AttributeSet.java @@ -8,14 +8,19 @@ import java.util.Map; public class AttributeSet { private final List<VertexAttribute> attributes = new ArrayList<>(); + private int stride = 0; public void addAttribute(String name, int size, int elementSize, int type) { int index = attributes.size(); attributes.add(new VertexAttribute(name, index, size, elementSize, type)); + stride += elementSize * size; + } + + public int stride() { + return stride; } public void enable() { - int stride = attributes.stream().mapToInt(attrib -> attrib.size * attrib.elementSize).sum(); int offset = 0; for (int i = 0, size = attributes.size(); i < size; i++) { VertexAttribute attribute = attributes.get(i); |