diff --git a/public/test/5137.glb b/public/test/5137.glb index f201c44c0..e0c7a3ab2 100644 Binary files a/public/test/5137.glb and b/public/test/5137.glb differ diff --git a/scripts/buildAssets.ts b/scripts/buildAssets.ts index d233d61bd..3db91b009 100644 --- a/scripts/buildAssets.ts +++ b/scripts/buildAssets.ts @@ -117,6 +117,7 @@ interface VehicleDefinitions { pumpGunMode?: boolean; pumpGunReloadTimes?: string; clip?: { count: number; rate: number }; + models: { undamaged: string }; }; }; }; @@ -218,7 +219,9 @@ if (allTargets || targets?.includes('definitions')) { const tankTurrets = Object.keys(tankDefinition.root.turrets0).map( (turretKey) => { const turret = tankDefinition.root.turrets0[turretKey]; - console.log(parse(turret.models.undamaged).name); + const turretModel = Number( + parse(turret.models.undamaged).name.split('_')[1], + ); const turretId = toUniqueId(nation, turretList.root.ids[turretKey]); const turretYaw = ( typeof turret.yawLimits === 'string' @@ -247,6 +250,9 @@ if (allTargets || targets?.includes('definitions')) { ) .split(' ') .map(Number) as [number, number]; + const gunModel = Number( + parse(turretGunEntry.models.undamaged).name.split('_')[1], + ); const gunName = strings[gun.userString] ?? gunKey.replaceAll('_', ' '); const gunType = @@ -298,6 +304,7 @@ if (allTargets || targets?.includes('definitions')) { reload: gunReload, count: gunClipCount, interClip: gunInterClip, + model: gunModel, } as GunDefinition; }); @@ -310,8 +317,9 @@ if (allTargets || targets?.includes('definitions')) { .replace(/^(Turret ([0-9] )?)+/, ''), tier: turret.level as Tier, yaw: -turretYaw[0] + turretYaw[1] === 360 ? undefined : turretYaw, - gunOrigin, guns: turretGuns, + gunOrigin, + model: turretModel, } satisfies TurretDefinition; }, ); @@ -347,20 +355,20 @@ if (allTargets || targets?.includes('definitions')) { ); console.log('Committing tank definitions...'); - // await commitMultipleFiles( - // 'tresabhi', - // 'blitzkrieg-assets', - // 'main', - // 'definitions', - // [ - // { - // content: JSON.stringify(tankDefinitions), - // encoding: 'utf-8', - // path: 'definitions/tanks.json', - // }, - // ], - // true, - // ); + await commitMultipleFiles( + 'tresabhi', + 'blitzkrieg-assets', + 'main', + 'definitions', + [ + { + content: JSON.stringify(tankDefinitions), + encoding: 'utf-8', + path: 'definitions/tanks.json', + }, + ], + true, + ); } if ( diff --git a/src/app/tools/tankopedia/[id]/page.tsx b/src/app/tools/tankopedia/[id]/page.tsx index 3b049a442..302fbf22f 100644 --- a/src/app/tools/tankopedia/[id]/page.tsx +++ b/src/app/tools/tankopedia/[id]/page.tsx @@ -27,7 +27,7 @@ import { go } from 'fuzzysort'; import { debounce } from 'lodash'; import Link from 'next/link'; import { use, useEffect, useRef, useState } from 'react'; -import { Group } from 'three'; +import { Group, Mesh } from 'three'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; import { Flag } from '../../../../components/Flag'; import { ModuleButtons } from '../../../../components/ModuleButton'; @@ -130,8 +130,35 @@ export default function Page({ params }: { params: { id: string } }) { /> - - + + {Object.entries(gltf.nodes).map(([name, node]) => ( + + ))} diff --git a/src/core/blitz/extractModel.ts b/src/core/blitz/extractModel.ts index 8fc88bc1b..ec70b4174 100644 --- a/src/core/blitz/extractModel.ts +++ b/src/core/blitz/extractModel.ts @@ -323,13 +323,7 @@ export async function extractModel( }); } - // rotate 90 degrees on the x axis - const rootNode = document - .createNode('root') - .setRotation([Math.cos(Math.PI / 4), 0, 0, -Math.sin(Math.PI / 4)]); - - scene.addChild(rootNode); - parseHierarchies(sc2['#hierarchy'], rootNode); + parseHierarchies(sc2['#hierarchy'], scene); return document; } diff --git a/src/core/blitzkrieg/tankDefinitions.ts b/src/core/blitzkrieg/tankDefinitions.ts index 1dcd872a5..e76fd0504 100644 --- a/src/core/blitzkrieg/tankDefinitions.ts +++ b/src/core/blitzkrieg/tankDefinitions.ts @@ -27,8 +27,9 @@ export interface TurretDefinition { name: string; tier: Tier; yaw?: [number, number]; - gunOrigin: Vector3Tuple; guns: GunDefinition[]; + gunOrigin: Vector3Tuple; + model: number; } export type GunDefinition = GunDefinitionBase & (GunDefinitionRegular | GunDefinitionAutoLoader | GunDefinitionAutoReloader); @@ -38,6 +39,7 @@ interface GunDefinitionBase { tier: Tier; pitch: [number, number]; shells: ShellDefinition[]; + model: number; } interface GunDefinitionRegular { type: 'regular';