mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: started work on armor extraction
This commit is contained in:
1 parent
1f39ecefe4
commit
7235291e69
16 files changed
+277
-43
No files matched your search
@@ -1,13 +1,19 @@
|
||||
import { NodeIO } from '@gltf-transform/core';
|
||||
import { readdir } from 'fs/promises';
|
||||
import { DATA, DOI } from '.';
|
||||
import { NATION_IDS } from '../../src/constants/nations';
|
||||
import { extractModel } from '../../src/core/blitz/extractModel';
|
||||
import { extractArmor } from '../../src/core/blitz/extractArmor';
|
||||
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
||||
import { toUniqueId } from '../../src/core/blitz/toUniqueId';
|
||||
import { DATA, DOI } from './constants';
|
||||
import { VehicleDefinitionList } from './definitions';
|
||||
|
||||
BigInt.prototype.toJSON = function () {
|
||||
return this.toString();
|
||||
};
|
||||
|
||||
export async function buildTankArmors() {
|
||||
console.log('Building tank armors...');
|
||||
|
||||
const nodeIO = new NodeIO();
|
||||
const nations = await readdir(`${DATA}/${DOI.vehicleDefinitions}`).then(
|
||||
(nations) => nations.filter((nation) => nation !== 'common'),
|
||||
);
|
||||
@@ -20,17 +26,19 @@ export async function buildTankArmors() {
|
||||
|
||||
for (const tankKey in tanks.root) {
|
||||
const tank = tanks.root[tankKey];
|
||||
const nationVehicleId = tank.id;
|
||||
const id = (nationVehicleId << 8) + (NATION_IDS[nation] << 4) + 1;
|
||||
const id = toUniqueId(nation, tank.id);
|
||||
|
||||
if (id !== 24609) continue; // concept 1b
|
||||
|
||||
const model = extractModel(
|
||||
DATA,
|
||||
`${DOI.collisionMeshes}/${nation}-${tankKey}`,
|
||||
);
|
||||
// if (id !== 7297) continue; // 60tp
|
||||
if (id !== 5137) continue; // tiger ii
|
||||
// if (id !== 24609) continue; // concept 1b
|
||||
|
||||
console.log(`Building armor ${id} @ ${nation}/${tankKey}`);
|
||||
|
||||
const armor = await extractArmor(DATA, `${nation}-${tankKey}`);
|
||||
|
||||
// await nodeIO.write('temp/armor/index.gltf', armor);
|
||||
|
||||
// writeFile('test.sc2.json', JSON.stringify(sc2, null, 2));
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user