quake2ts 0.0.234 → 0.0.235
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/package.json +1 -1
- package/packages/client/dist/browser/index.global.js +31 -3
- package/packages/client/dist/browser/index.global.js.map +1 -1
- package/packages/client/dist/cjs/index.cjs +31 -3
- package/packages/client/dist/cjs/index.cjs.map +1 -1
- package/packages/client/dist/esm/index.js +31 -3
- package/packages/client/dist/esm/index.js.map +1 -1
- package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/browser/index.global.js +44 -13
- package/packages/engine/dist/browser/index.global.js.map +1 -1
- package/packages/engine/dist/cjs/index.cjs +39 -4
- package/packages/engine/dist/cjs/index.cjs.map +1 -1
- package/packages/engine/dist/esm/index.js +39 -4
- package/packages/engine/dist/esm/index.js.map +1 -1
- package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/engine/dist/types/render/bsp/geometry.d.ts +1 -0
- package/packages/engine/dist/types/render/bsp/geometry.d.ts.map +1 -1
- package/packages/engine/dist/types/render/bsp/renderer.d.ts.map +1 -1
- package/packages/engine/dist/types/render/bsp/surface.d.ts.map +1 -1
- package/packages/engine/dist/types/render/bspPipeline.d.ts +4 -2
- package/packages/engine/dist/types/render/bspPipeline.d.ts.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quake2ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.235",
|
|
4
4
|
"description": "Quake II re-release port to TypeScript with WebGL renderer - A complete game engine with physics, networking, and BSP rendering",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@8.15.7",
|
|
@@ -11,11 +11,13 @@ const int MAX_DLIGHTS = ${Yc};
|
|
|
11
11
|
|
|
12
12
|
in vec2 v_texCoord;
|
|
13
13
|
in vec2 v_lightmapCoord;
|
|
14
|
+
in float v_lightmapStep;
|
|
14
15
|
in vec3 v_position;
|
|
15
16
|
|
|
16
17
|
uniform sampler2D u_diffuseMap;
|
|
17
18
|
uniform sampler2D u_lightmapAtlas;
|
|
18
19
|
uniform vec4 u_lightStyleFactors;
|
|
20
|
+
uniform vec4 u_styleLayerMapping; // 0, 1, 2... or -1 if invalid
|
|
19
21
|
uniform float u_alpha;
|
|
20
22
|
uniform bool u_applyLightmap;
|
|
21
23
|
uniform bool u_warp;
|
|
@@ -49,9 +51,35 @@ void main() {
|
|
|
49
51
|
vec3 totalLight = vec3(1.0);
|
|
50
52
|
|
|
51
53
|
if (u_applyLightmap) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
// Multi-style lightmap accumulation
|
|
55
|
+
vec3 light = vec3(0.0);
|
|
56
|
+
bool hasLight = false;
|
|
57
|
+
|
|
58
|
+
vec2 lmBase = warpCoords(v_lightmapCoord);
|
|
59
|
+
|
|
60
|
+
// Loop unrolled-ish
|
|
61
|
+
for (int i = 0; i < 4; i++) {
|
|
62
|
+
// We can access vec4 components by index in newer GLSL ES, or use direct access
|
|
63
|
+
float layer = u_styleLayerMapping[i];
|
|
64
|
+
float factor = u_lightStyleFactors[i];
|
|
65
|
+
|
|
66
|
+
if (layer >= -0.5) { // Valid layer (check >= 0 approx)
|
|
67
|
+
// Offset V by layer * step
|
|
68
|
+
// Since we packed vertically
|
|
69
|
+
vec2 offset = vec2(0.0, layer * v_lightmapStep);
|
|
70
|
+
light += texture(u_lightmapAtlas, lmBase + offset).rgb * factor;
|
|
71
|
+
hasLight = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// If no valid lightmaps found (e.g. unlit surface?), default to full bright?
|
|
76
|
+
// Or if u_applyLightmap is true, there should be at least one style.
|
|
77
|
+
// Fallback to 1.0 if accumulator is empty?
|
|
78
|
+
// In Q2, unlit surfs are fullbright (or use minlight).
|
|
79
|
+
// If hasLight is false, it means no styles are active.
|
|
80
|
+
if (!hasLight) light = vec3(1.0);
|
|
81
|
+
|
|
82
|
+
totalLight = light; // Dynamic lights add on top or multiply? Q2 adds.
|
|
55
83
|
|
|
56
84
|
// Add dynamic lights
|
|
57
85
|
for (int i = 0; i < MAX_DLIGHTS; i++) {
|