Hello friends. How does JPCT-AE Vertex works on Object3D.addTriangle(...)?
Result:
Code Select
public static Object3D createCube(float scale) {
Object3D o = new Object3D(12);
float size = scale / 2;
// FRONT
o.addTriangle(new SimpleVector(-size, size, size), new SimpleVector(-size, -size, size), new SimpleVector(size, size, size));
o.addTriangle(new SimpleVector(size, size, size), new SimpleVector(size, -size, size), new SimpleVector(-size, -size, size));
// BACK
o.addTriangle(new SimpleVector(-size, size, -size), new SimpleVector(-size, -size, -size), new SimpleVector(size, size, -size));
o.addTriangle(new SimpleVector(size, size, -size), new SimpleVector(size, -size, -size), new SimpleVector(-size, -size, -size));
// LEFT
o.addTriangle(new SimpleVector(-size, size, size), new SimpleVector(-size, -size, size), new SimpleVector(-size, size, -size));
o.addTriangle(new SimpleVector(-size, size, -size), new SimpleVector(-size, -size, -size), new SimpleVector(-size, -size, size));
// RIGHT
o.addTriangle(new SimpleVector(size, size, size), new SimpleVector(size, -size, size), new SimpleVector(size, size, -size));
o.addTriangle(new SimpleVector(size, size, -size), new SimpleVector(size, -size, -size), new SimpleVector(size, -size, size));
// UPPER
o.addTriangle(new SimpleVector(size, size, size), new SimpleVector(-size, size, size), new SimpleVector(size, size, -size));
o.addTriangle(new SimpleVector(size, size, -size), new SimpleVector(-size, size, -size), new SimpleVector(-size, size, size));
// LOWER
o.addTriangle(new SimpleVector(size, -size, size), new SimpleVector(-size, -size, size), new SimpleVector(size, -size, -size));
o.addTriangle(new SimpleVector(size, -size, -size), new SimpleVector(-size, -size, -size), new SimpleVector(-size, -size, size));
return o;
}
Result: