GothicKit / ZenKit

A re-implementation of file formats used by the early 2000's ZenGin
http://zk.gothickit.dev/
MIT License
44 stars 10 forks source link

[v2.0.0] Decouple dropping LOD-polygons from loading MRMs #15

Closed lmichaelis closed 1 year ago

lmichaelis commented 1 year ago

Currently, when loading MRMs (or phoenix::meshes), a secondary parameter for only including certain polygons can be provided. This is used mostly by phoenix::world::parse to exclude level-of-detail polygons from the world mesh.

This functionality should

  1. Not be forced onto the user when loading worlds
  2. Be a function to call on a mesh, instead of being passed to parse.
lmichaelis commented 1 year ago

Sadly, it looks like this won't be possible with the current parser and it would require a large re-write. The issue is the following: From the BSP tree we get a list of polygons we want to exclude which, as far as I can tell, reference the actual polygon index in the raw input data (i.e. a triangle fan) instead of the triangle.

Because we immediately convert every polygon into a set of triangles we can't really tell which polygon it belonged to so we can't actually use the polygon indices provided by the BSP tree. The only way to change this seems to be to store raw polygons instead of just triangles. This would probably break existing users for a change which might not even benefit them at all.

For this reason, this feature will not be implemented in the foreseeable future.