fix: use three js inverse view proj

This commit is contained in:
TrèsAbhi committed 2024-03-30 10:23:23 -05:00
1 parent f85b4b36bd
commit 2597fe4bcd
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "blitzkrieg", "name": "blitzkrieg",
"version": "1.18.0", "version": "1.18.1",
"description": "🎉 Tools for everything World of Tanks Blitz", "description": "🎉 Tools for everything World of Tanks Blitz",
"main": "src/server.ts", "main": "src/server.ts",
"type": "module", "type": "module",
@@ -15,13 +15,14 @@ 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 = inverse(vProjectionMatrix) * clipPosition; vec4 eyePosition = inverseViewProjectionMatrix * clipPosition;
return length(eyePosition.xyz / eyePosition.w); return length(eyePosition.xyz / eyePosition.w);
} }