@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.
package/dist/esm/index.js CHANGED
@@ -5780,7 +5780,20 @@ uniform vec2 u_scroll;
5780
5780
  out vec3 v_direction;
5781
5781
 
5782
5782
  void main() {
5783
- vec3 dir = normalize(a_position);
5783
+ // Transform Quake-space position/direction to GL-space direction for cubemap sampling.
5784
+ // Quake Basis: X(Fwd), Y(Left), Z(Up)
5785
+ // GL Basis (Cubemap): -Z(Front), -X(Left), +Y(Top)
5786
+ // Mapping:
5787
+ // Quake X (1,0,0) -> GL -Z (0,0,-1)
5788
+ // Quake Y (0,1,0) -> GL -X (-1,0,0)
5789
+ // Quake Z (0,0,1) -> GL Y (0,1,0)
5790
+ vec3 dir = vec3(-a_position.y, a_position.z, -a_position.x);
5791
+
5792
+ // Normalize just in case, though a_position is on a cube surface.
5793
+ // Actually, for a cubemap lookup, normalization isn't strictly required by the hardware
5794
+ // (it grabs the vector direction), but good practice if we modify it.
5795
+ dir = normalize(dir);
5796
+
5784
5797
  dir.xy += u_scroll;
5785
5798
  v_direction = dir;
5786
5799
  gl_Position = u_viewProjectionNoTranslation * vec4(a_position, 1.0);