Update water contact patch collection and handling in rendering and runtime modules

This commit is contained in:
2026-04-07 04:58:48 +02:00
parent 30ddb565db
commit 0e4bd01e69
4 changed files with 86 additions and 12 deletions

View File

@@ -84,6 +84,52 @@ describe("water material helpers", () => {
expect(patches).toHaveLength(0);
});
it("preserves oriented contact regions for rotated boxes", () => {
const patches = collectWaterContactPatches(
{
center: {
x: 0,
y: 0,
z: 0
},
rotationDegrees: {
x: 0,
y: 0,
z: 0
},
size: {
x: 10,
y: 2,
z: 10
}
},
[
{
kind: "orientedBox",
center: {
x: 0,
y: 1,
z: 0
},
rotationDegrees: {
x: 0,
y: 45,
z: 0
},
size: {
x: 2,
y: 1,
z: 1
}
}
]
);
expect(patches).toHaveLength(1);
expect(Math.abs(patches[0]?.axisX ?? 0)).toBeGreaterThan(0.65);
expect(Math.abs(patches[0]?.axisZ ?? 0)).toBeGreaterThan(0.65);
});
it("builds a shared quality shader material for visible tinted water", () => {
const result = createWaterMaterial({
colorHex: "#4da6d9",