aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/renderer/attribs
diff options
context:
space:
mode:
authorFalsePattern <me@falsepattern.com>2023-12-01 13:29:09 +0100
committermakamys <makamys@outlook.com>2023-12-01 18:34:00 +0100
commit68357a8cc9c8cf9eab9e177cb6aea18cfbc3f584 (patch)
tree932dd32510e56db5320cc616f0db052defaf7d3a /src/main/java/makamys/neodymium/renderer/attribs
parentfbe408c777dcf6ea5d2d784b739287d6db2bf52c (diff)
downloadNeodymium-68357a8cc9c8cf9eab9e177cb6aea18cfbc3f584.tar.gz
Neodymium-68357a8cc9c8cf9eab9e177cb6aea18cfbc3f584.tar.bz2
Neodymium-68357a8cc9c8cf9eab9e177cb6aea18cfbc3f584.zip
unify stride calculation into NeoRenderer
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/attribs')
-rw-r--r--src/main/java/makamys/neodymium/renderer/attribs/AttributeSet.java7
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);