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