cosmoscout / cosmoscout-vr

:milky_way: A virtual universe which lets you explore, analyze and present huge planetary datasets and large simulation data in real-time.
Other
351 stars 27 forks source link

Refactor GLTF Support #142

Open Schneegans opened 4 years ago

Schneegans commented 4 years ago

In my opinion, the current state of our GLTF support should be improved. Here are a few thoughts:

What do you think?

bernstein commented 4 years ago

Sounds good

  • We could update our version of tinygltf which would make some code obsolete.

we should do that

  • Environment texture handling should be decoupled from the model. In the settings there could be separate arrays, one for cubemaps and one for models.

yes, we should definitely do that!

  • The code in src/cs-graphics/internal/gltfmodel.cpp could make use of some vista classes for OpenGL wrapping in order to reduce the line count significantly.

yes, thats true

  • Support for more GTLF features (animations?) would be awesome!

Animations would be great

  • I think currently no graphics memory is freed when models are deleted. This leads to memory leaks when we reload settings or plugins.

Actually gpu resources should be freed when a GltfLoader object and all the nodes created by it are destroyed. We are using shared_ptr with a custom deleter that frees the gpu memory on destruction but there is another design issue here: