Commit 4b72e326 authored by Anthony Kleine's avatar Anthony Kleine

Adds ConvexHullEmitStrings, but I'm not convinced I'm doing them the right...

Adds ConvexHullEmitStrings, but I'm not convinced I'm doing them the right way, as the file seems to be inconsistent with what Torque does with them.
parent 150900a0
Pipeline #1882196 skipped
......@@ -306,7 +306,39 @@ public class InteriorBuilder
result.setConvexHulls(convexHulls);
// TODO: Convex Hull Emit Strings
System.out.println("Adding Convex Hull Emit Strings");
result.setConvexHullEmitStrings(new byte[]{0});
List<Byte> convexHullByteStrings = new ArrayList<Byte>();
for (int i = 0; i < convexHulls.length; i++) {
// the number of POINTS in this triangle minus one
convexHullByteStrings.add((byte)2);
// the point indices
// Torque does the work of adding the hullStart for us. We should be able to just do 0,1
convexHullByteStrings.add((byte)0);
convexHullByteStrings.add((byte)1);
// regardless of whether our DIF supports edges, we need to output numEdges here. Thankfully this is always the same in a triangle.
convexHullByteStrings.add((byte)3);
// I don't know what to do here, other than I know they come in groups of two
convexHullByteStrings.add((byte)0);
convexHullByteStrings.add((byte)1);
convexHullByteStrings.add((byte)0);
convexHullByteStrings.add((byte)2);
convexHullByteStrings.add((byte)0);
convexHullByteStrings.add((byte)3);
// Now we need to write out the number of polys which is 1, but I question whether this is good enough or not
convexHullByteStrings.add((byte)1);
// now we need vertex count, again questioning the legitimacy though
convexHullByteStrings.add((byte)3);
// now we need the planeIndex, which is by far the most straightforward thing here
convexHullByteStrings.add((byte)convexHulls[i].getPlaneStart());
// now we emit the vertices one after the other?
convexHullByteStrings.add((byte)0);
convexHullByteStrings.add((byte)1);
convexHullByteStrings.add((byte)2);
}
byte[] convexHullEmitStrings = new byte[convexHullByteStrings.size()];
for (int i = 0; i < convexHullByteStrings.size(); i++) {
convexHullEmitStrings[i] = convexHullByteStrings.get(i);
}
result.setConvexHullEmitStrings(convexHullEmitStrings);
// TODO: Hull Indices
System.out.println("Adding Hull Indices");
int[] hullIndices = new int[convexHulls.length * 8];
......
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