[PlutoMesher] Renamed all occurrences of 'attrib' to 'attribute'
This commit is contained in:
parent
d026a2b9e6
commit
7128f5b055
|
@ -1,5 +1,10 @@
|
||||||
## 20.2.0.0-alpha.2
|
## 20.2.0.0-alpha.2
|
||||||
* `build.gradle` Extracted the version numbers into separate variables
|
* `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
|
* `[PlutoCore]` Made `PlutoApplication.StartupConfig` fields private, options
|
||||||
can now only be modified only through public setters
|
can now only be modified only through public setters
|
||||||
|
|
||||||
|
|
|
@ -16,35 +16,35 @@ import cz.tefek.pluto.io.logger.SmartSeverity;
|
||||||
|
|
||||||
public class VertexArray
|
public class VertexArray
|
||||||
{
|
{
|
||||||
protected final List<Integer> usedAttribs;
|
protected final List<Integer> usedAttributes;
|
||||||
protected final Vector<ArrayBuffer<?>> vertexAttribs;
|
protected final Vector<ArrayBuffer<?>> vertexAttributes;
|
||||||
|
|
||||||
protected IndexArrayBuffer indices;
|
protected IndexArrayBuffer indices;
|
||||||
|
|
||||||
private int vertexCount;
|
private int vertexCount;
|
||||||
protected int glID = 0;
|
protected int glID;
|
||||||
|
|
||||||
public VertexArray()
|
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.usedAttributes = new ArrayList<>(maxAttributes);
|
||||||
this.vertexAttribs = new Vector<ArrayBuffer<?>>(maxAttribs);
|
this.vertexAttributes = new Vector<>(maxAttributes);
|
||||||
this.vertexAttribs.setSize(maxAttribs);
|
this.vertexAttributes.setSize(maxAttributes);
|
||||||
|
|
||||||
this.glID = GL33.glGenVertexArrays();
|
this.glID = GL33.glGenVertexArrays();
|
||||||
|
|
||||||
Logger.logf(SmartSeverity.ADDED, "Vertex array ID %d created...\n", this.glID);
|
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();
|
this.bind();
|
||||||
buffer.bind();
|
buffer.bind();
|
||||||
GL33.glVertexAttribPointer(attribID, buffer.getVertexDimensions(), buffer.getType().getGLID(), false, 0, 0);
|
GL33.glVertexAttribPointer(attribID, buffer.getVertexDimensions(), buffer.getType().getGLID(), false, 0, 0);
|
||||||
|
|
||||||
this.vertexAttribs.set(attribID, buffer);
|
this.vertexAttributes.set(attribID, buffer);
|
||||||
this.usedAttribs.add(attribID);
|
this.usedAttributes.add(attribID);
|
||||||
|
|
||||||
if (!this.hasIndices())
|
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()
|
public int getVertexCount()
|
||||||
|
@ -64,7 +64,7 @@ public class VertexArray
|
||||||
|
|
||||||
public void enableAllAttributes()
|
public void enableAllAttributes()
|
||||||
{
|
{
|
||||||
this.usedAttribs.stream().forEach(GL33::glEnableVertexAttribArray);
|
this.usedAttributes.forEach(GL33::glEnableVertexAttribArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindIndices(IndexArrayBuffer buffer)
|
public void bindIndices(IndexArrayBuffer buffer)
|
||||||
|
@ -121,9 +121,9 @@ public class VertexArray
|
||||||
|
|
||||||
public void delete()
|
public void delete()
|
||||||
{
|
{
|
||||||
this.usedAttribs.stream().map(this.vertexAttribs::get).forEach(ArrayBuffer::delete);
|
this.usedAttributes.stream().map(this.vertexAttributes::get).forEach(ArrayBuffer::delete);
|
||||||
this.vertexAttribs.clear();
|
this.vertexAttributes.clear();
|
||||||
this.usedAttribs.clear();
|
this.usedAttributes.clear();
|
||||||
|
|
||||||
if (this.indices != null)
|
if (this.indices != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,14 +16,14 @@ public class VertexArrayBuilder
|
||||||
|
|
||||||
public VertexArrayBuilder vertices(VecArray<float[]> vertices)
|
public VertexArrayBuilder vertices(VecArray<float[]> vertices)
|
||||||
{
|
{
|
||||||
this.va.createArrayAttrib(new FloatArrayBuffer(vertices), ReservedAttributes.POSITION);
|
this.va.createArrayAttribute(new FloatArrayBuffer(vertices), ReservedAttributes.POSITION);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VertexArrayBuilder uvs(VecArray<float[]> uvs)
|
public VertexArrayBuilder uvs(VecArray<float[]> uvs)
|
||||||
{
|
{
|
||||||
this.va.createArrayAttrib(new FloatArrayBuffer(uvs), ReservedAttributes.UV);
|
this.va.createArrayAttribute(new FloatArrayBuffer(uvs), ReservedAttributes.UV);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue