The Lemur way sounds cool, i think its worth to try.
But if you would want use “default way” below i can provide helpfull info:
Generally there are different ways of connecting points.
I think easy way would be “create each tris separatly”.
So lets assume you have “algorithm” to create “verticles”.
Starting from simple Cosine or other Interpolations that will calculate curve for you.
so you only need calculate points 4x times for each offset of them. (i hope you get what i mean)
When you will have point generation done, you only need create quads between each points stage.
Below Class can be helpfull for you, but you will anyway need provide own 4 Points for it.
(normals is just face direction, same when you enable Normals in Blender - blue lines)
public enum FaceEnum {
Y(0, new Vector3i(0, 1, 0), new Vector3f[]{
new Vector3f(0,1,0),
new Vector3f(0,1,1),
new Vector3f(1,1,0),
new Vector3f(1,1,1)
},new int[]{
2,0,1, 1,3,2
},new int[][]{
new int[]{0,0},
new int[]{0,1},
new int[]{1,0},
new int[]{1,1},
}, 0),
YNEG(1, new Vector3i(0, -1, 0), new Vector3f[]{
new Vector3f(0,0,0),
new Vector3f(0,0,1),
new Vector3f(1,0,0),
new Vector3f(1,0,1)
},new int[]{
2,3,1,1,0,2
},new int[][]{
new int[]{0,0},
new int[]{0,1},
new int[]{1,0},
new int[]{1,1},
}, 0),
X(2, new Vector3i(1, 0, 0), new Vector3f[]{
new Vector3f(1,0,0),
new Vector3f(1,1,0),
new Vector3f(1,0,1),
new Vector3f(1,1,1)
},new int[]{
2,0,1, 1,3,2
},new int[][]{
new int[]{0,0},
new int[]{0,1},
new int[]{1,0},
new int[]{1,1},
}, 0),
XNEG(3, new Vector3i(-1, 0, 0), new Vector3f[]{
new Vector3f(0,0,0),
new Vector3f(0,1,0),
new Vector3f(0,0,1),
new Vector3f(0,1,1)
},new int[]{
2,3,1,1,0,2
},new int[][]{
new int[]{0,0},
new int[]{0,1},
new int[]{1,0},
new int[]{1,1},
}, 0),
Z(4, new Vector3i(0, 0, 1), new Vector3f[]{
new Vector3f(0,0,1),
new Vector3f(0,1,1),
new Vector3f(1,0,1),
new Vector3f(1,1,1)
},new int[]{
2,3,1,1,0,2
},new int[][]{
new int[]{0,0},
new int[]{0,1},
new int[]{1,0},
new int[]{1,1},
}, 0),
ZNEG(5, new Vector3i(0, 0, -1), new Vector3f[]{
new Vector3f(0,0,0),
new Vector3f(0,1,0),
new Vector3f(1,0,0),
new Vector3f(1,1,0)
},new int[]{
2,0,1, 1,3,2
},new int[][]{
new int[]{0,0},
new int[]{0,1},
new int[]{1,0},
new int[]{1,1},
}, 0);
private final int index;
private final Vector3i offset;
private final Vector3f[] baseVerts;
private final int[] baseIndices;
private final int[][] texturePosition;
FaceEnum(int index, Vector3i offset,Vector3f[] baseVerts,int[] baseIndices, int[][] texturePosition, int textureType) {
this.index = index;
this.offset = offset;
this.baseVerts = baseVerts;
this.baseIndices = baseIndices;
this.texturePosition = texturePosition;
}
public int getIndex() {
return index;
}
public Vector3i getOffset() {
return this.offset;
}
public Vector3f[] getBaseVerts(){
return this.baseVerts;
}
public int[] getBaseIndexes() {
return baseIndices;
}
public int[][] getTexturePositions(){
return this.texturePosition;
}
}
Then for each Face, you will be able to create buffer “user friendly way” that you will understand since you Operate over faces:
mesh = new Mesh();
//The position buffer
FloatBuffer pb = BufferUtils.createVector3Buffer(verts.size() * 3);
//The normal buffer
FloatBuffer nb = BufferUtils.createVector3Buffer(faceNormals.size() * 3 * 4);
//The texCoord1 buffer
FloatBuffer tb1 = BufferUtils.createVector2Buffer(textureCoords.size() * 2);
//The index buffer
IntBuffer ib = BufferUtils.createIntBuffer(indexes.size());
for (Integer index : indexes) {
ib.put(index);
}
for (Vector3f vert : verts) {
pb.put(vert.x).put(vert.y).put(vert.z);
}
for (Vector3f faceNormal : faceNormals) {
//faceNormal = new Vector3f(0, -1, 0);
nb.put(faceNormal.x).put(faceNormal.y).put(faceNormal.z);
nb.put(faceNormal.x).put(faceNormal.y).put(faceNormal.z);
nb.put(faceNormal.x).put(faceNormal.y).put(faceNormal.z);
nb.put(faceNormal.x).put(faceNormal.y).put(faceNormal.z);
}
for (Vector2f texCoords : textureCoords) {
tb1.put(texCoords.x).put(texCoords.y);
}
if (!mesh.getBufferList().isEmpty()) {
BufferUtils.destroyDirectBuffer(mesh.getBuffer(VertexBuffer.Type.Position).getData());
BufferUtils.destroyDirectBuffer(mesh.getBuffer(VertexBuffer.Type.Normal).getData());
BufferUtils.destroyDirectBuffer(mesh.getBuffer(VertexBuffer.Type.TexCoord).getData());
BufferUtils.destroyDirectBuffer(mesh.getBuffer(VertexBuffer.Type.Index).getData());
}
mesh.setBuffer(VertexBuffer.Type.Position, 3, pb);
mesh.setBuffer(VertexBuffer.Type.Normal, 3, nb);
mesh.setBuffer(VertexBuffer.Type.TexCoord, 2, tb1);
mesh.setBuffer(VertexBuffer.Type.Index, 1, ib);
Please note i could have too big buffers here, so verify me.
edit:
also dont forget use:
geometry.updateModelBound();
after update mesh