[PlutoMesher] Renamed all occurrences of 'attrib' to 'attribute'

This commit is contained in:
493msi 2020-09-18 15:42:04 +02:00
parent d026a2b9e6
commit 7128f5b055
3 changed files with 23 additions and 18 deletions

View File

@ -1,5 +1,10 @@
## 20.2.0.0-alpha.2
* `build.gradle` Extracted the version numbers into separate variables
* `build.gradle` **[experimental]** `gradlew` should now automatically download JDK11 when needed
* `build.gradle` Updated the build scripts and added source Maven publication
* `[PlutoMesher]` Renamed all occurrences of `attrib` to `attribute`
* Renamed `VertexArray#createArrayAttrib` to `VertexArray#createArrayAttribute`
* Renamed `VertexArray#getVertexAttribs` to `VertexArray#getVertexAttributes`
* `[PlutoCore]` Made `PlutoApplication.StartupConfig` fields private, options
can now only be modified only through public setters

View File

@ -16,35 +16,35 @@ import cz.tefek.pluto.io.logger.SmartSeverity;
public class VertexArray
{
protected final List<Integer> usedAttribs;
protected final Vector<ArrayBuffer<?>> vertexAttribs;
protected final List<Integer> usedAttributes;
protected final Vector<ArrayBuffer<?>> vertexAttributes;
protected IndexArrayBuffer indices;
private int vertexCount;
protected int glID = 0;
protected int glID;
public VertexArray()
{
int maxAttribs = GL33.glGetInteger(GL33.GL_MAX_VERTEX_ATTRIBS);
int maxAttributes = GL33.glGetInteger(GL33.GL_MAX_VERTEX_ATTRIBS);
this.usedAttribs = new ArrayList<>(maxAttribs);
this.vertexAttribs = new Vector<ArrayBuffer<?>>(maxAttribs);
this.vertexAttribs.setSize(maxAttribs);
this.usedAttributes = new ArrayList<>(maxAttributes);
this.vertexAttributes = new Vector<>(maxAttributes);
this.vertexAttributes.setSize(maxAttributes);
this.glID = GL33.glGenVertexArrays();
Logger.logf(SmartSeverity.ADDED, "Vertex array ID %d created...\n", this.glID);
}
public void createArrayAttrib(ArrayBuffer<?> buffer, int attribID)
public void createArrayAttribute(ArrayBuffer<?> buffer, int attribID)
{
this.bind();
buffer.bind();
GL33.glVertexAttribPointer(attribID, buffer.getVertexDimensions(), buffer.getType().getGLID(), false, 0, 0);
this.vertexAttribs.set(attribID, buffer);
this.usedAttribs.add(attribID);
this.vertexAttributes.set(attribID, buffer);
this.usedAttributes.add(attribID);
if (!this.hasIndices())
{
@ -52,9 +52,9 @@ public class VertexArray
}
}
public List<ArrayBuffer<?>> getVertexAttribs()
public List<ArrayBuffer<?>> getVertexAttributes()
{
return Collections.unmodifiableList(this.vertexAttribs);
return Collections.unmodifiableList(this.vertexAttributes);
}
public int getVertexCount()
@ -64,7 +64,7 @@ public class VertexArray
public void enableAllAttributes()
{
this.usedAttribs.stream().forEach(GL33::glEnableVertexAttribArray);
this.usedAttributes.forEach(GL33::glEnableVertexAttribArray);
}
public void bindIndices(IndexArrayBuffer buffer)
@ -121,9 +121,9 @@ public class VertexArray
public void delete()
{
this.usedAttribs.stream().map(this.vertexAttribs::get).forEach(ArrayBuffer::delete);
this.vertexAttribs.clear();
this.usedAttribs.clear();
this.usedAttributes.stream().map(this.vertexAttributes::get).forEach(ArrayBuffer::delete);
this.vertexAttributes.clear();
this.usedAttributes.clear();
if (this.indices != null)
{

View File

@ -16,14 +16,14 @@ public class VertexArrayBuilder
public VertexArrayBuilder vertices(VecArray<float[]> vertices)
{
this.va.createArrayAttrib(new FloatArrayBuffer(vertices), ReservedAttributes.POSITION);
this.va.createArrayAttribute(new FloatArrayBuffer(vertices), ReservedAttributes.POSITION);
return this;
}
public VertexArrayBuilder uvs(VecArray<float[]> uvs)
{
this.va.createArrayAttrib(new FloatArrayBuffer(uvs), ReservedAttributes.UV);
this.va.createArrayAttribute(new FloatArrayBuffer(uvs), ReservedAttributes.UV);
return this;
}