mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: removed spaced armor visuals
This commit is contained in:
1 parent
40c69382a1
commit
aadcaedae5
8 files changed
+18
-100
No files matched your search
@@ -132,6 +132,7 @@ export function TankDisplay({ duel }: TankDisplayProps) {
|
||||
>
|
||||
<TankModel duel={duel} />
|
||||
<TankArmor duel={duel} />
|
||||
{/* <SpacedArmorDepth duel={duel} /> */}
|
||||
</Suspense>
|
||||
</Canvas>
|
||||
</div>
|
||||
|
||||
@@ -16,9 +16,6 @@ interface OptionsProps {
|
||||
|
||||
export function Options({ isFullScreen, canvas }: OptionsProps) {
|
||||
const showGrid = useTankopedia((state) => state.model.visual.showGrid);
|
||||
const showSpacedArmor = useTankopedia(
|
||||
(state) => state.model.visual.showSpacedArmor,
|
||||
);
|
||||
|
||||
return (
|
||||
<Flex
|
||||
@@ -47,17 +44,6 @@ export function Options({ isFullScreen, canvas }: OptionsProps) {
|
||||
>
|
||||
Show grid
|
||||
</DropdownMenu.CheckboxItem>
|
||||
|
||||
<DropdownMenu.CheckboxItem
|
||||
checked={showSpacedArmor}
|
||||
onCheckedChange={(checked) => {
|
||||
mutateTankopedia((draft) => {
|
||||
draft.model.visual.showSpacedArmor = checked;
|
||||
});
|
||||
}}
|
||||
>
|
||||
Spaced armor
|
||||
</DropdownMenu.CheckboxItem>
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Root>
|
||||
|
||||
|
||||
+3
-24
@@ -27,9 +27,6 @@ interface ArmorHighlightingProps {
|
||||
export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
const wrapper = useRef<Group>(null);
|
||||
const awaitedModelDefinitions = useModelDefinitions();
|
||||
const showSpacedArmor = useTankopedia(
|
||||
(state) => state.model.visual.showSpacedArmor,
|
||||
);
|
||||
const turretContainer = useRef<Group>(null);
|
||||
const gunContainer = useRef<Group>(null);
|
||||
const initialTankopediaState = useTankopedia.getState();
|
||||
@@ -165,12 +162,7 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined || spaced) return null;
|
||||
|
||||
return (
|
||||
<ArmorMesh
|
||||
@@ -179,7 +171,6 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
duel={duel}
|
||||
key={node.uuid}
|
||||
geometry={(node as Mesh).geometry}
|
||||
isSpaced={spaced ?? false}
|
||||
thickness={thickness}
|
||||
/>
|
||||
);
|
||||
@@ -197,12 +188,7 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined || spaced) return null;
|
||||
|
||||
return (
|
||||
<ArmorMesh
|
||||
@@ -212,7 +198,6 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
key={node.uuid}
|
||||
geometry={(node as Mesh).geometry}
|
||||
position={turretOrigin}
|
||||
isSpaced={spaced ?? false}
|
||||
thickness={thickness}
|
||||
/>
|
||||
);
|
||||
@@ -229,12 +214,7 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined || spaced) return null;
|
||||
|
||||
return (
|
||||
<ArmorMesh
|
||||
@@ -244,7 +224,6 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
|
||||
key={node.uuid}
|
||||
geometry={(node as Mesh).geometry}
|
||||
position={turretOrigin.clone().add(gunOrigin)}
|
||||
isSpaced={spaced ?? false}
|
||||
thickness={thickness}
|
||||
/>
|
||||
);
|
||||
|
||||
+5
-23
@@ -34,9 +34,6 @@ interface ExternalModuleMaskProps {
|
||||
export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
|
||||
const wrapper = useRef<Group>(null);
|
||||
const awaitedModelDefinitions = useModelDefinitions();
|
||||
const showSpacedArmor = useTankopedia(
|
||||
(state) => state.model.visual.showSpacedArmor,
|
||||
);
|
||||
const turretContainer = useRef<Group>(null);
|
||||
const gunContainer = useRef<Group>(null);
|
||||
const initialTankopediaState = useTankopedia.getState();
|
||||
@@ -164,12 +161,7 @@ export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshExternalModuleMask
|
||||
@@ -185,7 +177,7 @@ export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
|
||||
const isTrack = node.name.startsWith('chassis_track_');
|
||||
const isVisible = isWheel || isTrack;
|
||||
|
||||
if (!isVisible || !showSpacedArmor) return null;
|
||||
if (!isVisible) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshExternalModuleMask
|
||||
@@ -209,12 +201,7 @@ export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshExternalModuleMask
|
||||
@@ -237,12 +224,7 @@ export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshExternalModuleMask
|
||||
@@ -260,7 +242,7 @@ export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
|
||||
`gun_${gunModelDefinition.model.toString().padStart(2, '0')}`;
|
||||
const isVisible = isCurrentGun;
|
||||
|
||||
if (!isVisible || !showSpacedArmor) return null;
|
||||
if (!isVisible) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshExternalModuleMask
|
||||
|
||||
+5
-23
@@ -38,9 +38,6 @@ interface SpacedArmorDepthProps {
|
||||
export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
||||
const wrapper = useRef<Group>(null);
|
||||
const awaitedModelDefinitions = useModelDefinitions();
|
||||
const showSpacedArmor = useTankopedia(
|
||||
(state) => state.model.visual.showSpacedArmor,
|
||||
);
|
||||
const turretContainer = useRef<Group>(null);
|
||||
const gunContainer = useRef<Group>(null);
|
||||
const initialTankopediaState = useTankopedia.getState();
|
||||
@@ -177,12 +174,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshSpacedArmorDepth
|
||||
@@ -200,7 +192,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
||||
const isTrack = node.name.startsWith('chassis_track_');
|
||||
const isVisible = isWheel || isTrack;
|
||||
|
||||
if (!isVisible || !showSpacedArmor) return null;
|
||||
if (!isVisible) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshSpacedArmorDepth
|
||||
@@ -222,12 +214,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshSpacedArmorDepth
|
||||
@@ -252,12 +239,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
||||
armorId,
|
||||
);
|
||||
|
||||
if (
|
||||
!isVisible ||
|
||||
thickness === undefined ||
|
||||
(spaced && !showSpacedArmor)
|
||||
)
|
||||
return null;
|
||||
if (!isVisible || thickness === undefined) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshSpacedArmorDepth
|
||||
@@ -277,7 +259,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
|
||||
`gun_${gunModelDefinition.model.toString().padStart(2, '0')}`;
|
||||
const isVisible = isCurrentGun;
|
||||
|
||||
if (!isVisible || !showSpacedArmor) return null;
|
||||
if (!isVisible) return null;
|
||||
|
||||
return (
|
||||
<ArmorMeshSpacedArmorDepth
|
||||
|
||||
@@ -14,7 +14,6 @@ import vertexShader from './shaders/vertex.glsl';
|
||||
|
||||
interface ArmorMeshProps extends MeshProps {
|
||||
duel: Duel;
|
||||
isSpaced: boolean;
|
||||
isExternalModule?: boolean;
|
||||
thickness: number;
|
||||
maxExternalModuleThickness: number;
|
||||
@@ -22,7 +21,6 @@ interface ArmorMeshProps extends MeshProps {
|
||||
}
|
||||
|
||||
export function ArmorMesh({
|
||||
isSpaced,
|
||||
isExternalModule = false,
|
||||
thickness,
|
||||
maxExternalModuleThickness,
|
||||
@@ -54,11 +52,9 @@ export function ArmorMesh({
|
||||
|
||||
return (
|
||||
<>
|
||||
{!isSpaced && (
|
||||
<mesh {...props} renderOrder={0}>
|
||||
<meshBasicMaterial colorWrite={false} />
|
||||
</mesh>
|
||||
)}
|
||||
<mesh {...props} renderOrder={0}>
|
||||
<meshBasicMaterial colorWrite={false} />
|
||||
</mesh>
|
||||
|
||||
<mesh {...props} renderOrder={1}>
|
||||
<ThreeCustomShaderMaterial
|
||||
@@ -79,7 +75,6 @@ export function ArmorMesh({
|
||||
zFar: { value: camera.far },
|
||||
maxExternalModuleThickness: { value: maxExternalModuleThickness },
|
||||
maxSpacedArmorThickness: { value: maxSpacedArmorThickness },
|
||||
isSpaced: { value: isSpaced },
|
||||
isExplosive: { value: isExplosive(shell.type) },
|
||||
canSplash: { value: canSplash(shell.type) },
|
||||
isExternalModule: { value: isExternalModule },
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
varying vec3 vCSMViewPosition;
|
||||
uniform bool isExplosive;
|
||||
uniform bool canSplash;
|
||||
uniform bool isSpaced;
|
||||
uniform bool isExternalModule;
|
||||
uniform float thickness;
|
||||
uniform float penetration;
|
||||
@@ -102,9 +101,5 @@ void main() {
|
||||
}
|
||||
}
|
||||
|
||||
if (isSpaced) {
|
||||
csm_FragColor = vec4(1.0, 0.0, 1.0, (1.0 - penetrationChance) * 0.5);
|
||||
} else {
|
||||
csm_FragColor = vec4(1.0, splashChance * 0.392, 0.0, (1.0 - penetrationChance) * 0.5);
|
||||
}
|
||||
csm_FragColor = vec4(1.0, splashChance * 0.392, 0.0, (1.0 - penetrationChance) * 0.5);
|
||||
}
|
||||
@@ -40,7 +40,6 @@ interface Tankopedia {
|
||||
visual: {
|
||||
controlsEnabled: boolean;
|
||||
showGrid: boolean;
|
||||
showSpacedArmor: boolean;
|
||||
};
|
||||
};
|
||||
mode: TankopediaMode;
|
||||
@@ -67,7 +66,6 @@ export const useTankopedia = create<Tankopedia>()(
|
||||
visual: {
|
||||
controlsEnabled: true,
|
||||
showGrid: true,
|
||||
showSpacedArmor: true,
|
||||
},
|
||||
},
|
||||
areTanksAssigned: false,
|
||||
|
||||
Reference in new issue
Block a user