orbix-engine 1.0.2 → 1.0.4

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/dist/orbix.d.ts CHANGED
@@ -546,7 +546,8 @@ declare namespace Orbix {
546
546
  CAMERA: PerspectiveCamera;
547
547
  RENDERER: Renderer;
548
548
  NUKE: Nuke;
549
- ELEMENT: HTMLCanvasElement;
549
+ ELEMENT: any;
550
+ CANVAS: HTMLCanvasElement;
550
551
  instance(): typeof World;
551
552
  init(): void;
552
553
  };
package/dist/orbix.js CHANGED
@@ -27967,6 +27967,20 @@ Class((function AppStateOperators(_default) {
27967
27967
  lastChange: "2025-05-11T21:43:09.306Z"
27968
27968
  }], Class((function Antimatter(_num, _config, _renderer = World.RENDERER, _pointData = null) {
27969
27969
  Inherit(this, AntimatterFBO);
27970
+ // Options-style API: new Antimatter({ count, width, height, depth, ... })
27971
+ if (typeof _num === 'object' && _num !== null) {
27972
+ var _opts = _num;
27973
+ _num = _opts.count || _opts.num || _opts.particleCount || 1000;
27974
+ _config = {
27975
+ w: _opts.width || [-1, 1],
27976
+ h: _opts.height || [-1, 1],
27977
+ d: _opts.depth || [-1, 1],
27978
+ pot: _opts.pot || false
27979
+ };
27980
+ _renderer = _opts.renderer || World.RENDERER;
27981
+ _pointData = _opts.pointData || null;
27982
+ }
27983
+ if (!_config) _config = { w: [-1, 1], h: [-1, 1], d: [-1, 1] };
27970
27984
  var _geometry, _this = this,
27971
27985
  _drawLimit = _num,
27972
27986
  _size = function findSize() {
@@ -27979,7 +27993,9 @@ Class((function AppStateOperators(_default) {
27979
27993
  attribs: attribs,
27980
27994
  usedDepth: usedDepth
27981
27995
  } = await AntimatterUtil.createBufferArray(_size, _num, _config, _pointData);
27982
- _this.vertices = _this.cloneVertices ? vertices.clone() : vertices, (_geometry = geometry.clone(!0)).drawRange.end = _drawLimit, _this.vertices.geometry = _geometry, _this.attribs = _this.random = attribs, _this.textureUsedDepth = usedDepth, _this.init(_geometry, _renderer, _size)
27996
+ _this.vertices = _this.cloneVertices ? vertices.clone() : vertices, (_geometry = geometry.clone(!0)).drawRange.end = _drawLimit, _this.vertices.geometry = _geometry, _this.attribs = _this.random = attribs, _this.textureUsedDepth = usedDepth, _this.init(_geometry, _renderer, _size);
27997
+ // Auto-create mesh for standalone usage (CDN users)
27998
+ if (!_this.mesh) { try { _this.mesh = _this.getMesh(); } catch(e){} }
27983
27999
  }
27984
28000
  defer(createBuffer), this.createFloatArray = function(components = 3) {
27985
28001
  return new Float32Array(_size * _size * components)
@@ -28288,6 +28304,15 @@ Class((function AppStateOperators(_default) {
28288
28304
  }
28289
28305
  })), Class((function AntimatterSpawn(_proton, _group, _input) {
28290
28306
  Inherit(this, Component);
28307
+ // Guard: AntimatterSpawn requires a valid Proton parent with .antimatter
28308
+ if (!_proton || !_proton.antimatter || typeof _proton.antimatter.createFloatArrayAsync !== 'function') {
28309
+ console.warn('AntimatterSpawn: requires a Proton parent instance. Cannot be created standalone.');
28310
+ this.canEmit = false;
28311
+ this.emit = function(){};
28312
+ this.release = function(){};
28313
+ this.ready = function(){ return Promise.resolve(); };
28314
+ return;
28315
+ }
28291
28316
  const _this = this;
28292
28317
  var _life, _pass, _velocity, _color, _index = -1,
28293
28318
  _total = _proton.particleCount,
@@ -61259,6 +61284,9 @@ Class((function Main() {
61259
61284
  // Add the WebGL canvas to the page
61260
61285
  Stage.add(World.ELEMENT);
61261
61286
 
61287
+ // Expose raw canvas DOM node for CDN users (World.ELEMENT is a Hydra wrapper)
61288
+ World.CANVAS = (World.ELEMENT && World.ELEMENT.div) ? World.ELEMENT.div : World.ELEMENT;
61289
+
61262
61290
  // Signal engine ready
61263
61291
  window.ORBIX_ENGINE._world = World;
61264
61292
  window.ORBIX_ENGINE._ready = true;
@@ -61339,7 +61367,22 @@ window._BUILT_ = false;
61339
61367
  HE.Frustum = window.Frustum;
61340
61368
  HE.MathTween = window.MathTween;
61341
61369
  HE.MatrixWasm = window.MatrixWasm;
61342
- HE.MathUtils = { radians: Math.radians, lerp: Math.lerp, clamp: Math.clamp, range: Math.range, smoothStep: Math.smoothStep };
61370
+ HE.MathUtils = {
61371
+ radians: Math.radians,
61372
+ degrees: Math.degrees,
61373
+ lerp: Math.lerp,
61374
+ clamp: Math.clamp,
61375
+ range: Math.range,
61376
+ map: Math.map,
61377
+ mix: Math.mix,
61378
+ step: Math.step,
61379
+ smoothStep: Math.smoothStep,
61380
+ fract: Math.fract,
61381
+ randFloat: function(min, max) { return Math.random(min, max, 10); },
61382
+ randInt: function(min, max) { return Math.random(min, max, 0); },
61383
+ random: function(min, max, precision) { return Math.random(min, max, precision); }
61384
+ };
61385
+ window.MathUtils = HE.MathUtils;
61343
61386
 
61344
61387
  // ── 3D OBJECTS ──────────────────────────────────────────────────────────
61345
61388
  HE.Object3D = window.Object3D;
@@ -61634,7 +61677,7 @@ window._BUILT_ = false;
61634
61677
  camera: World.CAMERA,
61635
61678
  nuke: World.NUKE,
61636
61679
  renderer: World.RENDERER,
61637
- element: World.ELEMENT
61680
+ element: World.CANVAS || World.ELEMENT
61638
61681
  };
61639
61682
  };
61640
61683