feat: uhhh I forgot

This commit is contained in:
TrèsAbhi committed 2024-01-13 13:11:01 -06:00
1 parent 785e9650e5
commit dbbde066f8
5 files changed
+82 -91

No files matched your search

@@ -99,6 +99,17 @@ export function TankArmor({ ...props }: TankArmorProps) {
turretPosition.add(turretOrigin);
// const tracksGeometry = mergeBufferGeometries(
// modelNodes
// .map((node) => {
// const isWheel = node.name.startsWith('chassis_wheel_');
// const isTrack = node.name.startsWith('chassis_track_');
// const isVisible = isWheel || isTrack;
// if (isVisible) return (node as Mesh).geometry;
// })
// .filter(Boolean),
// );
return (
<HeadsUpDisplay>
<Lighting />
@@ -136,11 +147,23 @@ export function TankArmor({ ...props }: TankArmorProps) {
penetration={penetration}
thickness={thickness}
ricochet={ricochet}
isArmor
/>
);
})}
{/* <ArmorMesh
geometry={tracksGeometry!}
caliber={antagonist.shell.caliber}
canSplash={splashCapable}
isExplosive={explosiveCapable}
isSpaced
normalization={normalization}
penetration={penetration}
thickness={50}
ricochet={ricochet}
isExternalModule
/> */}
{modelNodes.map((node) => {
const isWheel = node.name.startsWith('chassis_wheel_');
const isTrack = node.name.startsWith('chassis_track_');
@@ -161,7 +184,7 @@ export function TankArmor({ ...props }: TankArmorProps) {
penetration={penetration}
thickness={thickness}
ricochet={ricochet}
isArmor={false}
isExternalModule
/>
);
})}
@@ -200,11 +223,9 @@ export function TankArmor({ ...props }: TankArmorProps) {
penetration={penetration}
thickness={thickness}
ricochet={ricochet}
isArmor
/>
);
})}
<group
position={new Vector3()
.sub(turretOrigin)
@@ -245,7 +266,6 @@ export function TankArmor({ ...props }: TankArmorProps) {
penetration={penetration}
thickness={thickness}
ricochet={ricochet}
isArmor
/>
);
})}
@@ -271,7 +291,7 @@ export function TankArmor({ ...props }: TankArmorProps) {
penetration={penetration}
thickness={thickness}
ricochet={ricochet}
isArmor={false}
isExternalModule
/>
);
})}
+4 -4
View File
@@ -8,7 +8,7 @@ interface ArmorMeshProps extends MeshProps {
isExplosive: boolean;
canSplash: boolean;
isSpaced: boolean;
isArmor: boolean;
isExternalModule?: boolean;
thickness: number;
penetration: number;
caliber: number;
@@ -20,7 +20,7 @@ export function ArmorMesh({
isExplosive,
canSplash,
isSpaced,
isArmor,
isExternalModule = false,
thickness,
penetration,
caliber,
@@ -36,7 +36,7 @@ export function ArmorMesh({
</mesh>
)}
<mesh {...props} renderOrder={1}>
<mesh {...props}>
<CustomShaderMaterial
silent
baseMaterial={MeshStandardMaterial}
@@ -48,7 +48,7 @@ export function ArmorMesh({
isExplosive: { value: isExplosive },
canSplash: { value: canSplash },
isSpaced: { value: isSpaced },
isArmor: { value: isArmor },
isExternalModule: { value: isExternalModule },
thickness: { value: thickness },
penetration: { value: penetration },
caliber: { value: caliber },
@@ -4,7 +4,7 @@ varying vec3 vCSMViewPosition;
uniform bool isExplosive;
uniform bool canSplash;
uniform bool isSpaced;
uniform bool isArmor;
uniform bool isExternalModule;
uniform float thickness;
uniform float penetration;
uniform float caliber;
@@ -21,7 +21,7 @@ void main() {
float splashChance = -1.0;
bool threeCalibersRule = caliber > 3.0 * thickness;
if (isArmor && !isExplosive && !threeCalibersRule && angle >= ricochet) {
if (!isExternalModule && !isExplosive && !threeCalibersRule && angle >= ricochet) {
penetrationChance = 0.0;
splashChance = 0.0;
} else {
@@ -56,14 +56,14 @@ void main() {
}
if (isSpaced) {
if (isArmor) {
if (isExternalModule) {
csm_FragColor = vec4(0.5, 0.0, 1.0, 0.5);
} else {
if (isExplosive) {
csm_FragColor = vec4(1.0, 0.0, 1.0, 0.5);
} else {
csm_FragColor = vec4(1.0, 0.0, 1.0, (1.0 - penetrationChance) * 0.5);
}
} else {
csm_FragColor = vec4(0.5, 0.0, 1.0, 0.5);
}
} else {
csm_FragColor = vec4(1.0, splashChance * 0.392, 0.0, (1.0 - penetrationChance) * 0.5);