Lot of bugfixes

* Adding clipper to generate the terrain's negative powder-contour offset.
* Fixing RDB issues (fracture, active trigger, performances)
* Fixing blood emission
* Fixing the freezing formula on liquids
* Fixing Steve spawning due to a missed test.
* Reaction table properly build
This commit is contained in:
Gaël committed 2026-10-21 20:46:13 +02:00
1 parent a34f42d53e
commit 00a9c1c26c
48 files changed
+5799 -435

No files matched your search

+20
View File
@@ -13,6 +13,8 @@ layout(std430, set = 0, binding = 1) readonly buffer Mats { uvec4 mats[]; };
layout(std430, set = 0, binding = 2) buffer Pixels { uint pixels[]; };
layout(std430, set = 0, binding = 3) buffer Ext { vec2 ext[]; };
layout(std430, set = 0, binding = 42) buffer Birth { uint birth[]; }; // the frame a cell got its material (cell age = frame - birth, 0070ebf0 req_lifetime)
// Material stamp (high 16), CLiquidCell movement state (bits 8..11), rest age (low byte).
layout(std430, set = 0, binding = 65) buffer TerrainAge { uint terrain_age[]; };
layout(std430, set = 0, binding = 4) buffer Claims { uint claims[]; };
// per cell: x = target index | (flip direction << 31), y = priority, z/w = new vy/vx bits
layout(std430, set = 0, binding = 5) buffer Intent { uvec4 intent[]; };
@@ -66,6 +68,24 @@ uint with_fade(uint b, int f) { return (b & BIRTH_MASK) | (uint(f & 255) << 24);
uint cell_mat(uint c) { return c & 0xFFFFu; }
uint mflags(uint m) { return mats[3u * m].y; }
// 0070b1d0: state 3 and zero vertical accumulator; support is not probed.
uint liquid_state(uint i, uint m) {
return (terrain_age[i] >> 16) == m ? (terrain_age[i] >> 8) & 15u : 3u;
}
bool liquid_freeze_ready(ivec2 p, uint c) {
const uint m = cell_mat(c);
const int i = p.y * pc.gw + p.x;
return (mflags(m) & F_LIQCELL) == 0u || (liquid_state(uint(i), m) == 3u && ext[i].x == 0.0);
}
// ChangeMaterial preserves the movement accumulators for nonburning same-class cells.
void material_changed(int i, uint oldCell, uint m) {
const uint old = cell_mat(oldCell);
const uint classMask = F_LIQCELL | F_GAS | F_FIRE | F_AIR;
const bool sameClass = (oldCell & BURN_BIT) == 0u && (mflags(old) & classMask) == (mflags(m) & classMask);
terrain_age[i] = (m << 16) | (sameClass && (terrain_age[i] >> 16) == old ? (terrain_age[i] & 0xFFFFu) : 0x300u);
if (!sameClass) ext[i] = vec2(0.0);
birth[i] = birth_frame();
}
float mdensity(uint m) { return uintBitsToFloat(mats[3u * m].z); }
float mgravity(uint m) { return uintBitsToFloat(mats[3u * m].w); }
int mviscosity(uint m) { return int(mats[3u * m + 1u].x & 0xFFFFu); }