feat: more accurate models

This commit is contained in:
TrèsAbhi committed 2024-02-18 16:17:00 -06:00
1 parent bc85b354a0
commit 60a115b7d8
9 files changed
+39 -38

No files matched your search

@@ -25,5 +25,3 @@ export interface EquipmentDefinitions {
export const equipmentDefinitions = fetchCdonLz4<EquipmentDefinitions>(
asset('definitions/equipment.cdon.lz4'),
);
equipmentDefinitions.then(console.log);
+5 -5
View File
@@ -36,8 +36,8 @@ export async function readTexture(path: string, options?: ReadTextureOptions) {
const decompressedDvpl = await readDVPLFile(resolvedTexturePath);
const raw = isDds
? await new DdsReadStream(decompressedDvpl).dds()
: new PvrReadStream(decompressedDvpl).pvr();
? await new DdsReadStream(decompressedDvpl.buffer).dds()
: new PvrReadStream(decompressedDvpl.buffer).pvr();
const channels = 4 * raw.width * raw.height;
switch (options?.mutation) {
@@ -81,11 +81,11 @@ export async function readTexture(path: string, options?: ReadTextureOptions) {
case TextureMutation.Miscellaneous: {
for (let index = 0; index < channels; index += 4) {
/**
* Green is ambient occlusion and alpha is emissive. But very few tanks
* Alpha is ambient occlusion and green is emissive. But very few tanks
* use emissive so I am ignoring it for now.
*/
const occlusion = raw.data[index + 1];
// const emissive = raw.data[index + 3];
// const emissive = raw.data[index + 1];
const occlusion = raw.data[index + 3];
raw.data[index] = occlusion;
raw.data[index + 1] = 0;