@quake2ts/engine 0.0.810 → 0.0.813

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5781,7 +5781,20 @@ uniform vec2 u_scroll;
5781
5781
  out vec3 v_direction;
5782
5782
 
5783
5783
  void main() {
5784
- vec3 dir = normalize(a_position);
5784
+ // Transform Quake-space position/direction to GL-space direction for cubemap sampling.
5785
+ // Quake Basis: X(Fwd), Y(Left), Z(Up)
5786
+ // GL Basis (Cubemap): -Z(Front), -X(Left), +Y(Top)
5787
+ // Mapping:
5788
+ // Quake X (1,0,0) -> GL -Z (0,0,-1)
5789
+ // Quake Y (0,1,0) -> GL -X (-1,0,0)
5790
+ // Quake Z (0,0,1) -> GL Y (0,1,0)
5791
+ vec3 dir = vec3(-a_position.y, a_position.z, -a_position.x);
5792
+
5793
+ // Normalize just in case, though a_position is on a cube surface.
5794
+ // Actually, for a cubemap lookup, normalization isn't strictly required by the hardware
5795
+ // (it grabs the vector direction), but good practice if we modify it.
5796
+ dir = normalize(dir);
5797
+
5785
5798
  dir.xy += u_scroll;
5786
5799
  v_direction = dir;
5787
5800
  gl_Position = u_viewProjectionNoTranslation * vec4(a_position, 1.0);