mage-engine 3.23.39 → 3.23.40

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 +343 -209
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -55522,6 +55522,7 @@ const BEFORE_UNLOAD = "beforeunload";
55522
55522
  const HASH_CHANGE = "hashchange";
55523
55523
  const TAGS = {
55524
55524
  HELPER: "TAGS.HELPER",
55525
+ CAMERA_HELPER: "TAGS.CAMERA_HELPER",
55525
55526
  LIGHTS: {
55526
55527
  HOLDER: "TAGS.LIGHTS.HOLDER",
55527
55528
  HELPER: "TAGS.LIGHTS.HELPER",
@@ -55563,13 +55564,18 @@ const resolveSinglePath = path => {
55563
55564
  // If already a full URL or already contains the API path, return as-is
55564
55565
  if (isAlreadyResolved$2(path)) {
55565
55566
  return path;
55567
+ } // Root-relative paths (starting with /) are served from the public folder
55568
+ // and should not be modified with base URL
55569
+
55570
+
55571
+ if (path && path.startsWith("/")) {
55572
+ return path;
55566
55573
  }
55567
55574
 
55568
55575
  const baseUrl = env.MAGE_ASSETS_BASE_URL;
55569
55576
 
55570
55577
  if (baseUrl) {
55571
- const cleanPath = path.startsWith("/") ? path.slice(1) : path;
55572
- return `${baseUrl}/${cleanPath}`;
55578
+ return `${baseUrl}/${path}`;
55573
55579
  } // Warn if path contains colon (could be mistaken for protocol) and no base URL is set
55574
55580
 
55575
55581
 
@@ -58139,7 +58145,7 @@ function applyMiddleware() {
58139
58145
 
58140
58146
  var thunk = createThunkMiddleware();
58141
58147
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
58142
- var version$1 = "3.23.39";
58148
+ var version$1 = "3.23.40";
58143
58149
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
58144
58150
  var main = "dist/mage.js";
58145
58151
  var author$1 = {
@@ -62993,7 +62999,203 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
62993
62999
  }]);
62994
63000
 
62995
63001
  return Element;
62996
- }(Entity);let Camera = /*#__PURE__*/function (_Entity) {
63002
+ }(Entity);const validateAnisotropy = anisotropy => {
63003
+ const max = Scene$1.getRenderer().capabilities.getMaxAnisotropy();
63004
+ return cap(anisotropy, max);
63005
+ };
63006
+
63007
+ let Sprite = /*#__PURE__*/function (_Element) {
63008
+ _inherits(Sprite, _Element);
63009
+
63010
+ var _super = _createSuper(Sprite);
63011
+
63012
+ function Sprite() {
63013
+ var _this;
63014
+
63015
+ let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
63016
+ let height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
63017
+ let spriteTexture = arguments.length > 2 ? arguments[2] : undefined;
63018
+ let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
63019
+
63020
+ _classCallCheck(this, Sprite);
63021
+
63022
+ _this = _super.call(this, {
63023
+ width,
63024
+ height,
63025
+ spriteTexture,
63026
+ ...options
63027
+ });
63028
+ const {
63029
+ anisotropy = 1,
63030
+ sizeAttenuation = true,
63031
+ depthTest = true,
63032
+ depthWrite = true,
63033
+ ...rest
63034
+ } = options;
63035
+ const texture = Images$1.get(spriteTexture);
63036
+
63037
+ _this.recordTexture(spriteTexture, TEXTURES.MAP);
63038
+
63039
+ _this.width = width;
63040
+ _this.height = height;
63041
+ _this.spriteTexture = spriteTexture;
63042
+ const material = new SpriteMaterial({
63043
+ map: texture,
63044
+ ...rest
63045
+ });
63046
+ const body = new Sprite$1(material);
63047
+
63048
+ _this.setBody({
63049
+ body
63050
+ });
63051
+
63052
+ _this.setAnisotropy(anisotropy);
63053
+
63054
+ _this.setWidth(width);
63055
+
63056
+ _this.setHeight(height);
63057
+
63058
+ _this.setSizeAttenuation(sizeAttenuation);
63059
+
63060
+ _this.setDepthTest(depthTest);
63061
+
63062
+ _this.setDepthWrite(depthWrite);
63063
+
63064
+ _this.setEntityType(ENTITY_TYPES.SPRITE.TYPE);
63065
+
63066
+ _this.setEntitySubtype(ENTITY_TYPES.SPRITE.SUBTYPES.DEFAULT);
63067
+
63068
+ return _this;
63069
+ }
63070
+
63071
+ _createClass(Sprite, [{
63072
+ key: "getRotation",
63073
+ value: function getRotation() {
63074
+ return this.getBody().material.rotation;
63075
+ }
63076
+ }, {
63077
+ key: "setRotation",
63078
+ value: function setRotation() {
63079
+ let rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getRotation();
63080
+ const numericRotation = Number(rotation) || 0;
63081
+ this.setData("rotation", numericRotation);
63082
+ this.getBody().material.rotation = numericRotation;
63083
+ }
63084
+ }, {
63085
+ key: "setWidth",
63086
+ value: function setWidth() {
63087
+ let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.width;
63088
+ const numericWidth = Number(width) || 1;
63089
+ this.setData("width", numericWidth);
63090
+ this.getBody().scale.x = numericWidth;
63091
+ }
63092
+ }, {
63093
+ key: "setHeight",
63094
+ value: function setHeight() {
63095
+ let height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.height;
63096
+ const numericHeight = Number(height) || 1;
63097
+ this.setData("height", numericHeight);
63098
+ this.getBody().scale.y = numericHeight;
63099
+ }
63100
+ }, {
63101
+ key: "setAnisotropy",
63102
+ value: function setAnisotropy() {
63103
+ let anisotropy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
63104
+ const numericAnisotropy = Number(anisotropy) || 1;
63105
+ this.setData("anisotropy", numericAnisotropy);
63106
+ this.getTexture(TEXTURES.MAP).anisotropy = validateAnisotropy(numericAnisotropy);
63107
+ }
63108
+ }, {
63109
+ key: "setSizeAttenuation",
63110
+ value: function setSizeAttenuation() {
63111
+ let attenuation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
63112
+ this.setData("sizeAttenuation", attenuation);
63113
+ this.getBody().material.sizeAttenuation = attenuation;
63114
+ }
63115
+ }, {
63116
+ key: "setDepthTest",
63117
+ value: function setDepthTest() {
63118
+ let depthTest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
63119
+ this.setData("depthTest", depthTest);
63120
+ this.getBody().material.depthTest = depthTest;
63121
+ }
63122
+ }, {
63123
+ key: "setDepthWrite",
63124
+ value: function setDepthWrite() {
63125
+ let depthWrite = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
63126
+ this.setData("depthWrite", depthWrite);
63127
+ this.getBody().material.depthWrite = depthWrite;
63128
+ }
63129
+ }, {
63130
+ key: "toJSON",
63131
+ value: function toJSON() {
63132
+ let parseJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
63133
+
63134
+ if (this.isSerializable()) {
63135
+ return { ..._get(_getPrototypeOf(Sprite.prototype), "toJSON", this).call(this, parseJSON),
63136
+ width: this.width,
63137
+ height: this.height,
63138
+ spriteTexture: this.spriteTexture,
63139
+ anisotropy: this.getBody().material.anisotropy,
63140
+ sizeAttenuation: this.getBody().material.sizeAttenuation,
63141
+ depthTest: this.getBody().material.depthTest,
63142
+ depthWrite: this.getBody().material.depthWrite
63143
+ };
63144
+ }
63145
+ }
63146
+ }], [{
63147
+ key: "create",
63148
+ value: function create() {
63149
+ let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
63150
+ const {
63151
+ width,
63152
+ height,
63153
+ spriteTexture,
63154
+ options
63155
+ } = data;
63156
+ return new Sprite(width, height, spriteTexture, options);
63157
+ }
63158
+ }]);
63159
+
63160
+ return Sprite;
63161
+ }(Element$1);let HelperSprite = /*#__PURE__*/function (_Sprite) {
63162
+ _inherits(HelperSprite, _Sprite);
63163
+
63164
+ var _super = _createSuper(HelperSprite);
63165
+
63166
+ function HelperSprite() {
63167
+ var _this;
63168
+
63169
+ _classCallCheck(this, HelperSprite);
63170
+
63171
+ for (var _len = arguments.length, options = new Array(_len), _key = 0; _key < _len; _key++) {
63172
+ options[_key] = arguments[_key];
63173
+ }
63174
+
63175
+ _this = _super.call(this, ...options);
63176
+ _this.helperTarget = undefined;
63177
+
63178
+ _this.setEntityType(ENTITY_TYPES.HELPER.TYPE);
63179
+
63180
+ _this.setEntitySubtype(ENTITY_TYPES.HELPER.SUBTYPES.HELPER_SPRITE);
63181
+
63182
+ return _this;
63183
+ }
63184
+
63185
+ _createClass(HelperSprite, [{
63186
+ key: "setHelperTarget",
63187
+ value: function setHelperTarget(element) {
63188
+ this.helperTarget = element;
63189
+ }
63190
+ }, {
63191
+ key: "getHelperTarget",
63192
+ value: function getHelperTarget() {
63193
+ return this.helperTarget;
63194
+ }
63195
+ }]);
63196
+
63197
+ return HelperSprite;
63198
+ }(Sprite);let Camera = /*#__PURE__*/function (_Entity) {
62997
63199
  _inherits(Camera, _Entity);
62998
63200
 
62999
63201
  var _super = _createSuper(Camera);
@@ -63030,15 +63232,73 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
63030
63232
 
63031
63233
  _this.setEntitySubtype(ENTITY_TYPES.CAMERA.SUBTYPES.MAIN);
63032
63234
 
63033
- _this.setName(name);
63235
+ _this.setName(name); // Helper body for this camera
63034
63236
 
63237
+
63238
+ _this.isUsingHelper = false; // Holder body representing the camera (for selection in editor)
63239
+
63240
+ _this.holder = null; // THREE.js CameraHelper for visual feedback
63241
+
63242
+ _this.helper = null;
63035
63243
  return _this;
63036
63244
  }
63037
63245
 
63038
63246
  _createClass(Camera, [{
63247
+ key: "hasHolder",
63248
+ value: function hasHolder() {
63249
+ return !!this.holder;
63250
+ }
63251
+ }, {
63252
+ key: "usingHelper",
63253
+ value: function usingHelper() {
63254
+ return this.isUsingHelper;
63255
+ }
63256
+ }, {
63257
+ key: "addHolder",
63258
+ value: function addHolder() {
63259
+ let name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "cameraholder";
63260
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.05;
63261
+ const holderSprite = new HelperSprite(size, size, name, {
63262
+ name
63263
+ });
63264
+
63265
+ if (holderSprite) {
63266
+ holderSprite.setSizeAttenuation(false);
63267
+ holderSprite.setDepthTest(false);
63268
+ holderSprite.setDepthWrite(false);
63269
+ holderSprite.setSerializable(false);
63270
+ holderSprite.setPosition(this.getPosition());
63271
+ holderSprite.addTags([TAGS.HELPER, TAGS.CAMERA_HELPER, name]);
63272
+ holderSprite.setHelperTarget(this);
63273
+ this.holder = holderSprite;
63274
+ return true;
63275
+ }
63276
+
63277
+ console.warn("[Mage] Camera holder texture not found");
63278
+ return false;
63279
+ }
63280
+ }, {
63281
+ key: "addHelpers",
63282
+ value: function addHelpers() {
63283
+ let {
63284
+ holderName = "cameraholder",
63285
+ holderSize = 0.05
63286
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
63287
+ // Add THREE.js CameraHelper for visual feedback
63288
+ this.helper = new CameraHelper(this.getBody());
63289
+ Scene$1.add(this.helper, null, false); // Add holder sprite for selection
63290
+
63291
+ this.addHolder(holderName, holderSize);
63292
+ this.isUsingHelper = true;
63293
+ }
63294
+ }, {
63039
63295
  key: "getPosition",
63040
63296
  value: function getPosition() {
63041
- return this.body.position;
63297
+ return {
63298
+ x: this.body.position.x,
63299
+ y: this.body.position.y,
63300
+ z: this.body.position.z
63301
+ };
63042
63302
  }
63043
63303
  }, {
63044
63304
  key: "getDirection",
@@ -63066,6 +63326,66 @@ let Element$1 = /*#__PURE__*/function (_Entity) {
63066
63326
  } = position;
63067
63327
  this.body.lookAt(x, y, z);
63068
63328
  }
63329
+ }, {
63330
+ key: "setPosition",
63331
+ value: function setPosition(where) {
63332
+ let {
63333
+ updateHolder = true
63334
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
63335
+ const currentPos = this.getPosition();
63336
+ const position = {
63337
+ x: currentPos.x,
63338
+ y: currentPos.y,
63339
+ z: currentPos.z,
63340
+ ...where
63341
+ };
63342
+ const {
63343
+ x,
63344
+ y,
63345
+ z
63346
+ } = position;
63347
+
63348
+ if (this.hasBody()) {
63349
+ this.body.position.set(x, y, z);
63350
+ }
63351
+
63352
+ if (this.hasHolder() && updateHolder) {
63353
+ this.holder.setPosition({
63354
+ x,
63355
+ y,
63356
+ z
63357
+ });
63358
+ }
63359
+ }
63360
+ }, {
63361
+ key: "update",
63362
+ value: function update(dt) {
63363
+ _get(_getPrototypeOf(Camera.prototype), "update", this) && _get(_getPrototypeOf(Camera.prototype), "update", this).call(this, dt); // Update the THREE.js CameraHelper
63364
+
63365
+ if (this.usingHelper() && this.helper) {
63366
+ this.helper.update();
63367
+ } // Sync camera position from holder (when user drags the holder)
63368
+
63369
+
63370
+ if (this.hasHolder()) {
63371
+ // Read directly from the holder's THREE.js body position
63372
+ const holderBody = this.holder.getBody();
63373
+ const holderPos = {
63374
+ x: holderBody.position.x,
63375
+ y: holderBody.position.y,
63376
+ z: holderBody.position.z
63377
+ };
63378
+ const cameraPos = this.getPosition(); // Only update if positions differ significantly
63379
+
63380
+ const threshold = 0.001;
63381
+
63382
+ if (Math.abs(holderPos.x - cameraPos.x) > threshold || Math.abs(holderPos.y - cameraPos.y) > threshold || Math.abs(holderPos.z - cameraPos.z) > threshold) {
63383
+ this.setPosition(holderPos, {
63384
+ updateHolder: false
63385
+ });
63386
+ }
63387
+ }
63388
+ }
63069
63389
  }, {
63070
63390
  key: "getFov",
63071
63391
  value: function getFov() {
@@ -63838,203 +64158,7 @@ let Plane = /*#__PURE__*/function (_Element) {
63838
64158
  }]);
63839
64159
 
63840
64160
  return Box;
63841
- }(Element$1);const validateAnisotropy = anisotropy => {
63842
- const max = Scene$1.getRenderer().capabilities.getMaxAnisotropy();
63843
- return cap(anisotropy, max);
63844
- };
63845
-
63846
- let Sprite = /*#__PURE__*/function (_Element) {
63847
- _inherits(Sprite, _Element);
63848
-
63849
- var _super = _createSuper(Sprite);
63850
-
63851
- function Sprite() {
63852
- var _this;
63853
-
63854
- let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
63855
- let height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 20;
63856
- let spriteTexture = arguments.length > 2 ? arguments[2] : undefined;
63857
- let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
63858
-
63859
- _classCallCheck(this, Sprite);
63860
-
63861
- _this = _super.call(this, {
63862
- width,
63863
- height,
63864
- spriteTexture,
63865
- ...options
63866
- });
63867
- const {
63868
- anisotropy = 1,
63869
- sizeAttenuation = true,
63870
- depthTest = true,
63871
- depthWrite = true,
63872
- ...rest
63873
- } = options;
63874
- const texture = Images$1.get(spriteTexture);
63875
-
63876
- _this.recordTexture(spriteTexture, TEXTURES.MAP);
63877
-
63878
- _this.width = width;
63879
- _this.height = height;
63880
- _this.spriteTexture = spriteTexture;
63881
- const material = new SpriteMaterial({
63882
- map: texture,
63883
- ...rest
63884
- });
63885
- const body = new Sprite$1(material);
63886
-
63887
- _this.setBody({
63888
- body
63889
- });
63890
-
63891
- _this.setAnisotropy(anisotropy);
63892
-
63893
- _this.setWidth(width);
63894
-
63895
- _this.setHeight(height);
63896
-
63897
- _this.setSizeAttenuation(sizeAttenuation);
63898
-
63899
- _this.setDepthTest(depthTest);
63900
-
63901
- _this.setDepthWrite(depthWrite);
63902
-
63903
- _this.setEntityType(ENTITY_TYPES.SPRITE.TYPE);
63904
-
63905
- _this.setEntitySubtype(ENTITY_TYPES.SPRITE.SUBTYPES.DEFAULT);
63906
-
63907
- return _this;
63908
- }
63909
-
63910
- _createClass(Sprite, [{
63911
- key: "getRotation",
63912
- value: function getRotation() {
63913
- return this.getBody().material.rotation;
63914
- }
63915
- }, {
63916
- key: "setRotation",
63917
- value: function setRotation() {
63918
- let rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getRotation();
63919
- const numericRotation = Number(rotation) || 0;
63920
- this.setData("rotation", numericRotation);
63921
- this.getBody().material.rotation = numericRotation;
63922
- }
63923
- }, {
63924
- key: "setWidth",
63925
- value: function setWidth() {
63926
- let width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.width;
63927
- const numericWidth = Number(width) || 1;
63928
- this.setData("width", numericWidth);
63929
- this.getBody().scale.x = numericWidth;
63930
- }
63931
- }, {
63932
- key: "setHeight",
63933
- value: function setHeight() {
63934
- let height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.height;
63935
- const numericHeight = Number(height) || 1;
63936
- this.setData("height", numericHeight);
63937
- this.getBody().scale.y = numericHeight;
63938
- }
63939
- }, {
63940
- key: "setAnisotropy",
63941
- value: function setAnisotropy() {
63942
- let anisotropy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
63943
- const numericAnisotropy = Number(anisotropy) || 1;
63944
- this.setData("anisotropy", numericAnisotropy);
63945
- this.getTexture(TEXTURES.MAP).anisotropy = validateAnisotropy(numericAnisotropy);
63946
- }
63947
- }, {
63948
- key: "setSizeAttenuation",
63949
- value: function setSizeAttenuation() {
63950
- let attenuation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
63951
- this.setData("sizeAttenuation", attenuation);
63952
- this.getBody().material.sizeAttenuation = attenuation;
63953
- }
63954
- }, {
63955
- key: "setDepthTest",
63956
- value: function setDepthTest() {
63957
- let depthTest = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
63958
- this.setData("depthTest", depthTest);
63959
- this.getBody().material.depthTest = depthTest;
63960
- }
63961
- }, {
63962
- key: "setDepthWrite",
63963
- value: function setDepthWrite() {
63964
- let depthWrite = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
63965
- this.setData("depthWrite", depthWrite);
63966
- this.getBody().material.depthWrite = depthWrite;
63967
- }
63968
- }, {
63969
- key: "toJSON",
63970
- value: function toJSON() {
63971
- let parseJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
63972
-
63973
- if (this.isSerializable()) {
63974
- return { ..._get(_getPrototypeOf(Sprite.prototype), "toJSON", this).call(this, parseJSON),
63975
- width: this.width,
63976
- height: this.height,
63977
- spriteTexture: this.spriteTexture,
63978
- anisotropy: this.getBody().material.anisotropy,
63979
- sizeAttenuation: this.getBody().material.sizeAttenuation,
63980
- depthTest: this.getBody().material.depthTest,
63981
- depthWrite: this.getBody().material.depthWrite
63982
- };
63983
- }
63984
- }
63985
- }], [{
63986
- key: "create",
63987
- value: function create() {
63988
- let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
63989
- const {
63990
- width,
63991
- height,
63992
- spriteTexture,
63993
- options
63994
- } = data;
63995
- return new Sprite(width, height, spriteTexture, options);
63996
- }
63997
- }]);
63998
-
63999
- return Sprite;
64000
- }(Element$1);let HelperSprite = /*#__PURE__*/function (_Sprite) {
64001
- _inherits(HelperSprite, _Sprite);
64002
-
64003
- var _super = _createSuper(HelperSprite);
64004
-
64005
- function HelperSprite() {
64006
- var _this;
64007
-
64008
- _classCallCheck(this, HelperSprite);
64009
-
64010
- for (var _len = arguments.length, options = new Array(_len), _key = 0; _key < _len; _key++) {
64011
- options[_key] = arguments[_key];
64012
- }
64013
-
64014
- _this = _super.call(this, ...options);
64015
- _this.helperTarget = undefined;
64016
-
64017
- _this.setEntityType(ENTITY_TYPES.HELPER.TYPE);
64018
-
64019
- _this.setEntitySubtype(ENTITY_TYPES.HELPER.SUBTYPES.HELPER_SPRITE);
64020
-
64021
- return _this;
64022
- }
64023
-
64024
- _createClass(HelperSprite, [{
64025
- key: "setHelperTarget",
64026
- value: function setHelperTarget(element) {
64027
- this.helperTarget = element;
64028
- }
64029
- }, {
64030
- key: "getHelperTarget",
64031
- value: function getHelperTarget() {
64032
- return this.helperTarget;
64033
- }
64034
- }]);
64035
-
64036
- return HelperSprite;
64037
- }(Sprite);var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
64161
+ }(Element$1);var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
64038
64162
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
64039
64163
  return new (P || (P = Promise))(function (resolve, reject) {
64040
64164
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -70294,6 +70418,7 @@ const isAlreadyResolved$1 = path => {
70294
70418
  /**
70295
70419
  * Resolves an asset path to a full URL.
70296
70420
  * If path is already an absolute URL or contains the API path, returns it as-is.
70421
+ * If path is root-relative (starts with /), returns it as-is (served from public folder).
70297
70422
  * If path is relative and MAGE_ASSETS_BASE_URL is set, prepends the base URL.
70298
70423
  * @param {string} path - The asset path (relative or absolute)
70299
70424
  * @returns {string} - The resolved full URL
@@ -70304,15 +70429,19 @@ const resolveAssetPath$1 = path => {
70304
70429
  // If already a full URL or already contains the API path, return as-is
70305
70430
  if (isAlreadyResolved$1(path)) {
70306
70431
  return path;
70432
+ } // Root-relative paths (starting with /) are served from the public folder
70433
+ // and should not be modified with base URL
70434
+
70435
+
70436
+ if (path && path.startsWith("/")) {
70437
+ return path;
70307
70438
  } // If MAGE_ASSETS_BASE_URL is set, prepend it to the relative path
70308
70439
 
70309
70440
 
70310
70441
  const baseUrl = env.MAGE_ASSETS_BASE_URL;
70311
70442
 
70312
70443
  if (baseUrl) {
70313
- // Remove leading slash from path if present to avoid double slashes
70314
- const cleanPath = path.startsWith("/") ? path.slice(1) : path;
70315
- return `${baseUrl}/${cleanPath}`;
70444
+ return `${baseUrl}/${path}`;
70316
70445
  } // Warn if path contains colon (could be mistaken for protocol) and no base URL is set
70317
70446
 
70318
70447
 
@@ -80811,6 +80940,7 @@ const isAlreadyResolved = path => {
80811
80940
  /**
80812
80941
  * Resolves an asset path to a full URL.
80813
80942
  * If path is already an absolute URL or contains the API path, returns it as-is.
80943
+ * If path is root-relative (starts with /), returns it as-is (served from public folder).
80814
80944
  * If path is relative and MAGE_ASSETS_BASE_URL is set, prepends the base URL.
80815
80945
  * @param {string} path - The asset path (relative or absolute)
80816
80946
  * @returns {string} - The resolved full URL
@@ -80821,15 +80951,19 @@ const resolveAssetPath = path => {
80821
80951
  // If already a full URL or already contains the API path, return as-is
80822
80952
  if (isAlreadyResolved(path)) {
80823
80953
  return path;
80954
+ } // Root-relative paths (starting with /) are served from the public folder
80955
+ // and should not be modified with base URL
80956
+
80957
+
80958
+ if (path && path.startsWith("/")) {
80959
+ return path;
80824
80960
  } // If MAGE_ASSETS_BASE_URL is set, prepend it to the relative path
80825
80961
 
80826
80962
 
80827
80963
  const baseUrl = env.MAGE_ASSETS_BASE_URL;
80828
80964
 
80829
80965
  if (baseUrl) {
80830
- // Remove leading slash from path if present to avoid double slashes
80831
- const cleanPath = path.startsWith("/") ? path.slice(1) : path;
80832
- return `${baseUrl}/${cleanPath}`;
80966
+ return `${baseUrl}/${path}`;
80833
80967
  } // Warn if path contains colon (could be mistaken for protocol) and no base URL is set
80834
80968
 
80835
80969
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-engine",
3
- "version": "3.23.39",
3
+ "version": "3.23.40",
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": {