@woosh/meep-engine 2.85.1 → 2.85.3

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/build/meep.cjs CHANGED
@@ -89213,22 +89213,24 @@ function configureThreeRenderer(webGLRenderer) {
89213
89213
  //turn off automatic info reset, we use multi-pass rendering, so we manually reset the render info
89214
89214
  webGLRenderer.info.autoReset = false;
89215
89215
 
89216
- if (ENV_PRODUCTION) {
89217
- //disable shader error checking in production build
89218
- webGLRenderer.debug.checkShaderErrors = false;
89219
- } else {
89220
- webGLRenderer.debug.checkShaderErrors = true;
89221
- }
89222
89216
  }
89223
89217
 
89224
89218
 
89225
89219
  class GraphicsEngine {
89220
+ #debug = false;
89221
+
89226
89222
  /**
89227
89223
  *
89228
89224
  * @param {Camera} camera
89225
+ * @param {boolean} [debug]
89229
89226
  * @constructor
89230
89227
  */
89231
- constructor(camera) {
89228
+ constructor({
89229
+ camera,
89230
+ debug = false
89231
+ }) {
89232
+ this.#debug = debug;
89233
+
89232
89234
  const self = this;
89233
89235
 
89234
89236
  /**
@@ -89387,6 +89389,7 @@ class GraphicsEngine {
89387
89389
  return intersectObject;
89388
89390
  })();
89389
89391
  }
89392
+
89390
89393
  /**
89391
89394
  *
89392
89395
  * @returns {MaterialManager}
@@ -89470,7 +89473,7 @@ class GraphicsEngine {
89470
89473
 
89471
89474
  start() {
89472
89475
  const canvas = document.createElement("canvas");
89473
- const context = canvas.getContext("webgl2", {antialias: false});
89476
+ const context = canvas.getContext("webgl2", { antialias: false });
89474
89477
 
89475
89478
  const rendererParameters = {
89476
89479
  antialias: true,
@@ -89512,6 +89515,9 @@ class GraphicsEngine {
89512
89515
 
89513
89516
  configureThreeRenderer(webGLRenderer);
89514
89517
 
89518
+ //disable shader error checking in production build
89519
+ webGLRenderer.debug.checkShaderErrors = this.#debug;
89520
+
89515
89521
  this.enableExtensions();
89516
89522
 
89517
89523
  this.initializeFrameBuffers();
@@ -89667,6 +89673,10 @@ class GraphicsEngine {
89667
89673
  // TODO designate opaque output buffer
89668
89674
  const frameBuffer = buffers.getById(StandardFrameBuffers.ColorAndDepth);
89669
89675
 
89676
+ if (frameBuffer === undefined) {
89677
+ throw new Error(`No color-depth frame buffer`);
89678
+ }
89679
+
89670
89680
  renderTextureToScreenQuad(frameBuffer.renderTarget.texture, renderer);
89671
89681
 
89672
89682
  this.on.postOpaquePass.send0();
@@ -103182,14 +103192,14 @@ class Engine {
103182
103192
  * @param {EntityManager} [entityManager]
103183
103193
  * @param {boolean} [enableGraphics]
103184
103194
  * @param {boolean} [enableAudio]
103185
- * @param {boolean} [validation]
103195
+ * @param {boolean} [debug]
103186
103196
  * @constructor
103187
103197
  */
103188
103198
  constructor(platform, {
103189
103199
  entityManager,
103190
103200
  enableGraphics = true,
103191
103201
  enableAudio = true,
103192
- validation = true
103202
+ debug = true
103193
103203
  } = {}) {
103194
103204
 
103195
103205
  /**
@@ -103203,7 +103213,7 @@ class Engine {
103203
103213
  * @type {StaticKnowledgeDatabase}
103204
103214
  */
103205
103215
  this.staticKnowledge = new StaticKnowledgeDatabase();
103206
- this.staticKnowledge.validation_enabled = validation;
103216
+ this.staticKnowledge.validation_enabled = debug;
103207
103217
 
103208
103218
  /**
103209
103219
  *
@@ -103354,7 +103364,10 @@ class Engine {
103354
103364
 
103355
103365
  if (enableGraphics !== false) {
103356
103366
 
103357
- const graphicsEngine = new GraphicsEngine(this.camera);
103367
+ const graphicsEngine = new GraphicsEngine({
103368
+ camera: this.camera,
103369
+ debug
103370
+ });
103358
103371
 
103359
103372
  /**
103360
103373
  *
@@ -103365,7 +103378,7 @@ class Engine {
103365
103378
  try {
103366
103379
  graphicsEngine.start();
103367
103380
  } catch (e) {
103368
- logger.info("Failed to start GraphicEngine: ", e);
103381
+ logger.error(`Failed to start GraphicEngine: ${e}`);
103369
103382
  }
103370
103383
 
103371
103384
  } else {