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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/packages/client/dist/browser/index.global.js +33 -5
  3. package/packages/client/dist/browser/index.global.js.map +1 -1
  4. package/packages/client/dist/cjs/index.cjs +31 -3
  5. package/packages/client/dist/cjs/index.cjs.map +1 -1
  6. package/packages/client/dist/esm/index.js +31 -3
  7. package/packages/client/dist/esm/index.js.map +1 -1
  8. package/packages/client/dist/tsconfig.tsbuildinfo +1 -1
  9. package/packages/engine/dist/browser/index.global.js +44 -13
  10. package/packages/engine/dist/browser/index.global.js.map +1 -1
  11. package/packages/engine/dist/cjs/index.cjs +39 -4
  12. package/packages/engine/dist/cjs/index.cjs.map +1 -1
  13. package/packages/engine/dist/esm/index.js +39 -4
  14. package/packages/engine/dist/esm/index.js.map +1 -1
  15. package/packages/engine/dist/tsconfig.tsbuildinfo +1 -1
  16. package/packages/engine/dist/types/render/bsp/geometry.d.ts +1 -0
  17. package/packages/engine/dist/types/render/bsp/geometry.d.ts.map +1 -1
  18. package/packages/engine/dist/types/render/bsp/renderer.d.ts.map +1 -1
  19. package/packages/engine/dist/types/render/bsp/surface.d.ts.map +1 -1
  20. package/packages/engine/dist/types/render/bspPipeline.d.ts +4 -2
  21. package/packages/engine/dist/types/render/bspPipeline.d.ts.map +1 -1
  22. package/packages/game/dist/browser/index.global.js +2 -2
  23. package/packages/game/dist/browser/index.global.js.map +1 -1
  24. package/packages/game/dist/cjs/index.cjs +18 -2
  25. package/packages/game/dist/cjs/index.cjs.map +1 -1
  26. package/packages/game/dist/esm/index.js +18 -2
  27. package/packages/game/dist/esm/index.js.map +1 -1
  28. package/packages/game/dist/tsconfig.tsbuildinfo +1 -1
  29. package/packages/game/dist/types/combat/weapons/firing.d.ts.map +1 -1
  30. package/packages/game/dist/types/combat/weapons/state.d.ts +1 -0
  31. package/packages/game/dist/types/combat/weapons/state.d.ts.map +1 -1
  32. package/packages/game/dist/types/entities/playerStats.d.ts.map +1 -1
  33. package/packages/game/dist/types/entities/projectiles.d.ts +1 -1
  34. package/packages/game/dist/types/entities/projectiles.d.ts.map +1 -1
  35. package/packages/game/dist/types/inventory/items.d.ts.map +1 -1
  36. package/packages/shared/dist/browser/index.global.js +1 -1
  37. package/packages/shared/dist/browser/index.global.js.map +1 -1
  38. package/packages/shared/dist/cjs/index.cjs +1 -0
  39. package/packages/shared/dist/cjs/index.cjs.map +1 -1
  40. package/packages/shared/dist/esm/index.js +1 -0
  41. package/packages/shared/dist/esm/index.js.map +1 -1
  42. package/packages/shared/dist/tsconfig.tsbuildinfo +1 -1
  43. package/packages/shared/dist/types/items/weapons.d.ts +1 -0
  44. package/packages/shared/dist/types/items/weapons.d.ts.map +1 -1
  45. 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
- vec3 light = texture(u_lightmapAtlas, warpCoords(v_lightmapCoord)).rgb;
2404
- float styleScale = dot(u_lightStyleFactors, vec4(1.0));
2405
- totalLight = light * styleScale;
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++) {