new storage n matrix model

This commit is contained in:
Stewart Allen 2024-08-03 10:26:25 -04:00
commit 65f6c7deec
5 changed files with 62 additions and 7 deletions

View file

@ -21,6 +21,7 @@
gapp.main("mesh.work", [], (root) => {
const { Matrix4, Vector3, BufferGeometry, BufferAttribute, computeFaceNormal } = THREE;
const { Quaternion } = THREE;
const { base, mesh, moto } = root;
const { client, worker } = moto;
const { util } = mesh;
@ -97,6 +98,16 @@ function indexFaces(id) {
}
let model = {
rotate(data) {
let { id, x, y, z } = data;
let rec = cache[id];
let { geo } = rec;
if (x) geo.applyQuaternion(new Quaternion().setFromAxisAngle(new Vector3(1,0,0), x));
if (y) geo.applyQuaternion(new Quaternion().setFromAxisAngle(new Vector3(0,1,0), y));
if (z) geo.applyQuaternion(new Quaternion().setFromAxisAngle(new Vector3(0,0,1), z));
console.log({ rec, data, geo: geo.attributes.position.array });
},
load(data) {
let { vertices, name, id } = data;
let geo = new BufferGeometry();