rickomax / psxprev

PSXPREV - Playstation (PSX) Files Previewer/Extractor
BSD 2-Clause "Simplified" License
200 stars 10 forks source link

Support HMD strip mesh packets #88

Closed trigger-segfault closed 1 year ago

trigger-segfault commented 1 year ago

This implements issue #64.

Strip meshes are a type of polygon that can be loaded by HMD primitive packets. These meshes follow an identical structure to a triangle, except that a number is prefixed for the number of triangles (so 1 would mean there is no extra strip mesh data). After the identical packet data, repeat packets appear that again follow an identical format to triangles, with one exception that only one vertex is read.

The one awkward part of strip meshes was that you had to figure out the order for reading vertices and normals.

The order is vertex m + (0, 1, 2) / normal (0, 1, 2) for even indexes, and vertex m + (0, 2, 1) / normal (0, 2, 1) for odd packets. It was strange that normals weren't used in the order they were defined in, considering all normals are used from their respective mesh repeat packet.