mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: more accurate models
This commit is contained in:
1 parent
bc85b354a0
commit
60a115b7d8
9 files changed
+39
-38
No files matched your search
@@ -16,8 +16,8 @@ Buffer.prototype.toJSON = function () {
|
||||
export async function extractArmor(data: string, fileName: string) {
|
||||
const sc2Path = `${data}/3d/Tanks/CollisionMeshes/${fileName}.sc2.dvpl`;
|
||||
const scgPath = `${data}/3d/Tanks/CollisionMeshes/${fileName}.scg.dvpl`;
|
||||
const sc2 = new Sc2ReadStream(await readDVPLFile(sc2Path)).sc2();
|
||||
const scg = new ScgReadStream(await readDVPLFile(scgPath)).scg();
|
||||
const sc2 = new Sc2ReadStream((await readDVPLFile(sc2Path)).buffer).sc2();
|
||||
const scg = new ScgReadStream((await readDVPLFile(scgPath)).buffer).scg();
|
||||
const document = new Document();
|
||||
const scene = document.createScene();
|
||||
const buffer = document.createBuffer();
|
||||
|
||||
@@ -48,8 +48,8 @@ export async function extractModel(
|
||||
) {
|
||||
const sc2Path = `${data}/3d/${path}.sc2.dvpl`;
|
||||
const scgPath = `${data}/3d/${path}.scg.dvpl`;
|
||||
const sc2 = new Sc2ReadStream(await readDVPLFile(sc2Path)).sc2();
|
||||
const scg = new ScgReadStream(await readDVPLFile(scgPath)).scg();
|
||||
const sc2 = new Sc2ReadStream((await readDVPLFile(sc2Path)).buffer).sc2();
|
||||
const scg = new ScgReadStream((await readDVPLFile(scgPath)).buffer).scg();
|
||||
const document = new Document();
|
||||
const scene = document.createScene();
|
||||
const buffer = document.createBuffer();
|
||||
@@ -58,7 +58,7 @@ export async function extractModel(
|
||||
// create materials
|
||||
await Promise.all(
|
||||
sc2['#dataNodes'].map(async (node) => {
|
||||
const id = node['#id'].readBigUInt64LE();
|
||||
const id = new DataView(node['#id']).getBigUint64(0, true);
|
||||
|
||||
if (node.parentMaterialKey !== undefined) {
|
||||
/**
|
||||
@@ -140,7 +140,7 @@ export async function extractModel(
|
||||
}
|
||||
}
|
||||
|
||||
materials.set(node['#id'].readBigUInt64LE(), material);
|
||||
materials.set(new DataView(node['#id']).getBigUint64(0, true), material);
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user