@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.
package/dist/esm/index.js CHANGED
@@ -10736,7 +10736,7 @@ var SpriteRenderer2 = class {
10736
10736
  };
10737
10737
 
10738
10738
  // raw-loader:/home/runner/work/quake2/quake2/quake2ts/packages/engine/src/render/webgpu/shaders/skybox.wgsl
10739
- 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";
10739
+ 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";
10740
10740
 
10741
10741
  // src/render/types/coordinates.ts
10742
10742
  var CoordinateSystem = /* @__PURE__ */ ((CoordinateSystem2) => {
@@ -10760,6 +10760,7 @@ var WebGPUMatrixBuilder = class {
10760
10760
  projection[10] = camera.far * rangeInv;
10761
10761
  projection[11] = -1;
10762
10762
  projection[14] = camera.near * camera.far * rangeInv;
10763
+ projection[15] = 0;
10763
10764
  return projection;
10764
10765
  }
10765
10766
  buildViewMatrix(camera) {
@@ -10831,7 +10832,7 @@ var WebGPUMatrixBuilder = class {
10831
10832
  }
10832
10833
  };
10833
10834
  var SKYBOX_POSITIONS2 = new Float32Array([
10834
- // Front face (+X) - looking forward
10835
+ // Front face (+X) - Quake forward direction
10835
10836
  1,
10836
10837
  -1,
10837
10838
  -1,
@@ -10850,7 +10851,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10850
10851
  1,
10851
10852
  -1,
10852
10853
  1,
10853
- // Back face (-X) - looking backward
10854
+ // Back face (-X) - Quake backward direction
10854
10855
  -1,
10855
10856
  1,
10856
10857
  -1,
@@ -10869,7 +10870,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10869
10870
  -1,
10870
10871
  1,
10871
10872
  1,
10872
- // Left face (+Y) - looking left
10873
+ // Left face (+Y) - Quake left direction
10873
10874
  -1,
10874
10875
  1,
10875
10876
  -1,
@@ -10888,7 +10889,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10888
10889
  1,
10889
10890
  1,
10890
10891
  -1,
10891
- // Right face (-Y) - looking right
10892
+ // Right face (-Y) - Quake right direction
10892
10893
  1,
10893
10894
  -1,
10894
10895
  -1,
@@ -10907,7 +10908,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10907
10908
  -1,
10908
10909
  -1,
10909
10910
  -1,
10910
- // Top face (+Z) - looking up
10911
+ // Top face (+Z) - Quake up direction
10911
10912
  -1,
10912
10913
  -1,
10913
10914
  1,
@@ -10926,7 +10927,7 @@ var SKYBOX_POSITIONS2 = new Float32Array([
10926
10927
  -1,
10927
10928
  1,
10928
10929
  1,
10929
- // Bottom face (-Z) - looking down
10930
+ // Bottom face (-Z) - Quake down direction
10930
10931
  -1,
10931
10932
  1,
10932
10933
  -1,
@@ -11036,9 +11037,9 @@ var SkyboxPipeline3 = class {
11036
11037
  },
11037
11038
  depthStencil: {
11038
11039
  format: "depth24plus",
11039
- depthWriteEnabled: false,
11040
- depthCompare: "always"
11041
- // Skybox is usually drawn first or last. If first, always pass.
11040
+ depthWriteEnabled: true,
11041
+ depthCompare: "less-equal"
11042
+ // Proper depth testing ensures front faces occlude back faces
11042
11043
  },
11043
11044
  primitive: {
11044
11045
  topology: "triangle-list",