mage-engine 3.22.1 → 3.22.2

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 (2) hide show
  1. package/dist/mage.js +69 -24
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -56306,7 +56306,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56306
56306
  });
56307
56307
 
56308
56308
  _defineProperty$1(this, "setBackground", function (texture) {
56309
- _this.scene.background = typeof texture === 'string' ? Images$1.get(texture) : texture;
56309
+ _this.scene.background = typeof texture === "string" ? Images$1.get(texture) : texture;
56310
56310
  });
56311
56311
 
56312
56312
  _defineProperty$1(this, "setRendererShadowMap", function () {
@@ -56348,7 +56348,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56348
56348
  }, {
56349
56349
  key: "createScene",
56350
56350
  value: function createScene() {
56351
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : generateRandomName('LevelName');
56351
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : generateRandomName("LevelName");
56352
56352
  var fog = Config$1.fog();
56353
56353
  this.scene = new Scene$2();
56354
56354
  this.scene.name = name;
@@ -56406,7 +56406,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56406
56406
  key: "getHierarchy",
56407
56407
  value: function getHierarchy() {
56408
56408
  return [{
56409
- element: this,
56409
+ element: this.toJSON(),
56410
56410
  children: [this.getCamera().getHierarchy()].concat(_toConsumableArray(this.elements.filter(function (e) {
56411
56411
  return !e.hasParent() && !e.isHelper();
56412
56412
  }).map(function (e) {
@@ -56466,7 +56466,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56466
56466
  var win = getWindow();
56467
56467
 
56468
56468
  if (win) {
56469
- win.addEventListener('resize', this.onResize);
56469
+ win.addEventListener("resize", this.onResize);
56470
56470
  }
56471
56471
  }
56472
56472
  }, {
@@ -56475,7 +56475,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56475
56475
  var win = getWindow();
56476
56476
 
56477
56477
  if (win) {
56478
- win.removeEventListener('resize', this.onResize);
56478
+ win.removeEventListener("resize", this.onResize);
56479
56479
  }
56480
56480
  }
56481
56481
  }, {
@@ -56556,7 +56556,7 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56556
56556
  this.renderer = new WebGLRenderer({
56557
56557
  alpha: alpha,
56558
56558
  antialias: antialias,
56559
- powerPreference: 'high-performance'
56559
+ powerPreference: "high-performance"
56560
56560
  });
56561
56561
 
56562
56562
  if (shadows) {
@@ -56618,6 +56618,20 @@ var Physics$1 = new Physics();var Scene = /*#__PURE__*/function () {
56618
56618
  Universe$1.update(dt);
56619
56619
  this.getCamera().update(dt);
56620
56620
  }
56621
+ }, {
56622
+ key: "toJSON",
56623
+ value: function toJSON() {
56624
+ return {
56625
+ name: this.getName(),
56626
+ uuid: this.uuid(),
56627
+ entityType: this.getEntityType(),
56628
+ background: this.scene.background,
56629
+ clearColor: this.clearColor,
56630
+ alpha: this.alpha,
56631
+ outputEncoding: this.outputEncoding,
56632
+ fog: this.scene.fog
56633
+ };
56634
+ }
56621
56635
  }]);
56622
56636
 
56623
56637
  return Scene;
@@ -57749,7 +57763,7 @@ function applyMiddleware() {
57749
57763
 
57750
57764
  var thunk = createThunkMiddleware();
57751
57765
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
57752
- var version$1 = "3.22.1";
57766
+ var version$1 = "3.22.2";
57753
57767
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
57754
57768
  var main = "dist/mage.js";
57755
57769
  var author$1 = {
@@ -60346,7 +60360,7 @@ var tweenTo = function tweenTo(origin, target) {
60346
60360
  key: "getHierarchy",
60347
60361
  value: function getHierarchy() {
60348
60362
  return {
60349
- element: this,
60363
+ element: this.toJSON(),
60350
60364
  children: this.children.map(function (e) {
60351
60365
  return e.getHierarchy();
60352
60366
  })
@@ -60891,15 +60905,17 @@ var tweenTo = function tweenTo(origin, target) {
60891
60905
  return this.getBody().userData[key];
60892
60906
  } else {
60893
60907
  console.log(KEY_IS_MISSING);
60908
+ return this.getBody().userData;
60894
60909
  }
60895
60910
  } else {
60896
60911
  console.log(USER_DATA_IS_MISSING);
60912
+ return {};
60897
60913
  }
60898
60914
  }
60899
60915
  }, {
60900
60916
  key: "mapScriptsToJSON",
60901
60917
  value: function mapScriptsToJSON() {
60902
- this.allScripts().reduce(function (acc, _ref8) {
60918
+ return this.allScripts().reduce(function (acc, _ref8) {
60903
60919
  var name = _ref8.name,
60904
60920
  _ref8$options = _ref8.options,
60905
60921
  options = _ref8$options === void 0 ? {} : _ref8$options,
@@ -60921,10 +60937,15 @@ var tweenTo = function tweenTo(origin, target) {
60921
60937
  return {
60922
60938
  position: this.getPosition(),
60923
60939
  rotation: this.getRotation(),
60940
+ quaternion: this.getQuaternion(),
60941
+ worldTransform: this.getWorldTransform(),
60924
60942
  scale: this.getScale(),
60925
60943
  entityType: this.getEntityType(),
60926
60944
  scripts: this.mapScriptsToJSON(),
60927
- tags: this.getTags()
60945
+ tags: this.getTags(),
60946
+ name: this.getName(),
60947
+ uuid: this.uuid(),
60948
+ data: this.getData()
60928
60949
  };
60929
60950
  }
60930
60951
  }
@@ -61303,14 +61324,6 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61303
61324
  }
61304
61325
 
61305
61326
  _createClass(Element, [{
61306
- key: "addTag",
61307
- value: function addTag(tag) {
61308
- _get(_getPrototypeOf(Element.prototype), "addTag", this).call(this, tag);
61309
-
61310
- var existingTags = this.getBody().userData.tags || [];
61311
- this.getBody().userData.tags = [].concat(_toConsumableArray(existingTags), [tag]);
61312
- }
61313
- }, {
61314
61327
  key: "setBody",
61315
61328
  value: function setBody(_ref7) {
61316
61329
  var body = _ref7.body,
@@ -61810,9 +61823,16 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61810
61823
  value: function toJSON() {
61811
61824
  if (this.isSerializable()) {
61812
61825
  return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Element.prototype), "toJSON", this).call(this)), {}, {
61826
+ physics: {
61827
+ state: this.getPhysicsState(),
61828
+ options: this.getPhysicsOptions()
61829
+ },
61813
61830
  body: this.body.toJSON(),
61814
- textures: this.textures
61815
- }, this.options);
61831
+ textures: this.textures,
61832
+ materialType: this.getMaterialType(),
61833
+ opacity: this.opacity,
61834
+ color: this.getColor()
61835
+ });
61816
61836
  }
61817
61837
  }
61818
61838
  }]);
@@ -61831,7 +61851,7 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
61831
61851
  _classCallCheck(this, Camera);
61832
61852
 
61833
61853
  var _options$name = options.name,
61834
- name = _options$name === void 0 ? 'camera' : _options$name,
61854
+ name = _options$name === void 0 ? "Main PerspectiveCamera" : _options$name,
61835
61855
  _options$fov = options.fov,
61836
61856
  fov = _options$fov === void 0 ? Config$1.camera().fov : _options$fov,
61837
61857
  _options$ratio = options.ratio,
@@ -83038,6 +83058,7 @@ var MeshLoader$1 = new MeshLoader();var Light = /*#__PURE__*/function (_Entity)
83038
83058
  value: function setIntensity(value) {
83039
83059
  if (this.hasBody()) {
83040
83060
  this.body.intensity = value;
83061
+ this.intensity = value;
83041
83062
  }
83042
83063
  }
83043
83064
  }, {
@@ -83047,6 +83068,16 @@ var MeshLoader$1 = new MeshLoader();var Light = /*#__PURE__*/function (_Entity)
83047
83068
  return this.body.intensity;
83048
83069
  }
83049
83070
  }
83071
+ }, {
83072
+ key: "setColor",
83073
+ value: function setColor(color) {
83074
+ this.body.color = color;
83075
+ }
83076
+ }, {
83077
+ key: "getColor",
83078
+ value: function getColor() {
83079
+ return this.body.color;
83080
+ }
83050
83081
  }, {
83051
83082
  key: "dim",
83052
83083
  value: function dim() {
@@ -83100,9 +83131,9 @@ var MeshLoader$1 = new MeshLoader();var Light = /*#__PURE__*/function (_Entity)
83100
83131
  value: function toJSON() {
83101
83132
  return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(Light.prototype), "toJSON", this).call(this)), {}, {
83102
83133
  type: this.getEntityType(),
83103
- color: this.color,
83104
- intensity: this.intensity,
83105
- name: this.name
83134
+ color: this.getColor(),
83135
+ intensity: this.getIntensity(),
83136
+ name: this.getName()
83106
83137
  });
83107
83138
  }
83108
83139
  }]);
@@ -83284,6 +83315,13 @@ var SunLight = /*#__PURE__*/function (_Light) {
83284
83315
  });
83285
83316
  }
83286
83317
  }
83318
+ }, {
83319
+ key: "toJSON",
83320
+ value: function toJSON() {
83321
+ return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SunLight.prototype), "toJSON", this).call(this)), {}, {
83322
+ target: this.getTargetPosition()
83323
+ });
83324
+ }
83287
83325
  }]);
83288
83326
 
83289
83327
  return SunLight;
@@ -91555,6 +91593,13 @@ var SpotLight = /*#__PURE__*/function (_Light) {
91555
91593
  });
91556
91594
  }
91557
91595
  }
91596
+ }, {
91597
+ key: "toJSON",
91598
+ value: function toJSON() {
91599
+ return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SpotLight.prototype), "toJSON", this).call(this)), {}, {
91600
+ target: this.getTargetPosition()
91601
+ });
91602
+ }
91558
91603
  }]);
91559
91604
 
91560
91605
  return SpotLight;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-engine",
3
- "version": "3.22.1",
3
+ "version": "3.22.2",
4
4
  "description": "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.",
5
5
  "main": "dist/mage.js",
6
6
  "author": {