render3d: gltf_cached - a still model loaded once by dir, file and node

A game placing props while it plays (a sign an animal leaves, a fish, a bobber) loaded each through
gltf_load, which reads the file and parses its document every time. gltf_cached finds the same
(dir, file, node) by comparing the names in place and hands back the model the first load made;
a model whose document is read after the load (ludic.anim's clips) still goes through gltf_load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 11:39:41 +03:00
parent 0068411946
commit de85f201ad
3 changed files with 32 additions and 0 deletions

View file

@ -108,6 +108,10 @@ export state Render3dState {
gltf_mat_nrm: words = null
gltf_mat_arm: words = null
gltf_mat_n: int = 0
gltf_kept: []Model = null # gltf_cached's: a still model by dir, file and node, loaded once
gltf_kept_dir: []string = null
gltf_kept_file: []string = null
gltf_kept_node: []string = null
gltf_cutout: bool = false # the material being loaded is alpha-blended (a cut-out atlas)
gpu_kind: int = 0 # the backend running; 0 until gpu_select
gpu_wanted: int = 0 # what was asked for (setting or R3D_GFX)