mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
fix: unified max thicknesses
This commit is contained in:
1 parent
c56eaa258d
commit
8199bd550d
8 files changed
+26
-37
No files matched your search
@@ -17,15 +17,13 @@ interface ArmorMeshProps extends MeshProps {
|
||||
duel: Duel;
|
||||
isExternalModule?: boolean;
|
||||
thickness: number;
|
||||
maxExternalModuleThickness: number;
|
||||
maxSpacedArmorThickness: number;
|
||||
maxThickness: number;
|
||||
}
|
||||
|
||||
export function ArmorMesh({
|
||||
isExternalModule = false,
|
||||
thickness,
|
||||
maxExternalModuleThickness,
|
||||
maxSpacedArmorThickness,
|
||||
maxThickness,
|
||||
duel,
|
||||
...props
|
||||
}: ArmorMeshProps) {
|
||||
@@ -78,8 +76,7 @@ export function ArmorMesh({
|
||||
zNear: { value: camera.near },
|
||||
zFar: { value: camera.far },
|
||||
greenPenetration: { value: greenPenetration },
|
||||
maxExternalModuleThickness: { value: maxExternalModuleThickness },
|
||||
maxSpacedArmorThickness: { value: maxSpacedArmorThickness },
|
||||
maxThickness: { value: maxThickness },
|
||||
isExplosive: { value: isExplosive(shell.type) },
|
||||
canSplash: { value: canSplash(shell.type) },
|
||||
isExternalModule: { value: isExternalModule },
|
||||
|
||||
@@ -12,8 +12,7 @@ uniform sampler2D spacedArmorDepth;
|
||||
uniform sampler2D spacedArmorMask;
|
||||
uniform vec2 resolution;
|
||||
varying mat4 vProjectionMatrix;
|
||||
uniform float maxExternalModuleThickness;
|
||||
uniform float maxSpacedArmorThickness;
|
||||
uniform float maxThickness;
|
||||
uniform bool greenPenetration;
|
||||
|
||||
float depthToDistance(float depth) {
|
||||
@@ -46,7 +45,7 @@ void main() {
|
||||
float splashChance = -1.0;
|
||||
bool threeCalibersRule = caliber > 3.0 * thickness;
|
||||
float normalizedSpacedArmorThickness = spacedArmorMaskColor.g;
|
||||
float spacedArmorNominalThickness = normalizedSpacedArmorThickness * maxSpacedArmorThickness;
|
||||
float spacedArmorNominalThickness = normalizedSpacedArmorThickness * maxThickness;
|
||||
bool spadedArmorThreeCalibersRule = isUnderSpacedArmor && caliber > 3.0 * spacedArmorNominalThickness;
|
||||
bool ricochetSpacedArmor = isUnderSpacedArmor && !spadedArmorThreeCalibersRule && spacedArmorAngle >= ricochet;
|
||||
bool ricochetCoreArmor = !ricochetSpacedArmor && !isUnderExternalModule && !isExternalModule && !isExplosive && !threeCalibersRule && angle >= ricochet;
|
||||
@@ -59,7 +58,7 @@ void main() {
|
||||
|
||||
if (isUnderExternalModule) {
|
||||
float normalizedExternalModuleThickness = externalModuleMaskColor.g;
|
||||
float externalModuleThickness = normalizedExternalModuleThickness * maxExternalModuleThickness;
|
||||
float externalModuleThickness = normalizedExternalModuleThickness * maxThickness;
|
||||
piercedPenetration -= externalModuleThickness;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@ void main() {
|
||||
float dotProduct = dot(normalizedNormal, -normalizedViewPosition);
|
||||
float angle = acos(dotProduct);
|
||||
|
||||
csm_FragColor = vec4(angle / PI, thickness / maxThickness, 0.0, 1.0);
|
||||
csm_FragColor = vec4(angle / (PI / 2.0), thickness / maxThickness, 0.0, 1.0);
|
||||
}
|
||||
Reference in new issue
Block a user