mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: bounding boxes
This commit is contained in:
1 parent
9141f3d63f
commit
72a24b2770
5 files changed
+37
-7
No files matched your search
Vendored
+1
@@ -9,6 +9,7 @@
|
|||||||
"artefacts",
|
"artefacts",
|
||||||
"atgm",
|
"atgm",
|
||||||
"AYUV",
|
"AYUV",
|
||||||
|
"bbox",
|
||||||
"bepaint",
|
"bepaint",
|
||||||
"BINORMAL",
|
"BINORMAL",
|
||||||
"Binormals",
|
"Binormals",
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
Tier,
|
Tier,
|
||||||
} from '../../src/core/blitzkrieg/tankDefinitions';
|
} from '../../src/core/blitzkrieg/tankDefinitions';
|
||||||
import { DATA, POI } from './constants';
|
import { DATA, POI } from './constants';
|
||||||
|
import { TankParameters } from './tankIcons';
|
||||||
|
|
||||||
type BlitzTankType = 'AT-SPG' | 'lightTank' | 'mediumTank' | 'heavyTank';
|
type BlitzTankType = 'AT-SPG' | 'lightTank' | 'mediumTank' | 'heavyTank';
|
||||||
interface Strings {
|
interface Strings {
|
||||||
@@ -119,6 +120,9 @@ interface VehicleDefinitions {
|
|||||||
yawLimits: string | string[];
|
yawLimits: string | string[];
|
||||||
gunPosition: string | string[];
|
gunPosition: string | string[];
|
||||||
models: { undamaged: string };
|
models: { undamaged: string };
|
||||||
|
hitTester: {
|
||||||
|
collisionModel: string;
|
||||||
|
};
|
||||||
guns: {
|
guns: {
|
||||||
[key: string]: {
|
[key: string]: {
|
||||||
armor: VehicleDefinitionArmor & {
|
armor: VehicleDefinitionArmor & {
|
||||||
@@ -338,6 +342,9 @@ export async function definitions(production: boolean) {
|
|||||||
const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>(
|
const tankDefinition = await readXMLDVPL<{ root: VehicleDefinitions }>(
|
||||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/${tankKey}.xml.dvpl`,
|
`${DATA}/${POI.vehicleDefinitions}/${nation}/${tankKey}.xml.dvpl`,
|
||||||
);
|
);
|
||||||
|
const tankParameters = await readYAMLDVPL<TankParameters>(
|
||||||
|
`${DATA}/${POI.tankParameters}/${nation}/${tankKey}.yaml.dvpl`,
|
||||||
|
);
|
||||||
const defaultChassis = Object.values(tankDefinition.root.chassis).at(
|
const defaultChassis = Object.values(tankDefinition.root.chassis).at(
|
||||||
-1,
|
-1,
|
||||||
)!;
|
)!;
|
||||||
@@ -426,6 +433,7 @@ export async function definitions(production: boolean) {
|
|||||||
roll: tankDefinition.root.hull.turretInitialRotation.roll,
|
roll: tankDefinition.root.hull.turretInitialRotation.roll,
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
|
boundingBox: tankParameters.collision.hull.bbox,
|
||||||
turrets: {},
|
turrets: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -507,6 +515,10 @@ export async function definitions(production: boolean) {
|
|||||||
? undefined
|
? undefined
|
||||||
: { min: turretYaw[0], max: turretYaw[1] },
|
: { min: turretYaw[0], max: turretYaw[1] },
|
||||||
guns: {},
|
guns: {},
|
||||||
|
boundingBox:
|
||||||
|
tankParameters.collision[
|
||||||
|
parsePath(turret.hitTester.collisionModel).name.toLowerCase()
|
||||||
|
].bbox,
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(turret.guns).forEach((gunKey, gunIndex) => {
|
Object.keys(turret.guns).forEach((gunKey, gunIndex) => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { readdir } from 'fs/promises';
|
import { readdir } from 'fs/promises';
|
||||||
|
import { Vector3Tuple } from 'three';
|
||||||
import { NATION_IDS } from '../../src/constants/nations';
|
import { NATION_IDS } from '../../src/constants/nations';
|
||||||
import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL';
|
import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL';
|
||||||
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
||||||
@@ -14,6 +15,16 @@ export interface TankParameters {
|
|||||||
bigIconPath: string;
|
bigIconPath: string;
|
||||||
blitzModelPath: string;
|
blitzModelPath: string;
|
||||||
};
|
};
|
||||||
|
collision: {
|
||||||
|
[key: string]: {
|
||||||
|
points: Vector3Tuple;
|
||||||
|
bbox: {
|
||||||
|
min: Vector3Tuple;
|
||||||
|
max: Vector3Tuple;
|
||||||
|
};
|
||||||
|
averageThickness?: Record<string, number>;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function buildTankIcons(production: boolean) {
|
export async function buildTankIcons(production: boolean) {
|
||||||
|
|||||||
@@ -57,22 +57,22 @@ export function Characteristics() {
|
|||||||
{Math.round(engine.fire_chance * 100)}
|
{Math.round(engine.fire_chance * 100)}
|
||||||
</Info>
|
</Info>
|
||||||
<Info name="View range" unit="m">
|
<Info name="View range" unit="m">
|
||||||
TODO
|
{turret.view_range}
|
||||||
</Info>
|
</Info>
|
||||||
<Info name="Camouflage when still" unit="%">
|
<Info name="Camouflage when still" unit="%">
|
||||||
TODO
|
{(tank.camouflage.still * 100).toFixed(2)}
|
||||||
</Info>
|
</Info>
|
||||||
<Info indent name="Moving" unit="%">
|
<Info indent name="Moving" unit="%">
|
||||||
TODO
|
{(tank.camouflage.moving * 100).toFixed(2)}
|
||||||
</Info>
|
</Info>
|
||||||
<Info indent name="Shooting still" unit="%">
|
<Info indent name="Shooting still" unit="%">
|
||||||
TODO
|
{(tank.camouflage.still * gun.camouflageLoss * 100).toFixed(2)}
|
||||||
</Info>
|
</Info>
|
||||||
<Info indent name="Shooting on move" unit="%">
|
<Info indent name="Shooting on move" unit="%">
|
||||||
TODO
|
{(tank.camouflage.moving * gun.camouflageLoss * 100).toFixed(2)}
|
||||||
</Info>
|
</Info>
|
||||||
<Info indent name="On fire" unit="%">
|
<Info indent name="On fire penalty" unit="%">
|
||||||
TODO
|
{(tank.camouflage.onFire * 100).toFixed(2)}
|
||||||
</Info>
|
</Info>
|
||||||
<Info indent name="Size" unit="m">
|
<Info indent name="Size" unit="m">
|
||||||
TODO
|
TODO
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ export interface ModelArmor {
|
|||||||
spaced?: number[];
|
spaced?: number[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface BoundingBox {
|
||||||
|
min: Vector3Tuple;
|
||||||
|
max: Vector3Tuple;
|
||||||
|
}
|
||||||
interface ModelDefinition {
|
interface ModelDefinition {
|
||||||
armor: ModelArmor;
|
armor: ModelArmor;
|
||||||
trackThickness: number;
|
trackThickness: number;
|
||||||
@@ -15,6 +19,7 @@ interface ModelDefinition {
|
|||||||
hullOrigin: Vector3Tuple;
|
hullOrigin: Vector3Tuple;
|
||||||
turretRotation?: InitialTurretRotation;
|
turretRotation?: InitialTurretRotation;
|
||||||
turrets: Record<number, TurretModelDefinition>;
|
turrets: Record<number, TurretModelDefinition>;
|
||||||
|
boundingBox: BoundingBox;
|
||||||
}
|
}
|
||||||
export interface InitialTurretRotation {
|
export interface InitialTurretRotation {
|
||||||
yaw: number;
|
yaw: number;
|
||||||
@@ -22,6 +27,7 @@ export interface InitialTurretRotation {
|
|||||||
roll: number;
|
roll: number;
|
||||||
}
|
}
|
||||||
interface TurretModelDefinition {
|
interface TurretModelDefinition {
|
||||||
|
boundingBox: BoundingBox;
|
||||||
armor: ModelArmor;
|
armor: ModelArmor;
|
||||||
model: number;
|
model: number;
|
||||||
gunOrigin: Vector3Tuple;
|
gunOrigin: Vector3Tuple;
|
||||||
|
|||||||
Reference in new issue
Block a user