asny / three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)
MIT License
1.34k stars 110 forks source link

Add Texture2D/Texture2DArray/Texture3D::number_of_mip_maps() #481

Closed BonsaiDen closed 2 months ago

BonsaiDen commented 2 months ago

Since there is no way of retrieving the configured number of mip maps from OpenGL, customizing them after texture creation would require guessing the number / or copy-pasting the three-d code that computes it.

This PR introduces a getter on all Texture structs which simply returns the number to avoid the guess work or copy-pasting of three-d code into the game / application.

In my case I need the number so I can easily switch out the higher mip map levels with custom textures.

asny commented 2 months ago

Makes sense, thanks for the contribution 🙏