@quake2ts/engine 0.0.811 → 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.
@@ -350,7 +350,20 @@ uniform vec2 u_scroll;
350
350
  out vec3 v_direction;
351
351
 
352
352
  void main() {
353
- vec3 dir = normalize(a_position);
353
+ // Transform Quake-space position/direction to GL-space direction for cubemap sampling.
354
+ // Quake Basis: X(Fwd), Y(Left), Z(Up)
355
+ // GL Basis (Cubemap): -Z(Front), -X(Left), +Y(Top)
356
+ // Mapping:
357
+ // Quake X (1,0,0) -> GL -Z (0,0,-1)
358
+ // Quake Y (0,1,0) -> GL -X (-1,0,0)
359
+ // Quake Z (0,0,1) -> GL Y (0,1,0)
360
+ vec3 dir = vec3(-a_position.y, a_position.z, -a_position.x);
361
+
362
+ // Normalize just in case, though a_position is on a cube surface.
363
+ // Actually, for a cubemap lookup, normalization isn't strictly required by the hardware
364
+ // (it grabs the vector direction), but good practice if we modify it.
365
+ dir = normalize(dir);
366
+
354
367
  dir.xy += u_scroll;
355
368
  v_direction = dir;
356
369
  gl_Position = u_viewProjectionNoTranslation * vec4(a_position, 1.0);