I’m given an array of strings, then I have to parse for if they have a ‘f’ prefix, then get the data from them. Everything is working ( I checked ) except that the array when I’m initializing is different from when I’m reading it back.
Here’s when I initialize it…
// ...
OBJFace[] faces = new OBJFace[data.getFaceListSize()];
// ...
for (int i = 0; i < data.getLines().length; i++) {
String currentLine = data.getLines()[i];
char linePrefix = currentLine.charAt(0);
// ...
switch (linePrefix) {
// ...
case 'f':
if(currentMaterial == null) throw new EcuException("No material defined for face id:" + faceIndex);
indicesFill = parseLineIntegers(currentLine, indicesFill, i);
OBJFace face = new OBJFace(currentMaterial, indicesFill);
faces[faceIndex] = face;
- System.out.println(faceIndex + " " + faces[faceIndex]);
faceIndex++;
break;
// ...
}
Here’s what I print after…
for(int fi = 0; fi < faces.length; fi++){
- System.out.println(fi + " " + faces[fi]);
parent.addFace(fi, faces[fi]);
}
And the output: (it’s a bit long) The “indices=[x, y, z]” is the big thing here.
0 OBJFace [parent=Face [indices=[2, 3, 4]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
1 OBJFace [parent=Face [indices=[8, 7, 6]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
2 OBJFace [parent=Face [indices=[1, 5, 6]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
3 OBJFace [parent=Face [indices=[2, 6, 7]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
4 OBJFace [parent=Face [indices=[7, 8, 4]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
5 OBJFace [parent=Face [indices=[1, 4, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
6 OBJFace [parent=Face [indices=[1, 2, 4]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
7 OBJFace [parent=Face [indices=[5, 8, 6]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
8 OBJFace [parent=Face [indices=[2, 1, 6]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
9 OBJFace [parent=Face [indices=[3, 2, 7]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
10 OBJFace [parent=Face [indices=[3, 7, 4]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
11 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
0 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
1 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
2 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
3 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
4 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
5 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
6 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
7 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
8 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
9 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
10 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
11 OBJFace [parent=Face [indices=[5, 1, 8]], material=Material [specularPower=96.07843, Ka=Color [red=0.0, green=0.0, blue=0.0, alpha=1.0], Kd=Color [red=0.64, green=0.64, blue=0.64, alpha=1.0], Ks=Color [red=0.5, green=0.5, blue=0.5, alpha=1.0], map_Kd=Texture [oglid=1, target=3553, unit=0, filter=9729, clamp=33071], map_Kn=Texture [oglid=3, target=3553, unit=2, filter=9729, clamp=33071], map_Ks=Texture [oglid=2, target=3553, unit=1, filter=9729, clamp=33071]]]
As you can see, the first segment has completely different data from the second. My goal is to make the fist segment have the same data as the second, but I can’t track down the bug that’s causing it. :-/
Thanks in advance!