mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
fix: min penetration chance 0
This commit is contained in:
1 parent
59abda933f
commit
3cd23cd718
7 files changed
+21
-42
No files matched your search
@@ -20,6 +20,8 @@ export async function buildTankArmors() {
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
nations.map(async (nation) => {
|
nations.map(async (nation) => {
|
||||||
|
if (nation !== 'usa') return;
|
||||||
|
|
||||||
const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>(
|
const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>(
|
||||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`,
|
`${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`,
|
||||||
);
|
);
|
||||||
@@ -28,8 +30,6 @@ export async function buildTankArmors() {
|
|||||||
Object.entries(tanks.root).map(async ([tankKey, tank]) => {
|
Object.entries(tanks.root).map(async ([tankKey, tank]) => {
|
||||||
const id = toUniqueId(nation, tank.id);
|
const id = toUniqueId(nation, tank.id);
|
||||||
|
|
||||||
if (id !== 26897) return;
|
|
||||||
|
|
||||||
console.log(`Building armor ${id} @ ${nation}/${tankKey}`);
|
console.log(`Building armor ${id} @ ${nation}/${tankKey}`);
|
||||||
|
|
||||||
const model = await extractArmor(DATA, `${nation}-${tankKey}`);
|
const model = await extractArmor(DATA, `${nation}-${tankKey}`);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export async function buildTankModels() {
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
nations.map(async (nation) => {
|
nations.map(async (nation) => {
|
||||||
|
if (nation !== 'usa') return;
|
||||||
|
|
||||||
const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>(
|
const tanks = await readXMLDVPL<{ root: VehicleDefinitionList }>(
|
||||||
`${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`,
|
`${DATA}/${POI.vehicleDefinitions}/${nation}/list.xml.dvpl`,
|
||||||
);
|
);
|
||||||
@@ -43,8 +45,6 @@ export async function buildTankModels() {
|
|||||||
Object.entries(tanks.root).map(async ([tankKey, tank]) => {
|
Object.entries(tanks.root).map(async ([tankKey, tank]) => {
|
||||||
const id = toUniqueId(nation, tank.id);
|
const id = toUniqueId(nation, tank.id);
|
||||||
|
|
||||||
if (id !== 26897) return;
|
|
||||||
|
|
||||||
console.log(`Building model ${id} @ ${nation}/${tankKey}`);
|
console.log(`Building model ${id} @ ${nation}/${tankKey}`);
|
||||||
|
|
||||||
const parameters = await readYAMLDVPL<TankParameters>(
|
const parameters = await readYAMLDVPL<TankParameters>(
|
||||||
|
|||||||
-1
@@ -106,7 +106,6 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const armorGltf = useArmor(duel.protagonist.tank.id);
|
const armorGltf = useArmor(duel.protagonist.tank.id);
|
||||||
|
|
||||||
const armorNodes = Object.values(armorGltf.nodes);
|
const armorNodes = Object.values(armorGltf.nodes);
|
||||||
const tankModelDefinition = modelDefinitions[duel.protagonist.tank.id];
|
const tankModelDefinition = modelDefinitions[duel.protagonist.tank.id];
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
|
|||||||
-35
@@ -14,7 +14,6 @@ import {
|
|||||||
import { nameToArmorId } from '../../../../../../../../../core/blitzkrieg/nameToArmorId';
|
import { nameToArmorId } from '../../../../../../../../../core/blitzkrieg/nameToArmorId';
|
||||||
import { resolveArmor } from '../../../../../../../../../core/blitzkrieg/resolveThickness';
|
import { resolveArmor } from '../../../../../../../../../core/blitzkrieg/resolveThickness';
|
||||||
import { useArmor } from '../../../../../../../../../hooks/useArmor';
|
import { useArmor } from '../../../../../../../../../hooks/useArmor';
|
||||||
import { useModel } from '../../../../../../../../../hooks/useModel';
|
|
||||||
import { useModelDefinitions } from '../../../../../../../../../hooks/useModelDefinitions';
|
import { useModelDefinitions } from '../../../../../../../../../hooks/useModelDefinitions';
|
||||||
import { useTankopedia } from '../../../../../../../../../stores/tankopedia';
|
import { useTankopedia } from '../../../../../../../../../stores/tankopedia';
|
||||||
import { Duel } from '../../../../../page';
|
import { Duel } from '../../../../../page';
|
||||||
@@ -120,10 +119,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const armorGltf = useArmor(duel.protagonist.tank.id);
|
const armorGltf = useArmor(duel.protagonist.tank.id);
|
||||||
const modelGltf = useModel(duel.protagonist.tank.id);
|
|
||||||
|
|
||||||
const armorNodes = Object.values(armorGltf.nodes);
|
const armorNodes = Object.values(armorGltf.nodes);
|
||||||
const modelNodes = Object.values(modelGltf.nodes);
|
|
||||||
const tankModelDefinition = modelDefinitions[duel.protagonist.tank.id];
|
const tankModelDefinition = modelDefinitions[duel.protagonist.tank.id];
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
tankModelDefinition.turrets[duel.protagonist.turret.id];
|
tankModelDefinition.turrets[duel.protagonist.turret.id];
|
||||||
@@ -178,21 +174,6 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{modelNodes.map((node) => {
|
|
||||||
const isWheel = node.name.startsWith('chassis_wheel_');
|
|
||||||
const isTrack = node.name.startsWith('chassis_track_');
|
|
||||||
const isVisible = isWheel || isTrack;
|
|
||||||
|
|
||||||
if (!isVisible) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ArmorMeshSpacedArmorDepth
|
|
||||||
key={node.uuid}
|
|
||||||
geometry={(node as Mesh).geometry}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
|
|
||||||
<group ref={turretContainer}>
|
<group ref={turretContainer}>
|
||||||
{armorNodes.map((node) => {
|
{armorNodes.map((node) => {
|
||||||
const isCurrentTurret = node.name.startsWith(
|
const isCurrentTurret = node.name.startsWith(
|
||||||
@@ -243,22 +224,6 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{modelNodes.map((node) => {
|
|
||||||
const isCurrentGun =
|
|
||||||
node.name ===
|
|
||||||
`gun_${gunModelDefinition.model.toString().padStart(2, '0')}`;
|
|
||||||
const isVisible = isCurrentGun;
|
|
||||||
|
|
||||||
if (!isVisible) return null;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ArmorMeshSpacedArmorDepth
|
|
||||||
key={node.uuid}
|
|
||||||
geometry={(node as Mesh).geometry}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ void main() {
|
|||||||
float dotProduct = dot(normalizedNormal, -normalizedViewPosition);
|
float dotProduct = dot(normalizedNormal, -normalizedViewPosition);
|
||||||
float angle = acos(dotProduct);
|
float angle = acos(dotProduct);
|
||||||
float spacedArmorAngle = spacedArmorMaskColor.r * PI;
|
float spacedArmorAngle = spacedArmorMaskColor.r * PI;
|
||||||
|
|
||||||
float penetrationChance = -1.0;
|
float penetrationChance = -1.0;
|
||||||
float splashChance = -1.0;
|
float splashChance = -1.0;
|
||||||
bool threeCalibersRule = caliber > 3.0 * thickness;
|
bool threeCalibersRule = caliber > 3.0 * thickness;
|
||||||
@@ -85,7 +84,7 @@ void main() {
|
|||||||
} else if (delta < -randomRadius) {
|
} else if (delta < -randomRadius) {
|
||||||
penetrationChance = 1.0;
|
penetrationChance = 1.0;
|
||||||
} else {
|
} else {
|
||||||
penetrationChance = 1.0 - (delta + randomRadius) / (2.0 * randomRadius);
|
penetrationChance = max(1.0 - (delta + randomRadius) / (2.0 * randomRadius), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canSplash) {
|
if (canSplash) {
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ export async function extractModel(
|
|||||||
case 'MotionComponent':
|
case 'MotionComponent':
|
||||||
case 'TankElementComponent':
|
case 'TankElementComponent':
|
||||||
case 'SkeletonComponent':
|
case 'SkeletonComponent':
|
||||||
|
case 'AnimationComponent':
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'TransformComponent': {
|
case 'TransformComponent': {
|
||||||
@@ -183,6 +184,15 @@ export async function extractModel(
|
|||||||
const rotation = new Quaternion();
|
const rotation = new Quaternion();
|
||||||
const scale = new Vector3();
|
const scale = new Vector3();
|
||||||
|
|
||||||
|
if (
|
||||||
|
!component['tc.worldTranslation'] ||
|
||||||
|
!component['tc.worldScale'] ||
|
||||||
|
!component['tc.localTranslation'] ||
|
||||||
|
!component['tc.localScale']
|
||||||
|
) {
|
||||||
|
console.log(component);
|
||||||
|
}
|
||||||
|
|
||||||
new Matrix4()
|
new Matrix4()
|
||||||
.multiplyMatrices(
|
.multiplyMatrices(
|
||||||
new Matrix4().compose(
|
new Matrix4().compose(
|
||||||
|
|||||||
@@ -265,6 +265,12 @@ export type Component =
|
|||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
jointsCount: number;
|
jointsCount: number;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
'comp.typename': 'AnimationComponent';
|
||||||
|
animation: bigint;
|
||||||
|
animationTimeScale: number;
|
||||||
|
repeatsCount: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface SceneComponents {
|
interface SceneComponents {
|
||||||
|
|||||||
Reference in new issue
Block a user