forked from phenom/healer-man
Release Healer Man 0.1.33
This commit is contained in:
1 parent
6dcb1034e5
commit
05b25c4341
20 files changed
+573
-51
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { BufferGeometry, type Group, type Mesh } from "three";
|
||||
import { BufferGeometry, Float32BufferAttribute, type Group, type Mesh } from "three";
|
||||
import type { DungeonNavigationLink } from "./dungeonTypes";
|
||||
import {
|
||||
buildPartyNavigationGraph,
|
||||
@@ -33,6 +33,19 @@ function navigationGeometry(scene: Group): BufferGeometry {
|
||||
});
|
||||
if (!sourceMesh) throw new Error("The party navigation GLB has no triangle geometry.");
|
||||
const geometry = (sourceMesh as Mesh).geometry.clone();
|
||||
const position = geometry.getAttribute("position");
|
||||
// BufferAttribute.applyMatrix4 writes back through the source component
|
||||
// type. Quantized normalized integers therefore clamp world coordinates to
|
||||
// [-1, 1] while baking their node transform. Expand them to floats first.
|
||||
if (position.normalized) {
|
||||
const expanded = new Float32Array(position.count * 3);
|
||||
for (let index = 0; index < position.count; index += 1) {
|
||||
expanded[index * 3] = position.getX(index);
|
||||
expanded[index * 3 + 1] = position.getY(index);
|
||||
expanded[index * 3 + 2] = position.getZ(index);
|
||||
}
|
||||
geometry.setAttribute("position", new Float32BufferAttribute(expanded, 3));
|
||||
}
|
||||
geometry.applyMatrix4((sourceMesh as Mesh).matrixWorld);
|
||||
return geometry;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user