jpaver / opengametools

A set of open c++ game development tools that are lightweight, easy-to-integrate and free to use. Currently hosting a magicavoxel .vox full scene loader.
MIT License
375 stars 36 forks source link

ogt_vox : materials are not merged correctly #38

Open jibjoub opened 2 years ago

jibjoub commented 2 years ago

Currently, the materials are well loaded with _load_voxscene but are not merged correctly in _ogt_vox_mergescenes. Thus no materials other than diffuse (default) exist in the merged scene.

jpaver commented 2 years ago

By the way, this PR has been merged: https://github.com/jpaver/opengametools/pull/39 and is a great start.

Currently it finds the palette entry that has the closest color to the one expected and then copies over the material properties for that, but it doesn't really try to match materials at all. This would be problematic If we have palette entries with identical colors but different materials.

To support this properly, we'd have to modify find_exact_color_in_palette and find_closest_color_in_palette to support closest material matching in addition to color matching.