quake2ts 0.0.234 → 0.0.236
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 +33 -5
- 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/browser/index.global.js +2 -2
- package/packages/game/dist/browser/index.global.js.map +1 -1
- package/packages/game/dist/cjs/index.cjs +18 -2
- package/packages/game/dist/cjs/index.cjs.map +1 -1
- package/packages/game/dist/esm/index.js +18 -2
- package/packages/game/dist/esm/index.js.map +1 -1
- package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/game/dist/types/combat/weapons/firing.d.ts.map +1 -1
- package/packages/game/dist/types/combat/weapons/state.d.ts +1 -0
- package/packages/game/dist/types/combat/weapons/state.d.ts.map +1 -1
- package/packages/game/dist/types/entities/playerStats.d.ts.map +1 -1
- package/packages/game/dist/types/entities/projectiles.d.ts +1 -1
- package/packages/game/dist/types/entities/projectiles.d.ts.map +1 -1
- package/packages/game/dist/types/inventory/items.d.ts.map +1 -1
- package/packages/shared/dist/browser/index.global.js +1 -1
- package/packages/shared/dist/browser/index.global.js.map +1 -1
- package/packages/shared/dist/cjs/index.cjs +1 -0
- package/packages/shared/dist/cjs/index.cjs.map +1 -1
- package/packages/shared/dist/esm/index.js +1 -0
- package/packages/shared/dist/esm/index.js.map +1 -1
- package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
- package/packages/shared/dist/types/items/weapons.d.ts +1 -0
- package/packages/shared/dist/types/items/weapons.d.ts.map +1 -1
- package/packages/tools/dist/tsconfig.tsbuildinfo +1 -1
|
@@ -2362,11 +2362,13 @@ const int MAX_DLIGHTS = ${MAX_DLIGHTS};
|
|
|
2362
2362
|
|
|
2363
2363
|
in vec2 v_texCoord;
|
|
2364
2364
|
in vec2 v_lightmapCoord;
|
|
2365
|
+
in float v_lightmapStep;
|
|
2365
2366
|
in vec3 v_position;
|
|
2366
2367
|
|
|
2367
2368
|
uniform sampler2D u_diffuseMap;
|
|
2368
2369
|
uniform sampler2D u_lightmapAtlas;
|
|
2369
2370
|
uniform vec4 u_lightStyleFactors;
|
|
2371
|
+
uniform vec4 u_styleLayerMapping; // 0, 1, 2... or -1 if invalid
|
|
2370
2372
|
uniform float u_alpha;
|
|
2371
2373
|
uniform bool u_applyLightmap;
|
|
2372
2374
|
uniform bool u_warp;
|
|
@@ -2400,9 +2402,35 @@ void main() {
|
|
|
2400
2402
|
vec3 totalLight = vec3(1.0);
|
|
2401
2403
|
|
|
2402
2404
|
if (u_applyLightmap) {
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2405
|
+
// Multi-style lightmap accumulation
|
|
2406
|
+
vec3 light = vec3(0.0);
|
|
2407
|
+
bool hasLight = false;
|
|
2408
|
+
|
|
2409
|
+
vec2 lmBase = warpCoords(v_lightmapCoord);
|
|
2410
|
+
|
|
2411
|
+
// Loop unrolled-ish
|
|
2412
|
+
for (int i = 0; i < 4; i++) {
|
|
2413
|
+
// We can access vec4 components by index in newer GLSL ES, or use direct access
|
|
2414
|
+
float layer = u_styleLayerMapping[i];
|
|
2415
|
+
float factor = u_lightStyleFactors[i];
|
|
2416
|
+
|
|
2417
|
+
if (layer >= -0.5) { // Valid layer (check >= 0 approx)
|
|
2418
|
+
// Offset V by layer * step
|
|
2419
|
+
// Since we packed vertically
|
|
2420
|
+
vec2 offset = vec2(0.0, layer * v_lightmapStep);
|
|
2421
|
+
light += texture(u_lightmapAtlas, lmBase + offset).rgb * factor;
|
|
2422
|
+
hasLight = true;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
// If no valid lightmaps found (e.g. unlit surface?), default to full bright?
|
|
2427
|
+
// Or if u_applyLightmap is true, there should be at least one style.
|
|
2428
|
+
// Fallback to 1.0 if accumulator is empty?
|
|
2429
|
+
// In Q2, unlit surfs are fullbright (or use minlight).
|
|
2430
|
+
// If hasLight is false, it means no styles are active.
|
|
2431
|
+
if (!hasLight) light = vec3(1.0);
|
|
2432
|
+
|
|
2433
|
+
totalLight = light; // Dynamic lights add on top or multiply? Q2 adds.
|
|
2406
2434
|
|
|
2407
2435
|
// Add dynamic lights
|
|
2408
2436
|
for (int i = 0; i < MAX_DLIGHTS; i++) {
|