This doesn't work as expected in some cases, as surfaces might still get
linked transitively by neighbours. Solving this seems non-trivial for
now, but maybe we can just live with it
Automatically smooth normals between surfaces with normals less than 45
degrees off.
Can be adjusted from map.bsp.patch file like this (e.g. to 50 degrees):
```
{
"_xvk_smoothing_threshold" "50"
}
```
Add render refcount to submodels to diagnose when it can't properly clear things due to them being used somewhere still.
Also add `speeds.submodels_cache_{dynamic,static}` counters to show how many submodels render models have been allocated.
Gives out individual render submodels for dynamic ones, receives and remembers them when they are not needed anymore.
Stores only one render submodel for static ones. Reuses/instantiates it for everyone.
Detect whether studio model has changed, and replace it with a new one.
It does (as predicted) run into a gpu sync issue if reuse happened while previous frame with the old user is still being drawn.
Renames previous METRICS to COUNTERS. These are still reset to zero
every frame.
Adds new METRICS which are preserved, maintained externally to speeds,
and only sampled by speeds code once per frame.
Also adds new metrics:
- `studio.cached_submodels` -- number of submodels in cache
- `geom.used` -- memory used by long allocations
- `geom.{vertices,indices}` -- counts of vertices/indices for long
allocations
- `geom.dyn_{vertices,indices}` -- counts of vertices/indices for
single-frame dynamic allocations
When `r_speeds_graphs` cvar is read for the first time, not all metrics
might be registered yet. It leads to some graphs missing.
Retry searching for these metrics on further frames, thus preserving the
graph list from previous session fully.
- Add variable name and registration src:line to the
`r_speeds_list_metrics` output. Makes it easier to reason about where
does this metric come from.
- Group metrics by their modules, makes it easier to discover.
- Do not print the list immediately on command, do it later in the
frame. Makes it print correct latest frame values.
Still slightly KORYAVY as:
- there's no cache eviction, it might get full pretty quick
- static-vs-dynamic animation decision is pretty rudimentary, might consider non-animated things as dynamic
- args passing vs global state is meh
This makes water static for now, and also makes it look weird, e.g.:
- no culling of water sides (it is "dynamic" in a sense that it's an
entity property, not model property)
Fixes computing total vertices/indices count. Were referencing the same `pmesh` for all meshes.
Floating and missing heads issue seems to be due to incorrect fixed animation frames. I.e. animation frames contain offsets to the correct positions. Should be fixed when animations are done.
Known issues:
- no animations, stuck at first rendered frame of a given submodel.
This is as intended for now, needs BLAS update functionality not yet implemented.
- wrong positions/transforms. Reasons unknown. May be "as intended" too.
- missing heads
- Barney model corruption. Consistent between maps/instances/animation
frames.
Somehow makes sprites correctly oriented (and winding-culled) for ray
tracing, but makes them disappear (winding-culled) for traditional
renderer. This makes zero sense.