fix: no accessor overrides

This commit is contained in:
TrèsAbhi committed 2024-01-04 12:11:36 -06:00
1 parent 35d03c9e21
commit 2cf0bda352
3 files changed
+3 -14

No files matched your search

+1 -12
View File
@@ -1,5 +1,4 @@
import { Document, Material, Node, Scene } from '@gltf-transform/core';
import { writeFile } from 'fs/promises';
import { range, times } from 'lodash';
import { dirname } from 'path';
import {
@@ -15,10 +14,6 @@ import { ScgStream, vertexAttributeVectorSizes } from '../streams/scg';
import { VertexAttribute } from '../streams/scpg';
import { readDVPLFile } from './readDVPLFile';
BigInt.prototype.toJSON = function () {
return this.toString();
};
const MAX_FLOAT32 = 2 ** 127 * (2 - 2 ** -23);
const vertexAttributeGLTFName: Partial<Record<VertexAttribute, string>> = {
@@ -59,8 +54,6 @@ export async function extractModel(
const buffer = document.createBuffer();
const materials = new Map<bigint, Material | bigint>();
writeFile('test.sc2.json', JSON.stringify(sc2, null, 2));
// create materials
await Promise.all(
sc2['#dataNodes'].map(async (node) => {
@@ -259,10 +252,6 @@ export async function extractModel(
);
}
if (hierarchy.name === 'chassis_track_L') {
console.log(minLODDistanceBatchId);
}
const batch =
component['rc.renderObj']['ro.batches'][
minLODDistanceBatchId!.toString().padStart(4, '0')
@@ -314,7 +303,7 @@ export async function extractModel(
indexedAttributes.forEach((attribute) => {
const name = vertexAttributeGLTFName[attribute];
if (!name) return; // no equivalent GLTF attribute
if (!name || primitive.getAttribute(name)) return;
const vertexSize = vertexAttributeGltfVectorSizes[attribute];
const attributeAccessor = document