Commit 2297a66d authored by Anthony Kleine's avatar Anthony Kleine

Adds untested poly list strings

parent a0682250
......@@ -342,7 +342,48 @@ public class InteriorBuilder
result.setPolyListPoints(polyListPoints);
// TODO: Poly List Strings
System.out.println("Adding Poly List Strings");
byte[] polyListStrings = new byte[]{0};
List<Byte> polyByteStrings = new ArrayList<Byte>();
for (int i = 0; i < convexHulls.length; i++) {
// the number of PLANES in this convex hull, always 1 in a triangle
polyByteStrings.add((byte)1);
// a bunch of powers of two with one for each surface
for (int j = 1; j < 4; j++) {
polyByteStrings.add((byte)(j^2));
}
// the number 0
polyByteStrings.add((byte)0);
// the number of vertices in this convex hull (always 3 in a triangle)
polyByteStrings.add((byte)3);
// these correspond to vertices in some way.
for (int j = 0; j < 3; j++) {
polyByteStrings.add((byte)1);
}
// the number of COLLISION SURPRISES in this convex hull, always 1 in a triangle
polyByteStrings.add((byte)1);
// Normally we'd have to dive into a loop here and loop through the surfaces, but every convex hull we're dealing with only has one surface.
// Number of points AGAAIIINN -_-
polyByteStrings.add((byte)3);
// the number of collision masks. Masks, not hoods High Speed! Remember?
// These usually go up in powers of two but because there's only one surface in this convex hull, it's only 1.
polyByteStrings.add((byte)1);
// The planeIndex for the current Convex Hull (I think)
// we can actually just use getPlaneStart since we only have one plane per convex hull
polyByteStrings.add((byte)(convexHulls[i].getPlaneStart()));
// we write out the indices, but only have three because there is a triangle.
// we need to write the number zero before each because annoying.
polyByteStrings.add((byte)0);
// get the vertices for the CURRENT triangle, hence multiplying by 3 for every triangle here and hoping the vertices are in order
polyByteStrings.add((byte)mesh.getIndices()[0+(i*3)]);
polyByteStrings.add((byte)0);
polyByteStrings.add((byte)mesh.getIndices()[1+(i*3)]);
polyByteStrings.add((byte)0);
polyByteStrings.add((byte)mesh.getIndices()[2+(i*3)]);
}
byte[] polyListStrings = new byte[polyByteStrings.size()];
for (int i = 0; i < polyByteStrings.size(); i++) {
polyListStrings[i] = polyByteStrings.get(i);
}
result.setPolyListStrings(polyListStrings);
// TODO: CoordBins
......
......@@ -9,6 +9,7 @@ import java.util.List;
import com.matt.difinspector.structures.Point2F;
import com.matt.difinspector.structures.Point3F;
import com.matt.difinspector.util.Util;
public class OBJModel
{
......@@ -40,6 +41,7 @@ public class OBJModel
while((line = meshReader.readLine()) != null)
{
String[] tokens = line.split(" ");
System.out.println(Util.getArrayString(tokens));
if (tokens.length == 0 || tokens[0].equals("#"))
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment