mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: he start
This commit is contained in:
1 parent
9ed2b79a4b
commit
9dc4483d70
5 files changed
+28
-4
No files matched your search
@@ -6,6 +6,7 @@ import { ArmorMesh } from '../../../../../../../components/ArmorMesh';
|
|||||||
import { HeadsUpDisplay } from '../../../../../../../components/HeadsUpDisplay';
|
import { HeadsUpDisplay } from '../../../../../../../components/HeadsUpDisplay';
|
||||||
import { X_AXIS } from '../../../../../../../constants/axis';
|
import { X_AXIS } from '../../../../../../../constants/axis';
|
||||||
import { canRicochet } from '../../../../../../../core/blitz/canRicochet';
|
import { canRicochet } from '../../../../../../../core/blitz/canRicochet';
|
||||||
|
import { canSplash } from '../../../../../../../core/blitz/canSplash';
|
||||||
import { numericPenetration } from '../../../../../../../core/blitz/numericPenetration';
|
import { numericPenetration } from '../../../../../../../core/blitz/numericPenetration';
|
||||||
import { asset } from '../../../../../../../core/blitzkrieg/asset';
|
import { asset } from '../../../../../../../core/blitzkrieg/asset';
|
||||||
import {
|
import {
|
||||||
@@ -69,6 +70,7 @@ export function TankArmor({ ...props }: TankArmorProps) {
|
|||||||
.applyAxisAngle(new Vector3(0, 0, 1), model.turretYaw);
|
.applyAxisAngle(new Vector3(0, 0, 1), model.turretYaw);
|
||||||
const turretRotation = new Euler(0, 0, model.turretYaw);
|
const turretRotation = new Euler(0, 0, model.turretYaw);
|
||||||
const ricochetCapable = canRicochet(antagonist.shell.type);
|
const ricochetCapable = canRicochet(antagonist.shell.type);
|
||||||
|
const splashCapable = canSplash(antagonist.shell.type);
|
||||||
|
|
||||||
if (tankModelDefinition.turretRotation) {
|
if (tankModelDefinition.turretRotation) {
|
||||||
const pitch = -tankModelDefinition.turretRotation.pitch * (Math.PI / 180);
|
const pitch = -tankModelDefinition.turretRotation.pitch * (Math.PI / 180);
|
||||||
@@ -111,6 +113,7 @@ export function TankArmor({ ...props }: TankArmorProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ArmorMesh
|
<ArmorMesh
|
||||||
|
canSplash={splashCapable}
|
||||||
spaced={isSpaced}
|
spaced={isSpaced}
|
||||||
key={node.uuid}
|
key={node.uuid}
|
||||||
geometry={(node as Mesh).geometry}
|
geometry={(node as Mesh).geometry}
|
||||||
@@ -154,6 +157,7 @@ export function TankArmor({ ...props }: TankArmorProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ArmorMesh
|
<ArmorMesh
|
||||||
|
canSplash={splashCapable}
|
||||||
spaced={isSpaced}
|
spaced={isSpaced}
|
||||||
key={node.uuid}
|
key={node.uuid}
|
||||||
position={turretOrigin}
|
position={turretOrigin}
|
||||||
@@ -203,6 +207,7 @@ export function TankArmor({ ...props }: TankArmorProps) {
|
|||||||
return null;
|
return null;
|
||||||
return (
|
return (
|
||||||
<ArmorMesh
|
<ArmorMesh
|
||||||
|
canSplash={splashCapable}
|
||||||
spaced={isSpaced}
|
spaced={isSpaced}
|
||||||
key={node.uuid}
|
key={node.uuid}
|
||||||
position={turretOrigin.clone().add(gunOrigin)}
|
position={turretOrigin.clone().add(gunOrigin)}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ interface ArmorMeshProps extends MeshProps {
|
|||||||
caliber: number;
|
caliber: number;
|
||||||
spaced?: boolean;
|
spaced?: boolean;
|
||||||
canRicochet: boolean;
|
canRicochet: boolean;
|
||||||
|
canSplash: boolean;
|
||||||
ricochet?: number;
|
ricochet?: number;
|
||||||
normalization?: number;
|
normalization?: number;
|
||||||
}
|
}
|
||||||
@@ -24,6 +25,7 @@ export function ArmorMesh({
|
|||||||
caliber,
|
caliber,
|
||||||
canRicochet,
|
canRicochet,
|
||||||
ricochet,
|
ricochet,
|
||||||
|
canSplash,
|
||||||
normalization,
|
normalization,
|
||||||
spaced = false,
|
spaced = false,
|
||||||
...props
|
...props
|
||||||
@@ -59,6 +61,7 @@ export function ArmorMesh({
|
|||||||
caliber: { value: caliber },
|
caliber: { value: caliber },
|
||||||
spaced: { value: spaced ?? false },
|
spaced: { value: spaced ?? false },
|
||||||
canRicochet: { value: canRicochet },
|
canRicochet: { value: canRicochet },
|
||||||
|
canSplash: { value: canSplash },
|
||||||
}}
|
}}
|
||||||
vertexShader={vertex}
|
vertexShader={vertex}
|
||||||
fragmentShader={opaqueArmor && !spaced ? fragmentOpaque : fragment}
|
fragmentShader={opaqueArmor && !spaced ? fragmentOpaque : fragment}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ uniform float caliber;
|
|||||||
uniform float normalization;
|
uniform float normalization;
|
||||||
uniform bool spaced;
|
uniform bool spaced;
|
||||||
uniform bool canRichochet;
|
uniform bool canRichochet;
|
||||||
|
uniform bool canSplash;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec3 normalizedNormal = normalize(vNormal);
|
vec3 normalizedNormal = normalize(vNormal);
|
||||||
@@ -42,9 +43,18 @@ void main() {
|
|||||||
|
|
||||||
float alpha = (1.0 - penetrationChance) * 0.5;
|
float alpha = (1.0 - penetrationChance) * 0.5;
|
||||||
|
|
||||||
if (spaced) {
|
if (canSplash) {
|
||||||
csm_FragColor = vec4(0.0, 0.0, 1.0, alpha);
|
if (spaced) {
|
||||||
|
csm_FragColor = vec4(1.0, 0.0, 0.0, alpha);
|
||||||
|
} else {
|
||||||
|
// color taken directly from the game
|
||||||
|
csm_FragColor = vec4(1.0, 0.392, 0.0, alpha);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
csm_FragColor = vec4(1.0, 0.0, 0.0, alpha);
|
if (spaced) {
|
||||||
|
csm_FragColor = vec4(0.0, 0.0, 1.0, alpha);
|
||||||
|
} else {
|
||||||
|
csm_FragColor = vec4(1.0, 0.0, 0.0, alpha);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ uniform float penetration;
|
|||||||
uniform float ricochet;
|
uniform float ricochet;
|
||||||
uniform float caliber;
|
uniform float caliber;
|
||||||
uniform float normalization;
|
uniform float normalization;
|
||||||
|
uniform bool canRichochet;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec3 normalizedNormal = normalize(vNormal);
|
vec3 normalizedNormal = normalize(vNormal);
|
||||||
@@ -16,7 +17,7 @@ void main() {
|
|||||||
float penetrationChance = -1.0;
|
float penetrationChance = -1.0;
|
||||||
bool threeCaliberRule = caliber > 3.0 * thickness;
|
bool threeCaliberRule = caliber > 3.0 * thickness;
|
||||||
|
|
||||||
if (!threeCaliberRule && angle >= ricochet) {
|
if (canRichochet && !threeCaliberRule && angle >= ricochet) {
|
||||||
// auto ricochet angle and three caliber rule not met
|
// auto ricochet angle and three caliber rule not met
|
||||||
penetrationChance = 0.0;
|
penetrationChance = 0.0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { ShellDefinition } from '../blitzkrieg/tankDefinitions';
|
||||||
|
|
||||||
|
export function canSplash(type: ShellDefinition['type']): type is 'he' {
|
||||||
|
return type === 'he';
|
||||||
|
}
|
||||||
Reference in new issue
Block a user