java.lang.Object
com.github.stephengold.joltjni.VertexList
- All Implemented Interfaces:
ConstVertexList
A variable-length list of 3-D vectors, implemented using a direct
FloatBuffer. (native type: Array<Float3>)-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate an empty list.VertexList(int capacity) Instantiate an empty list with the specified capacity. -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()Count how many vertices can be held in the currently allocated storage.voidclear()Make the list empty again.booleanempty()Test whether the list contains no vertices.get(int listIndex) Copy the vertex at the specified index.voidpushBack(float x, float y, float z) Append the specified vertex location to the end.voidpushBack(ConstFloat3 location) Append the specified vertex to the end.voidAppend the specified vertex to the end.voidresize(int numVertices) Extend or truncate the list, initializing any new vertices to (0,0,0).voidset(int vertexIndex, float x, float y, float z) Store the specified vertex location at the specified index.voidset(int vertexIndex, ConstFloat3 location) Store the specified vertex location at the specified index.voidStore the specified vertex location at the specified index.voidset(int vertexIndex, FloatBuffer location) Store the specified vertex location at the specified index.intsize()Count how many vertices are in the list.Access a direct buffer containing all vertices in the list, in order.
-
Constructor Details
-
VertexList
public VertexList()Instantiate an empty list. -
VertexList
public VertexList(int capacity) Instantiate an empty list with the specified capacity.- Parameters:
capacity- the desired number of vertices (≥0)
-
-
Method Details
-
clear
public void clear()Make the list empty again. -
pushBack
Append the specified vertex to the end.- Parameters:
location- the vertex to append (notnull, unaffected)
-
pushBack
public void pushBack(float x, float y, float z) Append the specified vertex location to the end.- Parameters:
x- the X-coordinate to storey- the Y-coordinate to storez- the Z-coordinate to store
-
pushBack
Append the specified vertex to the end.- Parameters:
location- the vertex to append (notnull, unaffected)
-
resize
public void resize(int numVertices) Extend or truncate the list, initializing any new vertices to (0,0,0).- Parameters:
numVertices- the desired size (number of vertices)
-
set
Store the specified vertex location at the specified index.- Parameters:
vertexIndex- an index in the list (≥0, <size)location- the data to store (notnull, unaffected)
-
set
public void set(int vertexIndex, float x, float y, float z) Store the specified vertex location at the specified index.- Parameters:
vertexIndex- an index in the list (≥0, <size)x- the X-coordinate to storey- the Y-coordinate to storez- the Z-coordinate to store
-
set
Store the specified vertex location at the specified index.- Parameters:
vertexIndex- an index in the list (≥0, <size)location- the data to store (notnull, unaffected)
-
set
Store the specified vertex location at the specified index.- Parameters:
vertexIndex- an index in the list (≥0, <size)location- the data to store (notnull, unaffected)
-
capacity
public int capacity()Count how many vertices can be held in the currently allocated storage. The list is unaffected.- Specified by:
capacityin interfaceConstVertexList- Returns:
- the number of vertices (≥0)
-
empty
public boolean empty()Test whether the list contains no vertices. The list is unaffected.- Specified by:
emptyin interfaceConstVertexList- Returns:
trueif empty, otherwisefalse
-
get
Copy the vertex at the specified index. The list is unaffected.- Specified by:
getin interfaceConstVertexList- Parameters:
listIndex- the index from which to get the vertex- Returns:
- the vertex
-
size
public int size()Count how many vertices are in the list. The list is unaffected.- Specified by:
sizein interfaceConstVertexList- Returns:
- the number of vertices (≥0)
-
toDirectBuffer
Access a direct buffer containing all vertices in the list, in order. No furtherresize()orset()is allowed.- Specified by:
toDirectBufferin interfaceConstVertexList- Returns:
- the pre-existing Buffer, flipped but possibly not rewound
-