mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
fix: remove duplicate mantlets
This commit is contained in:
1 parent
e23a440508
commit
7372075ba3
12 files changed
+56
-5
No files matched your search
@@ -739,6 +739,17 @@ export async function definitions(production: boolean) {
|
||||
const gunArmor: ModelArmor = { thickness: {} };
|
||||
const shotDispersionFactors =
|
||||
gun.shotDispersionFactors ?? gunListEntry.shotDispersionFactors;
|
||||
const maskName = `gun_${gunModel.toString().padStart(2, '0')}`;
|
||||
const maskEnabled =
|
||||
tankParameters.maskSlice?.[maskName]?.enabled ?? false;
|
||||
let mask: number | undefined;
|
||||
|
||||
if (maskEnabled) {
|
||||
const maskRaw = tankParameters.maskSlice![maskName]!;
|
||||
mask = maskRaw.planePosition[1];
|
||||
} else {
|
||||
mask = undefined;
|
||||
}
|
||||
|
||||
totalUnlocks.push(gun.unlocks);
|
||||
Object.keys(gun.armor)
|
||||
@@ -788,6 +799,7 @@ export async function definitions(production: boolean) {
|
||||
modelDefinitions[tankId].turrets[turretId].guns[gunId] = {
|
||||
armor: gunArmor,
|
||||
model: gunModel,
|
||||
mask,
|
||||
thickness:
|
||||
gun.armor.gun === undefined
|
||||
? 0
|
||||
|
||||
@@ -26,6 +26,20 @@ export interface TankParameters {
|
||||
averageThickness?: Record<string, number>;
|
||||
};
|
||||
};
|
||||
maskSlice?: {
|
||||
[key: string]:
|
||||
| {
|
||||
enabled: boolean;
|
||||
planePosition: Vector3Tuple;
|
||||
planeNormal: Vector3Tuple;
|
||||
planeAxis: Vector3Tuple;
|
||||
frustumConeBaseRadius: number;
|
||||
frustumConeAngleDegrees: number;
|
||||
planeSliceMode: number;
|
||||
frustumConeSliceMode: number;
|
||||
}
|
||||
| undefined;
|
||||
};
|
||||
}
|
||||
|
||||
export async function tankIcons(production: boolean) {
|
||||
|
||||
@@ -199,6 +199,10 @@ export function TankSandbox() {
|
||||
{loadModel ? (
|
||||
<div style={{ width: '100%', height: '100%' }}>
|
||||
<Canvas
|
||||
gl={{
|
||||
clippingPlanes: Object.freeze([]),
|
||||
localClippingEnabled: true,
|
||||
}}
|
||||
shadows
|
||||
ref={canvas}
|
||||
onPointerDown={handlePointerDown}
|
||||
|
||||
Whitespace-only changes.
@@ -1,5 +1,5 @@
|
||||
import { memo, useEffect, useRef } from 'react';
|
||||
import { Euler, Group, Scene, Vector3 } from 'three';
|
||||
import { Euler, Group, Plane, Scene, Vector3 } from 'three';
|
||||
import { degToRad } from 'three/src/math/MathUtils';
|
||||
import { I_HAT, J_HAT, K_HAT } from '../../../constants/axis';
|
||||
import {
|
||||
@@ -146,6 +146,8 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
turretModelDefinition.gunOrigin[1],
|
||||
-turretModelDefinition.gunOrigin[2],
|
||||
).applyAxisAngle(I_HAT, Math.PI / 2);
|
||||
const maskOrigin =
|
||||
gunModelDefinition.mask! + hullOrigin.y + turretOrigin.y + gunOrigin.y;
|
||||
|
||||
return (
|
||||
<group
|
||||
@@ -270,6 +272,7 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
||||
thickness={gunModelDefinition.thickness}
|
||||
variant="gun"
|
||||
node={node}
|
||||
clip={new Plane(new Vector3(0, 0, -1), -maskOrigin)}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
+7
@@ -3,6 +3,7 @@ import {
|
||||
AdditiveBlending,
|
||||
MeshBasicMaterial,
|
||||
Object3D,
|
||||
Plane,
|
||||
ShaderMaterial,
|
||||
} from 'three';
|
||||
import { ArmorUserData, ExternalModuleVariant } from '../..';
|
||||
@@ -20,12 +21,14 @@ interface SpacedArmorSubExternalProps {
|
||||
node: Object3D;
|
||||
thickness: number;
|
||||
variant: ExternalModuleVariant;
|
||||
clip?: Plane;
|
||||
}
|
||||
|
||||
export function SpacedArmorSubExternal({
|
||||
node,
|
||||
thickness,
|
||||
variant,
|
||||
clip,
|
||||
}: SpacedArmorSubExternalProps) {
|
||||
const material = new ShaderMaterial({
|
||||
fragmentShader,
|
||||
@@ -34,6 +37,8 @@ export function SpacedArmorSubExternal({
|
||||
depthTest: true,
|
||||
depthWrite: false,
|
||||
blending: AdditiveBlending,
|
||||
clippingPlanes: clip ? [clip] : undefined,
|
||||
clipping: true,
|
||||
|
||||
uniforms: {
|
||||
thickness: { value: null },
|
||||
@@ -108,6 +113,7 @@ export function SpacedArmorSubExternal({
|
||||
colorWrite: false,
|
||||
depthTest: true,
|
||||
depthWrite: true,
|
||||
clippingPlanes: clip ? [clip] : undefined,
|
||||
}),
|
||||
onClick() {},
|
||||
userData: {
|
||||
@@ -116,6 +122,7 @@ export function SpacedArmorSubExternal({
|
||||
variant,
|
||||
} satisfies ArmorUserData,
|
||||
})}
|
||||
|
||||
{jsxTree(node, {
|
||||
renderOrder: 4,
|
||||
material,
|
||||
|
||||
+4
@@ -1,6 +1,10 @@
|
||||
uniform float thickness;
|
||||
uniform float penetration;
|
||||
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
void main() {
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
gl_FragColor = vec4(thickness / penetration, 0.0, 0.0, 1.0);
|
||||
}
|
||||
+5
-2
@@ -1,4 +1,7 @@
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
void main() {
|
||||
vec4 vViewPosition4 = modelViewMatrix * vec4(position, 1.0);
|
||||
gl_Position = projectionMatrix * vViewPosition4;
|
||||
#include <begin_vertex>
|
||||
#include <project_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
}
|
||||
+1
@@ -122,6 +122,7 @@ export function SpacedArmorSubSpaced({
|
||||
thickness,
|
||||
} satisfies ArmorUserData,
|
||||
})}
|
||||
|
||||
{jsxTree(node, {
|
||||
renderOrder: 5,
|
||||
material: depthWriteMaterial,
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
Intersection,
|
||||
MeshBasicMaterial,
|
||||
Object3D,
|
||||
Plane,
|
||||
Quaternion,
|
||||
Raycaster,
|
||||
Scene,
|
||||
@@ -29,6 +30,7 @@ type SpacedArmorSceneComponentProps = {
|
||||
node: Object3D;
|
||||
thickness: number;
|
||||
scene: Scene;
|
||||
clip?: Plane;
|
||||
} & (
|
||||
| {
|
||||
type: Exclude<ArmorType, ArmorType.External>;
|
||||
@@ -71,6 +73,7 @@ export function SpacedArmorSceneComponent({
|
||||
node,
|
||||
thickness,
|
||||
scene,
|
||||
clip,
|
||||
...props
|
||||
}: SpacedArmorSceneComponentProps) {
|
||||
const camera = useThree((state) => state.camera);
|
||||
@@ -333,6 +336,7 @@ export function SpacedArmorSceneComponent({
|
||||
node={node}
|
||||
thickness={thickness}
|
||||
variant={props.variant}
|
||||
clip={clip}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -47,6 +47,7 @@ interface GunModelDefinition {
|
||||
thickness: number;
|
||||
model: number;
|
||||
pitch: PitchLimits;
|
||||
mask?: number;
|
||||
}
|
||||
export interface PitchLimits {
|
||||
min: number;
|
||||
|
||||
@@ -17,5 +17,3 @@ export interface ProvisionDefinitions {
|
||||
export const provisionDefinitions = fetchCdonLz4<ProvisionDefinitions>(
|
||||
asset('definitions/provisions.cdon.lz4'),
|
||||
);
|
||||
|
||||
provisionDefinitions.then(console.log);
|
||||
Reference in new issue
Block a user