mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
fix: use normal proj mat
This commit is contained in:
1 parent
1e5026ea4a
commit
dea7f34ca3
3 files changed
+6
-10
No files matched your search
@@ -57,7 +57,7 @@ export function CoreArmorSceneComponent({
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleShellChange(shell: ShellDefinition) {
|
async function handleShellChange(shell: ShellDefinition) {
|
||||||
material.uniforms.caliber.value = shell.caliber;
|
material.uniforms.caliber.value = shell.caliber;
|
||||||
material.uniforms.ricochet.value = degToRad(shell.ricochet ?? 90);
|
material.uniforms.ricochet.value = degToRad(shell.ricochet ?? 90);
|
||||||
material.uniforms.normalization.value = degToRad(
|
material.uniforms.normalization.value = degToRad(
|
||||||
@@ -68,10 +68,9 @@ export function CoreArmorSceneComponent({
|
|||||||
material.uniforms.damage.value = shell.damage.armor;
|
material.uniforms.damage.value = shell.damage.armor;
|
||||||
material.uniforms.explosionRadius.value = shell.explosionRadius;
|
material.uniforms.explosionRadius.value = shell.explosionRadius;
|
||||||
|
|
||||||
handleProtagonistEquipmentChange(
|
const duel = useDuel.getState();
|
||||||
useDuel.getState().protagonist!.equipment,
|
await handleProtagonistEquipmentChange(duel.protagonist!.equipment);
|
||||||
);
|
await handleAntagonistEquipmentChange(duel.antagonist!.equipment);
|
||||||
handleAntagonistEquipmentChange(useDuel.getState().antagonist!.equipment);
|
|
||||||
}
|
}
|
||||||
function handleVisualChange(
|
function handleVisualChange(
|
||||||
visual: TankopediaPersistent['model']['visual'],
|
visual: TankopediaPersistent['model']['visual'],
|
||||||
@@ -93,6 +92,7 @@ export function CoreArmorSceneComponent({
|
|||||||
const shell = useDuel.getState().antagonist!.shell;
|
const shell = useDuel.getState().antagonist!.shell;
|
||||||
const penetration = resolveNearPenetration(shell.penetration);
|
const penetration = resolveNearPenetration(shell.penetration);
|
||||||
const hasCalibratedShells = await hasEquipment(103, true, equipment);
|
const hasCalibratedShells = await hasEquipment(103, true, equipment);
|
||||||
|
|
||||||
material.uniforms.penetration.value = hasCalibratedShells
|
material.uniforms.penetration.value = hasCalibratedShells
|
||||||
? penetration * (isExplosive(shell.type) ? 1.1 : 1.05)
|
? penetration * (isExplosive(shell.type) ? 1.1 : 1.05)
|
||||||
: penetration;
|
: penetration;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
varying vec3 vNormal;
|
varying vec3 vNormal;
|
||||||
varying vec3 vViewPosition;
|
varying vec3 vViewPosition;
|
||||||
varying mat4 vProjectionMatrix;
|
|
||||||
|
|
||||||
uniform float thickness;
|
uniform float thickness;
|
||||||
uniform float penetration;
|
uniform float penetration;
|
||||||
@@ -15,14 +14,13 @@ uniform float explosionRadius;
|
|||||||
uniform bool greenPenetration;
|
uniform bool greenPenetration;
|
||||||
uniform bool opaque;
|
uniform bool opaque;
|
||||||
uniform bool useSpacedArmor;
|
uniform bool useSpacedArmor;
|
||||||
uniform mat4 inverseViewProjectionMatrix;
|
|
||||||
|
|
||||||
uniform highp sampler2D spacedArmorBuffer;
|
uniform highp sampler2D spacedArmorBuffer;
|
||||||
uniform highp sampler2D spacedArmorDepth;
|
uniform highp sampler2D spacedArmorDepth;
|
||||||
|
|
||||||
float depthToDistance(float depth) {
|
float depthToDistance(float depth) {
|
||||||
vec4 clipPosition = vec4(gl_FragCoord.xy / resolution * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
vec4 clipPosition = vec4(gl_FragCoord.xy / resolution * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
||||||
vec4 eyePosition = inverseViewProjectionMatrix * clipPosition;
|
vec4 eyePosition = viewMatrix * clipPosition;
|
||||||
return length(eyePosition.xyz / eyePosition.w);
|
return length(eyePosition.xyz / eyePosition.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
varying vec3 vNormal;
|
varying vec3 vNormal;
|
||||||
varying vec3 vViewPosition;
|
varying vec3 vViewPosition;
|
||||||
varying mat4 vProjectionMatrix;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 vViewPosition4 = modelViewMatrix * vec4(position, 1.0);
|
vec4 vViewPosition4 = modelViewMatrix * vec4(position, 1.0);
|
||||||
|
|
||||||
vViewPosition = vViewPosition4.xyz;
|
vViewPosition = vViewPosition4.xyz;
|
||||||
vProjectionMatrix = projectionMatrix;
|
|
||||||
vNormal = normalMatrix * normal;
|
vNormal = normalMatrix * normal;
|
||||||
|
|
||||||
gl_Position = projectionMatrix * vViewPosition4;
|
gl_Position = projectionMatrix * vViewPosition4;
|
||||||
|
|||||||
Reference in new issue
Block a user