Files
vtuber/test_glb.js

12 lines
441 B
JavaScript

const fs = require('fs');
const buffer = fs.readFileSync('./apps/web/public/models/realistic-host.glb');
const chunkLength = buffer.readUInt32LE(12);
const jsonChunk = buffer.toString('utf8', 20, 20 + chunkLength);
const json = JSON.parse(jsonChunk);
if (json.meshes) {
console.log('Meshes:', json.meshes.map(m => m.name));
}
if (json.nodes) {
console.log('Mesh Nodes:', json.nodes.filter(n => n.mesh !== undefined).map(n => n.name));
}