@quake2ts/engine 0.0.855 → 0.0.857
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/browser/index.global.js +37 -32
- package/dist/browser/index.global.js.map +1 -1
- package/dist/cjs/index.cjs +21 -13
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +21 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/render/skybox.d.ts +1 -1
- package/dist/types/render/skybox.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -5812,23 +5812,28 @@ uniform vec2 u_scroll;
|
|
|
5812
5812
|
out vec3 v_direction;
|
|
5813
5813
|
|
|
5814
5814
|
void main() {
|
|
5815
|
-
//
|
|
5816
|
-
// Quake
|
|
5817
|
-
// GL
|
|
5818
|
-
//
|
|
5819
|
-
// Quake
|
|
5820
|
-
//
|
|
5821
|
-
//
|
|
5822
|
-
|
|
5815
|
+
// The cube vertices (a_position) are in GL space (-1 to 1, standard OpenGL cube).
|
|
5816
|
+
// The viewProjection matrix expects Quake-space input (it contains Quake-to-GL transform).
|
|
5817
|
+
// So we must transform GL -> Quake before applying the view matrix.
|
|
5818
|
+
//
|
|
5819
|
+
// GL-to-Quake mapping (inverse of Quake-to-GL):
|
|
5820
|
+
// GL -Z -> Quake +X (forward)
|
|
5821
|
+
// GL -X -> Quake +Y (left)
|
|
5822
|
+
// GL +Y -> Quake +Z (up)
|
|
5823
|
+
// So: (gl.x, gl.y, gl.z) -> (-gl.z, -gl.x, gl.y)
|
|
5824
|
+
vec3 quakePos = vec3(-a_position.z, -a_position.x, a_position.y);
|
|
5825
|
+
vec4 pos = u_viewProjectionNoTranslation * vec4(quakePos, 1.0);
|
|
5826
|
+
// Force z = w to render at far plane, avoiding clipping issues
|
|
5827
|
+
// for triangles that intersect the camera plane
|
|
5828
|
+
gl_Position = pos.xyww;
|
|
5823
5829
|
|
|
5824
|
-
//
|
|
5825
|
-
//
|
|
5826
|
-
|
|
5827
|
-
dir = normalize(dir);
|
|
5830
|
+
// For cubemap sampling, use the original GL-space position since
|
|
5831
|
+
// WebGL cubemap targets (POSITIVE_X, etc.) are in GL conventions.
|
|
5832
|
+
vec3 dir = a_position;
|
|
5828
5833
|
|
|
5834
|
+
// Apply scroll offset for animated skies
|
|
5829
5835
|
dir.xy += u_scroll;
|
|
5830
5836
|
v_direction = dir;
|
|
5831
|
-
gl_Position = u_viewProjectionNoTranslation * vec4(a_position, 1.0);
|
|
5832
5837
|
}`;
|
|
5833
5838
|
var SKYBOX_FRAGMENT_SHADER = `#version 300 es
|
|
5834
5839
|
precision highp float;
|
|
@@ -5871,7 +5876,10 @@ var SkyboxPipeline = class {
|
|
|
5871
5876
|
bind(options) {
|
|
5872
5877
|
const { viewProjection, scroll, textureUnit = 0 } = options;
|
|
5873
5878
|
this.program.use();
|
|
5879
|
+
this.gl.enable(this.gl.DEPTH_TEST);
|
|
5880
|
+
this.gl.depthFunc(this.gl.LEQUAL);
|
|
5874
5881
|
this.gl.depthMask(false);
|
|
5882
|
+
this.gl.disable(this.gl.CULL_FACE);
|
|
5875
5883
|
this.gl.uniformMatrix4fv(this.uniformViewProj, false, viewProjection);
|
|
5876
5884
|
this.gl.uniform2f(this.uniformScroll, scroll[0], scroll[1]);
|
|
5877
5885
|
this.gl.uniform1i(this.uniformSampler, textureUnit);
|