Note that the ground format seems poorly thought out, and it's not clear what's intended for how to reach certain data. For example, there's no index to read the last row/column of vertices, so what's the point of vertexStart? Additionally there's no way to specify the order of quad vertices, so traingles are always facing the same direction.
Grid is now properly read, before only the first grid column was being read.
Vertices (Z positions) are now properly read. This includes reading ahead to the next vertex row/column, and also using different Z values for each vertex of a grid cell.
Normals are read.
UVs are read and TSB is parsed.
Ground HAS NOT been changed to not be facing vertical. At first I thought I should just flip the Z and Y assignments, but maybe that's not it, because the normal was a UnitZ vector too...
dataCount is no longer an argument, as only one grid can be defined per type in ProcessPrimitive.
3 indexes are now read inside the function instead of outside.
Preview of PsyQ's GROUND.HMD
![image](https://github.com/rickomax/psxprev/assets/9752430/de9daf91-eafb-43a4-9500-64228d5f8bd5)
Other changes
Added ParseCBA and ParseTSB helper functions to TMDHelper.
Added CalculateNormal helper function to GeomUtils, and replaced all instances where this was done manually (CrocModelReader and TMDHelper).
TMDHelper now calculates normals for quad triangles when NORMAL3 is missing (like is done for the first triangle).
Fixed ProcessMIMe not reading diffIndex each loop for dataCount.
ProcessMIMe no longer assigns oNum (numOriginals) as objectId of the animation. Currently it's (mimeId + 1), but this doesn't seem any more correct. It's temporary for now...
HMDParser refactoring
Renamed category 7 Devices to Equipment, because that's what the library reference calls them.
Renamed all uses of Mime to MIMe.
Renamed some MIMe variables with horribly short names to be clearer (i.e. rst -> reset, org -> orig).
Added more MIMe sanity check constants.
Renamed MaxHMDVertCount to MaxHMDVertices (to match other similar constants).
Renamed use of dataTop (when referring to polygons) to polyTop.
All ProcessHeader functions now list their output variables in the order they appear in the header.
Removed nextPrimitivePointer argument from all Process functions, since they weren't used.
Renamed ProcessPrimitive to ProcessPrimitiveSet, to match how these chains are named in LAB files.
Moved ProcessImageData below ProcessSharedIndicesData, to have the order match the category numbers. Also so that its grouped with similar functions and ReadMapped/Vertex/Normal functions aren't just randomly in the middle.
Note that the ground format seems poorly thought out, and it's not clear what's intended for how to reach certain data. For example, there's no index to read the last row/column of vertices, so what's the point of vertexStart? Additionally there's no way to specify the order of quad vertices, so traingles are always facing the same direction.
Preview of PsyQ's GROUND.HMD
![image](https://github.com/rickomax/psxprev/assets/9752430/de9daf91-eafb-43a4-9500-64228d5f8bd5)Other changes
mimeId + 1
), but this doesn't seem any more correct. It's temporary for now...HMDParser refactoring