@quake2ts/engine 0.0.841 → 0.0.842

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.
@@ -10737,7 +10737,7 @@ var SpriteRenderer2 = class {
10737
10737
  };
10738
10738
 
10739
10739
  // raw-loader:/home/runner/work/quake2/quake2/quake2ts/packages/engine/src/render/webgpu/shaders/skybox.wgsl
10740
- var skybox_default = "struct Uniforms {\n viewProjection: mat4x4<f32>,\n scroll: vec2<f32>,\n}\n\n@group(0) @binding(0) var<uniform> uniforms: Uniforms;\n@group(0) @binding(1) var t_skybox: texture_cube<f32>;\n@group(0) @binding(2) var s_skybox: sampler;\n\nstruct VertexOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) direction: vec3<f32>,\n}\n\n@vertex\nfn vertexMain(@location(0) position: vec3<f32>) -> VertexOutput {\n var output: VertexOutput;\n\n // Normalize input position (Quake Coordinates)\n var qDir = normalize(position);\n\n // Apply scrolling in Quake Coordinates (Horizontal Plane X/Y)\n // This ensures clouds scroll horizontally regardless of the final mapping.\n qDir.x += uniforms.scroll.x;\n qDir.y += uniforms.scroll.y;\n\n // Transform Quake coordinates (X-Fwd, Y-Left, Z-Up)\n // to WebGPU/GL cubemap coordinates (Right-handed? -Z Fwd, +X Right, +Y Up)\n // Quake X -> GL -Z\n // Quake Y -> GL -X\n // Quake Z -> GL Y\n var dir = vec3<f32>(-qDir.y, qDir.z, -qDir.x);\n\n output.direction = dir;\n\n output.position = uniforms.viewProjection * vec4<f32>(position, 1.0);\n return output;\n}\n\n@fragment\nfn fragmentMain(@location(0) direction: vec3<f32>) -> @location(0) vec4<f32> {\n return textureSample(t_skybox, s_skybox, direction);\n}\n";
10740
+ var skybox_default = "struct Uniforms {\n viewProjection: mat4x4<f32>,\n scroll: vec2<f32>,\n}\n\n@group(0) @binding(0) var<uniform> uniforms: Uniforms;\n@group(0) @binding(1) var t_skybox: texture_cube<f32>;\n@group(0) @binding(2) var s_skybox: sampler;\n\nstruct VertexOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) direction: vec3<f32>,\n}\n\n@vertex\nfn vertexMain(@location(0) position: vec3<f32>) -> VertexOutput {\n var output: VertexOutput;\n\n // Pass the RAW position (not normalized) as direction\n // This preserves the face-relative direction and avoids corner tie issues\n // The cubemap sampler handles normalization internally\n var dir = position;\n\n // Apply scrolling in Quake horizontal plane (X/Y)\n // Small scrolling offset that doesn't break dominant component detection\n dir.x += uniforms.scroll.x * 0.01;\n dir.y += uniforms.scroll.y * 0.01;\n\n output.direction = dir;\n output.position = uniforms.viewProjection * vec4<f32>(position, 1.0);\n return output;\n}\n\n@fragment\nfn fragmentMain(@location(0) direction: vec3<f32>) -> @location(0) vec4<f32> {\n // Transform from Quake coordinates to GL/WebGPU cubemap coordinates\n // Quake: +X forward, +Y left, +Z up\n // GL cubemap: +X right, +Y up, -Z forward\n var cubemapDir: vec3<f32>;\n cubemapDir.x = -direction.y; // Quake +Y (left) \u2192 GL -X (left)\n cubemapDir.y = direction.z; // Quake +Z (up) \u2192 GL +Y (up)\n cubemapDir.z = -direction.x; // Quake +X (forward) \u2192 GL -Z (forward)\n\n return textureSample(t_skybox, s_skybox, cubemapDir);\n}\n";
10741
10741
 
10742
10742
  // src/render/types/coordinates.ts
10743
10743
  var CoordinateSystem = /* @__PURE__ */ ((CoordinateSystem2) => {
@@ -10761,6 +10761,7 @@ var WebGPUMatrixBuilder = class {
10761
10761
  projection[10] = camera.far * rangeInv;
10762
10762
  projection[11] = -1;
10763
10763
  projection[14] = camera.near * camera.far * rangeInv;
10764
+ projection[15] = 0;
10764
10765
  return projection;
10765
10766
  }
10766
10767
  buildViewMatrix(camera) {
@@ -10832,7 +10833,7 @@ var WebGPUMatrixBuilder = class {
10832
10833
  }
10833
10834
  };
10834
10835
  var SKYBOX_POSITIONS2 = new Float32Array([
10835
- // Front face (+X) - looking forward
10836
+ // Front face (+X) - Quake forward direction
10836
10837
  1,
10837
10838
  -1,
10838
10839
  -1,
@@ -10851,7 +10852,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10851
10852
  1,
10852
10853
  -1,
10853
10854
  1,
10854
- // Back face (-X) - looking backward
10855
+ // Back face (-X) - Quake backward direction
10855
10856
  -1,
10856
10857
  1,
10857
10858
  -1,
@@ -10870,7 +10871,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10870
10871
  -1,
10871
10872
  1,
10872
10873
  1,
10873
- // Left face (+Y) - looking left
10874
+ // Left face (+Y) - Quake left direction
10874
10875
  -1,
10875
10876
  1,
10876
10877
  -1,
@@ -10889,7 +10890,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10889
10890
  1,
10890
10891
  1,
10891
10892
  -1,
10892
- // Right face (-Y) - looking right
10893
+ // Right face (-Y) - Quake right direction
10893
10894
  1,
10894
10895
  -1,
10895
10896
  -1,
@@ -10908,7 +10909,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10908
10909
  -1,
10909
10910
  -1,
10910
10911
  -1,
10911
- // Top face (+Z) - looking up
10912
+ // Top face (+Z) - Quake up direction
10912
10913
  -1,
10913
10914
  -1,
10914
10915
  1,
@@ -10927,7 +10928,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10927
10928
  -1,
10928
10929
  1,
10929
10930
  1,
10930
- // Bottom face (-Z) - looking down
10931
+ // Bottom face (-Z) - Quake down direction
10931
10932
  -1,
10932
10933
  1,
10933
10934
  -1,
@@ -11037,9 +11038,9 @@ var SkyboxPipeline3 = class {
11037
11038
  },
11038
11039
  depthStencil: {
11039
11040
  format: "depth24plus",
11040
- depthWriteEnabled: false,
11041
- depthCompare: "always"
11042
- // Skybox is usually drawn first or last. If first, always pass.
11041
+ depthWriteEnabled: true,
11042
+ depthCompare: "less-equal"
11043
+ // Proper depth testing ensures front faces occlude back faces
11043
11044
  },
11044
11045
  primitive: {
11045
11046
  topology: "triangle-list",