mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: texture mutation
This commit is contained in:
1 parent
0f9f15b268
commit
7b136e61a1
3 files changed
+115
-40
No files matched your search
@@ -3,6 +3,7 @@ import { config } from 'dotenv';
|
||||
import { mkdir, readdir } from 'fs/promises';
|
||||
import { argv } from 'process';
|
||||
import sharp from 'sharp';
|
||||
import { Vector3Tuple } from 'three';
|
||||
import { TankType } from '../src/components/Tanks';
|
||||
import { NATION_IDS } from '../src/constants/nations';
|
||||
import { extractModel } from '../src/core/blitz/extractModel';
|
||||
@@ -29,6 +30,10 @@ config();
|
||||
|
||||
// WARNING! MOST OF THESE TYPES ARE NOT EXHAUSTIVE!
|
||||
|
||||
interface VehicleCustomization {
|
||||
armorColor: string;
|
||||
}
|
||||
|
||||
interface VehicleDefinitionList {
|
||||
[key: string]: {
|
||||
id: number;
|
||||
@@ -494,6 +499,14 @@ if (allTargets || targets?.includes('tankModels')) {
|
||||
const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>(
|
||||
`${DATA}/${DOI.vehicleDefinitions}/${nation}/list.xml.dvpl`,
|
||||
);
|
||||
const customization = await readXMLDVPL<{ root: VehicleCustomization }>(
|
||||
`${DATA}/${DOI.vehicleDefinitions}/${nation}/customization.xml.dvpl`,
|
||||
);
|
||||
const baseColor = customization.root.armorColor
|
||||
.split(' ')
|
||||
.slice(0, 3)
|
||||
.map(Number)
|
||||
.map((channel) => channel / 255) as Vector3Tuple;
|
||||
|
||||
for (const tankIndex in tanks.root) {
|
||||
const tank = tanks.root[tankIndex];
|
||||
@@ -511,6 +524,7 @@ if (allTargets || targets?.includes('tankModels')) {
|
||||
const model = await extractModel(
|
||||
DATA,
|
||||
parameters.resourcesPath.blitzModelPath.replace(/\.sc2$/, ''),
|
||||
baseColor,
|
||||
);
|
||||
|
||||
await mkdir(`dist/assets/models/${id}`, { recursive: true });
|
||||
|
||||
Reference in new issue
Block a user