fix: min penetration chance 0

This commit is contained in:
TrèsAbhi committed 2024-01-19 23:33:27 -06:00
1 parent 59abda933f
commit 3cd23cd718
7 files changed
+21 -42

No files matched your search

@@ -106,7 +106,6 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
});
const armorGltf = useArmor(duel.protagonist.tank.id);
const armorNodes = Object.values(armorGltf.nodes);
const tankModelDefinition = modelDefinitions[duel.protagonist.tank.id];
const turretModelDefinition =
@@ -14,7 +14,6 @@ import {
import { nameToArmorId } from '../../../../../../../../../core/blitzkrieg/nameToArmorId';
import { resolveArmor } from '../../../../../../../../../core/blitzkrieg/resolveThickness';
import { useArmor } from '../../../../../../../../../hooks/useArmor';
import { useModel } from '../../../../../../../../../hooks/useModel';
import { useModelDefinitions } from '../../../../../../../../../hooks/useModelDefinitions';
import { useTankopedia } from '../../../../../../../../../stores/tankopedia';
import { Duel } from '../../../../../page';
@@ -120,10 +119,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
});
const armorGltf = useArmor(duel.protagonist.tank.id);
const modelGltf = useModel(duel.protagonist.tank.id);
const armorNodes = Object.values(armorGltf.nodes);
const modelNodes = Object.values(modelGltf.nodes);
const tankModelDefinition = modelDefinitions[duel.protagonist.tank.id];
const turretModelDefinition =
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}>
{armorNodes.map((node) => {
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>
@@ -40,7 +40,6 @@ void main() {
float dotProduct = dot(normalizedNormal, -normalizedViewPosition);
float angle = acos(dotProduct);
float spacedArmorAngle = spacedArmorMaskColor.r * PI;
float penetrationChance = -1.0;
float splashChance = -1.0;
bool threeCalibersRule = caliber > 3.0 * thickness;
@@ -85,7 +84,7 @@ void main() {
} else if (delta < -randomRadius) {
penetrationChance = 1.0;
} else {
penetrationChance = 1.0 - (delta + randomRadius) / (2.0 * randomRadius);
penetrationChance = max(1.0 - (delta + randomRadius) / (2.0 * randomRadius), 0.0);
}
if (canSplash) {
+10
View File
@@ -176,6 +176,7 @@ export async function extractModel(
case 'MotionComponent':
case 'TankElementComponent':
case 'SkeletonComponent':
case 'AnimationComponent':
break;
case 'TransformComponent': {
@@ -183,6 +184,15 @@ export async function extractModel(
const rotation = new Quaternion();
const scale = new Vector3();
if (
!component['tc.worldTranslation'] ||
!component['tc.worldScale'] ||
!component['tc.localTranslation'] ||
!component['tc.localScale']
) {
console.log(component);
}
new Matrix4()
.multiplyMatrices(
new Matrix4().compose(
+6
View File
@@ -265,6 +265,12 @@ export type Component =
}
>;
jointsCount: number;
}
| {
'comp.typename': 'AnimationComponent';
animation: bigint;
animationTimeScale: number;
repeatsCount: number;
};
interface SceneComponents {