mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: size
This commit is contained in:
1 parent
72a24b2770
commit
4da4cf5259
5 files changed
+27
-3
No files matched your search
@@ -865,7 +865,6 @@ export async function definitions(production: boolean) {
|
||||
});
|
||||
});
|
||||
|
||||
return;
|
||||
await commitAssets(
|
||||
'definitions',
|
||||
[
|
||||
|
||||
@@ -2,7 +2,9 @@ import { Flex, Heading, Tabs } from '@radix-ui/themes';
|
||||
import { use } from 'react';
|
||||
import { resolveNearPenetration } from '../../../../../../core/blitz/resolveNearPenetration';
|
||||
import { modelDefinitions } from '../../../../../../core/blitzkrieg/modelDefinitions';
|
||||
import { normalizeBoundingBox } from '../../../../../../core/blitzkrieg/normalizeBoundingBox';
|
||||
import { SHELL_NAMES } from '../../../../../../core/blitzkrieg/tankDefinitions';
|
||||
import { unionBoundingBox } from '../../../../../../core/blitzkrieg/unionBoundingBox';
|
||||
import { useDuel } from '../../../../../../stores/duel';
|
||||
import { Camouflage } from './components/Camouflage';
|
||||
import { Consumables } from './components/Consumables';
|
||||
@@ -20,6 +22,12 @@ export function Characteristics() {
|
||||
const tankModelDefinition = awaitedModelDefinitions[tank.id];
|
||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||
const size = normalizeBoundingBox(
|
||||
unionBoundingBox(
|
||||
tankModelDefinition.boundingBox,
|
||||
turretModelDefinition.boundingBox,
|
||||
),
|
||||
);
|
||||
|
||||
let dpm: number;
|
||||
|
||||
@@ -75,7 +83,7 @@ export function Characteristics() {
|
||||
{(tank.camouflage.onFire * 100).toFixed(2)}
|
||||
</Info>
|
||||
<Info indent name="Size" unit="m">
|
||||
TODO
|
||||
{size.map((component) => component.toFixed(2)).join(' x ')}
|
||||
</Info>
|
||||
</Flex>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface ModelArmor {
|
||||
spaced?: number[];
|
||||
}
|
||||
|
||||
interface BoundingBox {
|
||||
export interface BoundingBox {
|
||||
min: Vector3Tuple;
|
||||
max: Vector3Tuple;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Vector3Tuple } from 'three';
|
||||
import { BoundingBox } from './modelDefinitions';
|
||||
|
||||
export function normalizeBoundingBox(boundingBox: BoundingBox) {
|
||||
return boundingBox.max.map(
|
||||
(max, index) => max - boundingBox.min[index],
|
||||
) as Vector3Tuple;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Vector3Tuple } from 'three';
|
||||
import { BoundingBox } from './modelDefinitions';
|
||||
|
||||
export function unionBoundingBox(a: BoundingBox, b: BoundingBox) {
|
||||
return {
|
||||
min: a.min.map((a, index) => Math.min(a, b.min[index])) as Vector3Tuple,
|
||||
max: a.max.map((a, index) => Math.max(a, b.max[index])) as Vector3Tuple,
|
||||
} satisfies BoundingBox;
|
||||
}
|
||||
Reference in new issue
Block a user