Revert "Utility methods for getting arbitrary properties for triangles from mesh buffers"
This reverts commit f80d6474a4c9e69725a1de1fe13acdb07a56c2b4.
This commit is contained in:
parent
f80d6474a4
commit
a6827ead5a
@ -824,28 +824,12 @@ public class Mesh implements Savable, Cloneable {
|
|||||||
* @param v3 Vector to contain third vertex position
|
* @param v3 Vector to contain third vertex position
|
||||||
*/
|
*/
|
||||||
public void getTriangle(int index, Vector3f v1, Vector3f v2, Vector3f v3){
|
public void getTriangle(int index, Vector3f v1, Vector3f v2, Vector3f v3){
|
||||||
getTriangle(Type.Position,index,v1,v2,v3);
|
VertexBuffer pb = getBuffer(Type.Position);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the triangle vertex data at the given triangle index
|
|
||||||
* and stores them into the v1, v2, v3 arguments. Works for 3-value components like position or normals
|
|
||||||
*
|
|
||||||
* @param type buffer type to retrieve data from
|
|
||||||
* @param index The index of the triangle.
|
|
||||||
* Should be between 0 and {@link #getTriangleCount()}.
|
|
||||||
*
|
|
||||||
* @param v1 Vector to contain first vertex data
|
|
||||||
* @param v2 Vector to contain second vertex data
|
|
||||||
* @param v3 Vector to contain third vertex data
|
|
||||||
*/
|
|
||||||
public void getTriangle(Type type, int index, Vector3f v1, Vector3f v2, Vector3f v3){
|
|
||||||
VertexBuffer pb = getBuffer(type);
|
|
||||||
IndexBuffer ib = getIndicesAsList();
|
IndexBuffer ib = getIndicesAsList();
|
||||||
if (pb != null && pb.getFormat() == Format.Float && pb.getNumComponents() == 3){
|
if (pb != null && pb.getFormat() == Format.Float && pb.getNumComponents() == 3){
|
||||||
FloatBuffer fpb = (FloatBuffer) pb.getData();
|
FloatBuffer fpb = (FloatBuffer) pb.getData();
|
||||||
|
|
||||||
// acquire triangle's vertex indices
|
// aquire triangle's vertex indices
|
||||||
int vertIndex = index * 3;
|
int vertIndex = index * 3;
|
||||||
int vert1 = ib.get(vertIndex);
|
int vert1 = ib.get(vertIndex);
|
||||||
int vert2 = ib.get(vertIndex+1);
|
int vert2 = ib.get(vertIndex+1);
|
||||||
@ -855,46 +839,11 @@ public class Mesh implements Savable, Cloneable {
|
|||||||
BufferUtils.populateFromBuffer(v2, fpb, vert2);
|
BufferUtils.populateFromBuffer(v2, fpb, vert2);
|
||||||
BufferUtils.populateFromBuffer(v3, fpb, vert3);
|
BufferUtils.populateFromBuffer(v3, fpb, vert3);
|
||||||
}else{
|
}else{
|
||||||
throw new UnsupportedOperationException(type + " buffer not set or "
|
throw new UnsupportedOperationException("Position buffer not set or "
|
||||||
+ " has incompatible format");
|
+ " has incompatible format");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the triangle vertex data at the given triangle index
|
|
||||||
* and stores them into the v1, v2, v3 arguments. Works for 2-value components like texture coordinates
|
|
||||||
*
|
|
||||||
* @param type buffer type to retrieve data from
|
|
||||||
* @param index The index of the triangle.
|
|
||||||
* Should be between 0 and {@link #getTriangleCount()}.
|
|
||||||
*
|
|
||||||
* @param v1 Vector to contain first vertex data
|
|
||||||
* @param v2 Vector to contain second vertex data
|
|
||||||
* @param v3 Vector to contain third vertex data
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void getTriangle(Type type, int index, Vector2f v1, Vector2f v2, Vector2f v3){
|
|
||||||
VertexBuffer pb = getBuffer(type);
|
|
||||||
IndexBuffer ib = getIndicesAsList();
|
|
||||||
if (pb != null && pb.getFormat() == Format.Float && pb.getNumComponents() == 2){
|
|
||||||
FloatBuffer fpb = (FloatBuffer) pb.getData();
|
|
||||||
|
|
||||||
// acquire triangle's vertex indices
|
|
||||||
int vertIndex = index * 3;
|
|
||||||
int vert1 = ib.get(vertIndex);
|
|
||||||
int vert2 = ib.get(vertIndex+1);
|
|
||||||
int vert3 = ib.get(vertIndex+2);
|
|
||||||
|
|
||||||
BufferUtils.populateFromBuffer(v1, fpb, vert1);
|
|
||||||
BufferUtils.populateFromBuffer(v2, fpb, vert2);
|
|
||||||
BufferUtils.populateFromBuffer(v3, fpb, vert3);
|
|
||||||
}else{
|
|
||||||
throw new UnsupportedOperationException(type + " buffer not set or "
|
|
||||||
+ " has incompatible format");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the triangle vertex positions at the given triangle index
|
* Gets the triangle vertex positions at the given triangle index
|
||||||
* and stores them into the {@link Triangle} argument.
|
* and stores them into the {@link Triangle} argument.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user