@woosh/meep-engine 2.85.2 → 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.
@@ -89211,22 +89211,24 @@ function configureThreeRenderer(webGLRenderer) {
89211
89211
  //turn off automatic info reset, we use multi-pass rendering, so we manually reset the render info
89212
89212
  webGLRenderer.info.autoReset = false;
89213
89213
 
89214
- if (ENV_PRODUCTION) {
89215
- //disable shader error checking in production build
89216
- webGLRenderer.debug.checkShaderErrors = false;
89217
- } else {
89218
- webGLRenderer.debug.checkShaderErrors = true;
89219
- }
89220
89214
  }
89221
89215
 
89222
89216
 
89223
89217
  class GraphicsEngine {
89218
+ #debug = false;
89219
+
89224
89220
  /**
89225
89221
  *
89226
89222
  * @param {Camera} camera
89223
+ * @param {boolean} [debug]
89227
89224
  * @constructor
89228
89225
  */
89229
- constructor(camera) {
89226
+ constructor({
89227
+ camera,
89228
+ debug = false
89229
+ }) {
89230
+ this.#debug = debug;
89231
+
89230
89232
  const self = this;
89231
89233
 
89232
89234
  /**
@@ -89511,6 +89513,9 @@ class GraphicsEngine {
89511
89513
 
89512
89514
  configureThreeRenderer(webGLRenderer);
89513
89515
 
89516
+ //disable shader error checking in production build
89517
+ webGLRenderer.debug.checkShaderErrors = this.#debug;
89518
+
89514
89519
  this.enableExtensions();
89515
89520
 
89516
89521
  this.initializeFrameBuffers();
@@ -103185,14 +103190,14 @@ class Engine {
103185
103190
  * @param {EntityManager} [entityManager]
103186
103191
  * @param {boolean} [enableGraphics]
103187
103192
  * @param {boolean} [enableAudio]
103188
- * @param {boolean} [validation]
103193
+ * @param {boolean} [debug]
103189
103194
  * @constructor
103190
103195
  */
103191
103196
  constructor(platform, {
103192
103197
  entityManager,
103193
103198
  enableGraphics = true,
103194
103199
  enableAudio = true,
103195
- validation = true
103200
+ debug = true
103196
103201
  } = {}) {
103197
103202
 
103198
103203
  /**
@@ -103206,7 +103211,7 @@ class Engine {
103206
103211
  * @type {StaticKnowledgeDatabase}
103207
103212
  */
103208
103213
  this.staticKnowledge = new StaticKnowledgeDatabase();
103209
- this.staticKnowledge.validation_enabled = validation;
103214
+ this.staticKnowledge.validation_enabled = debug;
103210
103215
 
103211
103216
  /**
103212
103217
  *
@@ -103357,7 +103362,10 @@ class Engine {
103357
103362
 
103358
103363
  if (enableGraphics !== false) {
103359
103364
 
103360
- const graphicsEngine = new GraphicsEngine(this.camera);
103365
+ const graphicsEngine = new GraphicsEngine({
103366
+ camera: this.camera,
103367
+ debug
103368
+ });
103361
103369
 
103362
103370
  /**
103363
103371
  *
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.85.2",
8
+ "version": "2.85.3",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -15,7 +15,7 @@ export interface IEngineInitializationOptions {
15
15
  entityManager?: EntityManager,
16
16
  enableAudio?: boolean
17
17
  enableGraphics?: boolean
18
- validation?:boolean
18
+ debug?:boolean
19
19
  }
20
20
 
21
21
  export default class Engine {
@@ -54,14 +54,14 @@ class Engine {
54
54
  * @param {EntityManager} [entityManager]
55
55
  * @param {boolean} [enableGraphics]
56
56
  * @param {boolean} [enableAudio]
57
- * @param {boolean} [validation]
57
+ * @param {boolean} [debug]
58
58
  * @constructor
59
59
  */
60
60
  constructor(platform, {
61
61
  entityManager,
62
62
  enableGraphics = true,
63
63
  enableAudio = true,
64
- validation = true
64
+ debug = true
65
65
  } = {}) {
66
66
  assert.defined(platform, 'platform');
67
67
 
@@ -76,7 +76,7 @@ class Engine {
76
76
  * @type {StaticKnowledgeDatabase}
77
77
  */
78
78
  this.staticKnowledge = new StaticKnowledgeDatabase();
79
- this.staticKnowledge.validation_enabled = validation;
79
+ this.staticKnowledge.validation_enabled = debug;
80
80
 
81
81
  /**
82
82
  *
@@ -159,7 +159,7 @@ class Engine {
159
159
 
160
160
  if (!this.__using_external_entity_manager) {
161
161
  // subscribe simulator to common ticker
162
- this.ticker.subscribe(timeDelta => {
162
+ this.ticker.onTick.add(timeDelta => {
163
163
  const t0 = performance.now();
164
164
  this.entityManager.simulate(timeDelta);
165
165
 
@@ -227,7 +227,10 @@ class Engine {
227
227
 
228
228
  if (enableGraphics !== false) {
229
229
 
230
- const graphicsEngine = new GraphicsEngine(this.camera);
230
+ const graphicsEngine = new GraphicsEngine({
231
+ camera: this.camera,
232
+ debug
233
+ });
231
234
 
232
235
  /**
233
236
  *
@@ -58,22 +58,24 @@ function configureThreeRenderer(webGLRenderer) {
58
58
  //turn off automatic info reset, we use multi-pass rendering, so we manually reset the render info
59
59
  webGLRenderer.info.autoReset = false;
60
60
 
61
- if (ENV_PRODUCTION) {
62
- //disable shader error checking in production build
63
- webGLRenderer.debug.checkShaderErrors = false;
64
- } else {
65
- webGLRenderer.debug.checkShaderErrors = true;
66
- }
67
61
  }
68
62
 
69
63
 
70
64
  export class GraphicsEngine {
65
+ #debug = false;
66
+
71
67
  /**
72
68
  *
73
69
  * @param {Camera} camera
70
+ * @param {boolean} [debug]
74
71
  * @constructor
75
72
  */
76
- constructor(camera) {
73
+ constructor({
74
+ camera,
75
+ debug = false
76
+ }) {
77
+ this.#debug = debug;
78
+
77
79
  const self = this;
78
80
 
79
81
  /**
@@ -363,6 +365,9 @@ export class GraphicsEngine {
363
365
 
364
366
  configureThreeRenderer(webGLRenderer);
365
367
 
368
+ //disable shader error checking in production build
369
+ webGLRenderer.debug.checkShaderErrors = this.#debug;
370
+
366
371
  this.enableExtensions();
367
372
 
368
373
  this.initializeFrameBuffers();