nickbabcock / Pfim

.NET Standard targa (.tga) and direct draw surface (.dds) image decoder
https://nickbabcock.github.io/Pfim/
MIT License
108 stars 18 forks source link

How do I load only the lowest mipmap for compressed and uncompressed dds files? #116

Open bryanedds opened 5 months ago

bryanedds commented 5 months ago

I'm currently implementing basic texture streaming in my engine and I'm trying to load up only the lowest mipmap for the textures until the full textures and mipmaps can be streamed in later. I find the API a bit confusing, but here's my current code that loads in the full textures and mipmaps via pfim -

https://github.com/bryanedds/Nu/blob/ba6066052046ef783a0c450158d0f137c523320d/Nu/Nu/OpenGL/OpenGL.Texture.fs#L92-L148

and -

https://github.com/bryanedds/Nu/blob/ba6066052046ef783a0c450158d0f137c523320d/Nu/Nu/OpenGL/OpenGL.Texture.fs#L286-L307

However, rather than just loading in the full thing, I want to have additional procedures that load in only the lowest mipmap and nothing else. Reading the full texture from file would take too much time and defeat the purpose of texture streaming a bit.

Thank you for your time and assistance!

nickbabcock commented 5 months ago

Thank you for reporting a great, motivating use case.

I agree there's a lack of support for mipmap-only use cases. What API do you envision?

bryanedds commented 5 months ago

Off top, I actually have no idea how my desired feature's desired API would look, mostly because I'm still struggling a bit with Pfim's API - so I don't know right off how to make a practical suggestion in that case.

Let me think about it a bit. Are you on discord? Maybe we can go back and forth a bit in chat?

nickbabcock commented 5 months ago

Yes, Pfim's API is the result of organic growth ... would be the nicest way I'd phrase it 😄 😄