small refactor

This commit is contained in:
2025-03-20 14:40:32 +01:00
parent faa92d09de
commit 0c35c38ccd
3 changed files with 5 additions and 17 deletions

View File

@@ -1,13 +1,5 @@
package chess.render; package chess.render;
public class VertexAttribPointer { public record VertexAttribPointer(int index, int size, int offset) {
public int index;
public int size;
public int offset;
public VertexAttribPointer(int index, int size, int offset) {
this.index = index;
this.size = size;
this.offset = offset;
}
} }

View File

@@ -2,7 +2,6 @@ package chess.render;
import static org.lwjgl.opengl.GL11.GL_FLOAT; import static org.lwjgl.opengl.GL11.GL_FLOAT;
import java.nio.FloatBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@@ -42,9 +41,9 @@ public class VertexBuffer {
public void BindVertexAttribs() { public void BindVertexAttribs() {
for (VertexAttribPointer vertexAttribPointer : vertexAttribs) { for (VertexAttribPointer vertexAttribPointer : vertexAttribs) {
GL30.glEnableVertexAttribArray(vertexAttribPointer.index); GL30.glEnableVertexAttribArray(vertexAttribPointer.index());
GL30.glVertexAttribPointer(vertexAttribPointer.index, vertexAttribPointer.size, GL_FLOAT, false, GL30.glVertexAttribPointer(vertexAttribPointer.index(), vertexAttribPointer.size(), GL_FLOAT, false,
this.dataStride * 4, vertexAttribPointer.offset); this.dataStride * 4, vertexAttribPointer.offset());
} }
} }
} }

View File

@@ -5,9 +5,6 @@ import org.lwjgl.glfw.*;
import org.lwjgl.opengl.*; import org.lwjgl.opengl.*;
import org.lwjgl.system.*; import org.lwjgl.system.*;
import chess.render.Camera;
import chess.render.Renderer;
import java.nio.*; import java.nio.*;
import static org.lwjgl.glfw.Callbacks.*; import static org.lwjgl.glfw.Callbacks.*;