I have got 3 classes:
In C++ a mesh for a cube was created like this:
How can I initialize all the different triangles and vec3d's in java?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | //class1 public class vec3d { float x, y, z; } //class2 public class triangle { vec3d[] p = new vec3d[ 3 ]; } //class3 import java.util.Vector; public class mesh { Vector<triangle> tris; } |
1 2 3 4 5 6 | mesh meshCube; meshCube.tris = { { 0 .0f, 0 .0f, 0 .0f, 0 .0f, 1 .0f, 0 .0f, 1 .0f, 1 .0f, 0 .0f}, { 0 .0f, 0 .0f, 0 .0f, 1 .0f, 1 .0f, 0 .0f, 1 .0f, 0 .0f, 0 .0f}, //and so on... }; |