@adatechnology/game-test-room 0.25.0 → 0.25.1

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.
@@ -18551,7 +18551,44 @@ var GameTestRoom = (() => {
18551
18551
  renderer.compile(scene2, camera2);
18552
18552
  renderer.render(scene2, camera2);
18553
18553
  }
18554
+ function drawOnly(scene2, root) {
18555
+ const hidden = [];
18556
+ const visit = (object) => {
18557
+ if (object === root || !object.visible) return;
18558
+ const drawable = object;
18559
+ if (drawable.isMesh === true || drawable.isPoints === true || drawable.isLine === true || drawable.isSprite === true) {
18560
+ if (!holdsLight(object) && !holdsObject(object, root)) {
18561
+ object.visible = false;
18562
+ hidden.push(object);
18563
+ return;
18564
+ }
18565
+ }
18566
+ for (const child of object.children) visit(child);
18567
+ };
18568
+ for (const child of scene2.children) visit(child);
18569
+ return () => hidden.forEach((object) => object.visible = true);
18570
+ }
18571
+ function holdsLight(object) {
18572
+ let found = false;
18573
+ object.traverse((each) => {
18574
+ if (each.isLight === true) found = true;
18575
+ });
18576
+ return found;
18577
+ }
18578
+ function holdsObject(object, target) {
18579
+ for (let at3 = target; at3 !== null; at3 = at3.parent) if (at3 === object) return true;
18580
+ return false;
18581
+ }
18554
18582
  function playEffect(renderer, scene2, camera2, effect, target) {
18583
+ const root = effect.root?.();
18584
+ const restore = root === null || root === void 0 ? () => void 0 : drawOnly(scene2, root);
18585
+ try {
18586
+ playFrames(renderer, scene2, camera2, effect, target);
18587
+ } finally {
18588
+ restore();
18589
+ }
18590
+ }
18591
+ function playFrames(renderer, scene2, camera2, effect, target) {
18555
18592
  effect.play();
18556
18593
  try {
18557
18594
  for (let frame2 = 0; frame2 < (effect.frames ?? DEFAULT_EFFECT_FRAMES); frame2++) {
@@ -19058,7 +19095,7 @@ var GameTestRoom = (() => {
19058
19095
  return sources;
19059
19096
  }
19060
19097
 
19061
- // ../game-vfx-three/dist/chunk-ALDCQ5RH.js
19098
+ // ../game-vfx-three/dist/chunk-2MZDWTHX.js
19062
19099
  var GLOW_VERTEX = `attribute vec4 aP;attribute vec4 aC;varying vec2 vU;varying vec4 vC;
19063
19100
  void main(){vec3 R=vec3(viewMatrix[0][0],viewMatrix[1][0],viewMatrix[2][0]);vec3 Up=vec3(viewMatrix[0][1],viewMatrix[1][1],viewMatrix[2][1]);
19064
19101
  vec3 wp=aP.xyz+(R*position.x+Up*position.y)*aP.w;vU=position.xy;vC=aC;gl_Position=projectionMatrix*viewMatrix*vec4(wp,1.);}`;
@@ -20438,6 +20475,7 @@ void main(){vec2 d=gl_PointCoord-.5;float r=length(d)*2.;if(r>1.)discard;float a
20438
20475
  drawCalls = Number(lastDrawn.puffs > 0) + Number(lastDrawn.sparks > 0) + Number(lastDrawn.glows > 0) + Number(chunks.rocks.count > 0) + Number(chunks.plates.count > 0) + Number(sprites.additive.geometry.drawRange.count > 0) + Number(sprites.normal.geometry.drawRange.count > 0) + lastDrawn.shocks * 2 + marks.count() + workshopCalls;
20439
20476
  }
20440
20477
  return {
20478
+ root,
20441
20479
  world,
20442
20480
  play(request) {
20443
20481
  followCamera();
@@ -56295,6 +56333,8 @@ ${SURFACE_GLSL}`).replace("#include <color_fragment>", "#include <color_fragment
56295
56333
  let handle = null;
56296
56334
  return {
56297
56335
  id: `vfx:${id}`,
56336
+ // the room was drawn in every fog state just before: each frame of a blast draws the effects alone
56337
+ root: () => vfx.root,
56298
56338
  play() {
56299
56339
  handle = vfx.play({ effect: id, point: [0, 0.1, -4], direction: [0, 1, 0], normal: [0, 1, 0] });
56300
56340
  },