// 0x64 TODO private void decode64(byte[] data) { uint start = BE.U32(data, 0x64); uint end = BE.U32(data, 0x68); uint idx = start; while (idx < end) { byte b0 = data[idx++]; byte headerLength = data[idx++]; byte[] header = new byte[headerLength]; Array.Copy(data, idx, header, 0, headerLength); idx += headerLength; byte count = data[idx++]; WallGroup group = new WallGroup(b0, header); for (uint i = 0; i < count; i++) { Int16 x, y, z, x2, y2, z2, x3, y3, z3; UInt16 type; x = BE.I16(data, idx); y = BE.I16(data, idx + 2); z = BE.I16(data, idx + 4); x2 = BE.I16(data, idx + 6); y2 = BE.I16(data, idx + 8); z2 = BE.I16(data, idx + 0xA); x3 = BE.I16(data, idx + 0xC); y3 = BE.I16(data, idx + 0xE); z3 = BE.I16(data, idx + 0x10); type = BE.U16(data, idx + 0x12); Wall wall = new Wall(x, y, z, x2, y2, z2, x3, y3, z3, type); group.walls.Add(wall); idx += 20; } wallGroups.Add(group); } }
private Vector3 GetNormal(Wall tri) { Vector3 a = new Vector3(tri.x1, tri.y1, tri.z1); Vector3 b = new Vector3(tri.x2, tri.y2, tri.z2); Vector3 c = new Vector3(tri.x3, tri.y3, tri.z3); return GetNormal(a, b, c); }