mage-engine 3.22.3 → 3.22.5
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/.vscode/settings.json +1 -0
- package/dist/mage.js +374 -125
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/dist/mage.js
CHANGED
|
@@ -57763,7 +57763,7 @@ function applyMiddleware() {
|
|
|
57763
57763
|
|
|
57764
57764
|
var thunk = createThunkMiddleware();
|
|
57765
57765
|
thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
|
|
57766
|
-
var version$1 = "3.22.
|
|
57766
|
+
var version$1 = "3.22.5";
|
|
57767
57767
|
var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
|
|
57768
57768
|
var main = "dist/mage.js";
|
|
57769
57769
|
var author$1 = {
|
|
@@ -60945,7 +60945,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60945
60945
|
tags: this.getTags(),
|
|
60946
60946
|
name: this.getName(),
|
|
60947
60947
|
uuid: this.uuid(),
|
|
60948
|
-
data: this.getData()
|
|
60948
|
+
data: this.getData(),
|
|
60949
|
+
shadow: {
|
|
60950
|
+
cast: this.getBody().castShadow,
|
|
60951
|
+
receive: this.getBody().receiveShadow
|
|
60952
|
+
}
|
|
60949
60953
|
};
|
|
60950
60954
|
}
|
|
60951
60955
|
}
|
|
@@ -82994,7 +82998,7 @@ var MeshLoader$1 = new MeshLoader();var Light = /*#__PURE__*/function (_Entity)
|
|
|
82994
82998
|
targetSprite.setDepthTest(false);
|
|
82995
82999
|
targetSprite.setDepthWrite(false);
|
|
82996
83000
|
targetSprite.setSerializable(false);
|
|
82997
|
-
targetSprite.setPosition(_this.
|
|
83001
|
+
targetSprite.setPosition(_this.getTarget().getPosition());
|
|
82998
83002
|
targetSprite.addTags([TAGS.LIGHTS.HELPER, TAGS.LIGHTS.TARGET, name]);
|
|
82999
83003
|
targetSprite.setHelperTarget(_assertThisInitialized(_this));
|
|
83000
83004
|
targetSprite.getBody().add(_this.getBody().target);
|
|
@@ -83111,6 +83115,17 @@ var MeshLoader$1 = new MeshLoader();var Light = /*#__PURE__*/function (_Entity)
|
|
|
83111
83115
|
value: function getColor() {
|
|
83112
83116
|
return this.body.color;
|
|
83113
83117
|
}
|
|
83118
|
+
}, {
|
|
83119
|
+
key: "setCastShadow",
|
|
83120
|
+
value: function setCastShadow(castShadow) {
|
|
83121
|
+
this.castShadow = castShadow;
|
|
83122
|
+
this.getBody().castShadow = castShadow;
|
|
83123
|
+
}
|
|
83124
|
+
}, {
|
|
83125
|
+
key: "getCastShadow",
|
|
83126
|
+
value: function getCastShadow() {
|
|
83127
|
+
return this.castShadow;
|
|
83128
|
+
}
|
|
83114
83129
|
}, {
|
|
83115
83130
|
key: "dim",
|
|
83116
83131
|
value: function dim() {
|
|
@@ -83166,7 +83181,8 @@ var MeshLoader$1 = new MeshLoader();var Light = /*#__PURE__*/function (_Entity)
|
|
|
83166
83181
|
type: this.getEntityType(),
|
|
83167
83182
|
color: this.getColor(),
|
|
83168
83183
|
intensity: this.getIntensity(),
|
|
83169
|
-
name: this.getName()
|
|
83184
|
+
name: this.getName(),
|
|
83185
|
+
castShadow: this.getCastShadow()
|
|
83170
83186
|
});
|
|
83171
83187
|
}
|
|
83172
83188
|
}]);
|
|
@@ -83208,7 +83224,29 @@ var SunLight = /*#__PURE__*/function (_Light) {
|
|
|
83208
83224
|
intensity: intensity,
|
|
83209
83225
|
name: name
|
|
83210
83226
|
});
|
|
83227
|
+
|
|
83228
|
+
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
83229
|
+
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR$2;
|
|
83230
|
+
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR$2;
|
|
83231
|
+
_this.near = near;
|
|
83232
|
+
_this.far = far;
|
|
83233
|
+
var d = _this.far / 2;
|
|
83234
|
+
_this.getBody().shadow.camera.left = -d;
|
|
83235
|
+
_this.getBody().shadow.camera.right = d;
|
|
83236
|
+
_this.getBody().shadow.camera.top = d;
|
|
83237
|
+
_this.getBody().shadow.camera.bottom = -d;
|
|
83238
|
+
_this.getBody().shadow.camera.near = near;
|
|
83239
|
+
_this.getBody().shadow.camera.far = far;
|
|
83240
|
+
});
|
|
83241
|
+
|
|
83242
|
+
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
83243
|
+
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS$2;
|
|
83244
|
+
_this.bias = bias;
|
|
83245
|
+
_this.getBody().shadow.bias = bias;
|
|
83246
|
+
});
|
|
83247
|
+
|
|
83211
83248
|
_this.options = options;
|
|
83249
|
+
_this.target = ORIGIN;
|
|
83212
83250
|
|
|
83213
83251
|
_this.setLight({
|
|
83214
83252
|
color: color,
|
|
@@ -83248,51 +83286,77 @@ var SunLight = /*#__PURE__*/function (_Light) {
|
|
|
83248
83286
|
}, {
|
|
83249
83287
|
key: "postLightCreation",
|
|
83250
83288
|
value: function postLightCreation() {
|
|
83251
|
-
var _this$options = this.options,
|
|
83252
|
-
_this$options$positio
|
|
83253
|
-
|
|
83254
|
-
|
|
83289
|
+
var _this$options$positio = this.options.position,
|
|
83290
|
+
position = _this$options$positio === void 0 ? DEFAULT_POSITION$3 : _this$options$positio;
|
|
83291
|
+
var emptyTarget = new Element$1({
|
|
83292
|
+
body: new Object3D()
|
|
83293
|
+
});
|
|
83255
83294
|
this.setPosition(position);
|
|
83256
|
-
|
|
83257
|
-
if (target) {
|
|
83258
|
-
this.setTarget(target);
|
|
83259
|
-
}
|
|
83260
|
-
|
|
83295
|
+
this.setTarget(emptyTarget);
|
|
83261
83296
|
this.setLightShadows();
|
|
83262
83297
|
this.addToScene();
|
|
83263
83298
|
}
|
|
83264
83299
|
}, {
|
|
83265
83300
|
key: "setLightShadows",
|
|
83266
83301
|
value: function setLightShadows() {
|
|
83267
|
-
var _this$
|
|
83268
|
-
_this$
|
|
83269
|
-
near = _this$
|
|
83270
|
-
_this$
|
|
83271
|
-
far = _this$
|
|
83272
|
-
_this$
|
|
83273
|
-
mapSize = _this$
|
|
83274
|
-
_this$
|
|
83275
|
-
bias = _this$
|
|
83276
|
-
_this$
|
|
83277
|
-
fov = _this$
|
|
83278
|
-
|
|
83279
|
-
|
|
83280
|
-
|
|
83281
|
-
|
|
83282
|
-
this.
|
|
83283
|
-
|
|
83284
|
-
this.
|
|
83285
|
-
this.body.shadow.mapSize.width = mapSize;
|
|
83286
|
-
this.body.shadow.camera.left = -d;
|
|
83287
|
-
this.body.shadow.camera.right = d;
|
|
83288
|
-
this.body.shadow.camera.top = d;
|
|
83289
|
-
this.body.shadow.camera.bottom = -d;
|
|
83290
|
-
this.body.shadow.camera.near = near;
|
|
83291
|
-
this.body.shadow.camera.far = far;
|
|
83292
|
-
this.body.shadow.camera.fov = fov;
|
|
83293
|
-
this.body.shadow.bias = bias;
|
|
83302
|
+
var _this$options = this.options,
|
|
83303
|
+
_this$options$near = _this$options.near,
|
|
83304
|
+
near = _this$options$near === void 0 ? DEFAULT_NEAR$2 : _this$options$near,
|
|
83305
|
+
_this$options$far = _this$options.far,
|
|
83306
|
+
far = _this$options$far === void 0 ? DEFAULT_FAR$2 : _this$options$far,
|
|
83307
|
+
_this$options$mapSize = _this$options.mapSize,
|
|
83308
|
+
mapSize = _this$options$mapSize === void 0 ? DEFAULT_MAP_SIZE$2 : _this$options$mapSize,
|
|
83309
|
+
_this$options$bias = _this$options.bias,
|
|
83310
|
+
bias = _this$options$bias === void 0 ? DEFAULT_BIAS$2 : _this$options$bias,
|
|
83311
|
+
_this$options$fov = _this$options.fov,
|
|
83312
|
+
fov = _this$options$fov === void 0 ? DEFAULT_FOV : _this$options$fov;
|
|
83313
|
+
|
|
83314
|
+
if (Config$1.lights().shadows) {
|
|
83315
|
+
this.setCastShadow(true);
|
|
83316
|
+
this.setMapSize(mapSize);
|
|
83317
|
+
this.setShadowCameraNearFar(near, far);
|
|
83318
|
+
this.setBias(bias);
|
|
83319
|
+
this.setShadowCameraFov(fov);
|
|
83294
83320
|
}
|
|
83295
83321
|
}
|
|
83322
|
+
}, {
|
|
83323
|
+
key: "getShadowCameraNearFar",
|
|
83324
|
+
value: function getShadowCameraNearFar() {
|
|
83325
|
+
return {
|
|
83326
|
+
near: this.near,
|
|
83327
|
+
far: this.far
|
|
83328
|
+
};
|
|
83329
|
+
}
|
|
83330
|
+
}, {
|
|
83331
|
+
key: "setShadowCameraFov",
|
|
83332
|
+
value: function setShadowCameraFov() {
|
|
83333
|
+
var fov = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_FOV;
|
|
83334
|
+
this.fov = fov;
|
|
83335
|
+
this.getBody().shadow.camera.fov = fov;
|
|
83336
|
+
}
|
|
83337
|
+
}, {
|
|
83338
|
+
key: "getShadowCameraFov",
|
|
83339
|
+
value: function getShadowCameraFov() {
|
|
83340
|
+
return this.fov;
|
|
83341
|
+
}
|
|
83342
|
+
}, {
|
|
83343
|
+
key: "setMapSize",
|
|
83344
|
+
value: function setMapSize() {
|
|
83345
|
+
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE$2;
|
|
83346
|
+
this.mapSize = mapSize;
|
|
83347
|
+
this.getBody().shadow.mapSize.height = mapSize;
|
|
83348
|
+
this.getBody().shadow.mapSize.width = mapSize;
|
|
83349
|
+
}
|
|
83350
|
+
}, {
|
|
83351
|
+
key: "getMapSize",
|
|
83352
|
+
value: function getMapSize() {
|
|
83353
|
+
return this.mapSize;
|
|
83354
|
+
}
|
|
83355
|
+
}, {
|
|
83356
|
+
key: "getBias",
|
|
83357
|
+
value: function getBias() {
|
|
83358
|
+
return this.bias;
|
|
83359
|
+
}
|
|
83296
83360
|
}, {
|
|
83297
83361
|
key: "hasTarget",
|
|
83298
83362
|
value: function hasTarget() {
|
|
@@ -83301,14 +83365,13 @@ var SunLight = /*#__PURE__*/function (_Light) {
|
|
|
83301
83365
|
}, {
|
|
83302
83366
|
key: "setTarget",
|
|
83303
83367
|
value: function setTarget(target) {
|
|
83304
|
-
|
|
83305
|
-
|
|
83306
|
-
|
|
83307
|
-
}
|
|
83368
|
+
this.target = target;
|
|
83369
|
+
this.getBody().target = target.getBody();
|
|
83370
|
+
Scene$1.add(this.getBody().target, null, false);
|
|
83308
83371
|
}
|
|
83309
83372
|
}, {
|
|
83310
|
-
key: "
|
|
83311
|
-
value: function
|
|
83373
|
+
key: "getTarget",
|
|
83374
|
+
value: function getTarget() {
|
|
83312
83375
|
return this.target;
|
|
83313
83376
|
}
|
|
83314
83377
|
}, {
|
|
@@ -83316,7 +83379,7 @@ var SunLight = /*#__PURE__*/function (_Light) {
|
|
|
83316
83379
|
value: function addHelpers() {
|
|
83317
83380
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
83318
83381
|
_ref2$holderName = _ref2.holderName,
|
|
83319
|
-
holderName = _ref2$holderName === void 0 ? "
|
|
83382
|
+
holderName = _ref2$holderName === void 0 ? "sunlightholder" : _ref2$holderName,
|
|
83320
83383
|
_ref2$holderSize = _ref2.holderSize,
|
|
83321
83384
|
holderSize = _ref2$holderSize === void 0 ? 0.05 : _ref2$holderSize,
|
|
83322
83385
|
_ref2$targetHolderNam = _ref2.targetHolderName,
|
|
@@ -83352,7 +83415,12 @@ var SunLight = /*#__PURE__*/function (_Light) {
|
|
|
83352
83415
|
key: "toJSON",
|
|
83353
83416
|
value: function toJSON() {
|
|
83354
83417
|
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SunLight.prototype), "toJSON", this).call(this)), {}, {
|
|
83355
|
-
target: this.
|
|
83418
|
+
target: this.getTarget(),
|
|
83419
|
+
bias: this.getBias(),
|
|
83420
|
+
mapSize: this.getMapSize(),
|
|
83421
|
+
shadowCamera: _objectSpread2$1(_objectSpread2$1({}, this.getShadowCameraNearFar()), {}, {
|
|
83422
|
+
fov: this.setShadowCameraFov()
|
|
83423
|
+
})
|
|
83356
83424
|
});
|
|
83357
83425
|
}
|
|
83358
83426
|
}]);
|
|
@@ -83500,6 +83568,27 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
83500
83568
|
intensity: intensity,
|
|
83501
83569
|
name: name
|
|
83502
83570
|
});
|
|
83571
|
+
|
|
83572
|
+
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
83573
|
+
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR$1;
|
|
83574
|
+
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR$1;
|
|
83575
|
+
_this.near = near;
|
|
83576
|
+
_this.far = far;
|
|
83577
|
+
var d = _this.far / 2;
|
|
83578
|
+
_this.getBody().shadow.camera.left = -d;
|
|
83579
|
+
_this.getBody().shadow.camera.right = d;
|
|
83580
|
+
_this.getBody().shadow.camera.top = d;
|
|
83581
|
+
_this.getBody().shadow.camera.bottom = -d;
|
|
83582
|
+
_this.getBody().shadow.camera.near = near;
|
|
83583
|
+
_this.getBody().shadow.camera.far = far;
|
|
83584
|
+
});
|
|
83585
|
+
|
|
83586
|
+
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
83587
|
+
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS$1;
|
|
83588
|
+
_this.bias = bias;
|
|
83589
|
+
_this.getBody().shadow.bias = bias;
|
|
83590
|
+
});
|
|
83591
|
+
|
|
83503
83592
|
_this.options = options;
|
|
83504
83593
|
|
|
83505
83594
|
_this.setLight({
|
|
@@ -83535,8 +83624,10 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
83535
83624
|
});
|
|
83536
83625
|
} else {
|
|
83537
83626
|
this.setBody({
|
|
83538
|
-
body: new PointLight$1(color, intensity
|
|
83627
|
+
body: new PointLight$1(color, intensity)
|
|
83539
83628
|
});
|
|
83629
|
+
this.setDistance(distance);
|
|
83630
|
+
this.setDecay(decay);
|
|
83540
83631
|
}
|
|
83541
83632
|
|
|
83542
83633
|
if (this.hasBody()) {
|
|
@@ -83566,19 +83657,62 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
83566
83657
|
bias = _this$options$bias === void 0 ? DEFAULT_BIAS$1 : _this$options$bias;
|
|
83567
83658
|
|
|
83568
83659
|
if (Config$1.lights().shadows) {
|
|
83569
|
-
this.
|
|
83570
|
-
|
|
83571
|
-
this.
|
|
83572
|
-
this.
|
|
83573
|
-
this.body.shadow.camera.left = -d;
|
|
83574
|
-
this.body.shadow.camera.right = d;
|
|
83575
|
-
this.body.shadow.camera.top = d;
|
|
83576
|
-
this.body.shadow.camera.bottom = -d;
|
|
83577
|
-
this.body.shadow.camera.near = near;
|
|
83578
|
-
this.body.shadow.camera.far = far;
|
|
83579
|
-
this.body.shadow.bias = bias;
|
|
83660
|
+
this.setCastShadow(true);
|
|
83661
|
+
this.setMapSize(mapSize);
|
|
83662
|
+
this.setShadowCameraNearFar(near, far);
|
|
83663
|
+
this.setBias(bias);
|
|
83580
83664
|
}
|
|
83581
83665
|
}
|
|
83666
|
+
}, {
|
|
83667
|
+
key: "setDistance",
|
|
83668
|
+
value: function setDistance() {
|
|
83669
|
+
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DISTANCE;
|
|
83670
|
+
this.distance = distance;
|
|
83671
|
+
this.getBody().distance = distance;
|
|
83672
|
+
}
|
|
83673
|
+
}, {
|
|
83674
|
+
key: "getDistance",
|
|
83675
|
+
value: function getDistance() {
|
|
83676
|
+
return this.distance;
|
|
83677
|
+
}
|
|
83678
|
+
}, {
|
|
83679
|
+
key: "setDecay",
|
|
83680
|
+
value: function setDecay() {
|
|
83681
|
+
var decay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_DECAY;
|
|
83682
|
+
this.decay = decay;
|
|
83683
|
+
this.getBody().decay = decay;
|
|
83684
|
+
}
|
|
83685
|
+
}, {
|
|
83686
|
+
key: "getDecay",
|
|
83687
|
+
value: function getDecay() {
|
|
83688
|
+
return this.decay;
|
|
83689
|
+
}
|
|
83690
|
+
}, {
|
|
83691
|
+
key: "getShadowCameraNearFar",
|
|
83692
|
+
value: function getShadowCameraNearFar() {
|
|
83693
|
+
return {
|
|
83694
|
+
near: this.near,
|
|
83695
|
+
far: this.far
|
|
83696
|
+
};
|
|
83697
|
+
}
|
|
83698
|
+
}, {
|
|
83699
|
+
key: "setMapSize",
|
|
83700
|
+
value: function setMapSize() {
|
|
83701
|
+
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE$1;
|
|
83702
|
+
this.mapSize = mapSize;
|
|
83703
|
+
this.getBody().shadow.mapSize.height = mapSize;
|
|
83704
|
+
this.getBody().shadow.mapSize.width = mapSize;
|
|
83705
|
+
}
|
|
83706
|
+
}, {
|
|
83707
|
+
key: "getMapSize",
|
|
83708
|
+
value: function getMapSize() {
|
|
83709
|
+
return this.mapSize;
|
|
83710
|
+
}
|
|
83711
|
+
}, {
|
|
83712
|
+
key: "getBias",
|
|
83713
|
+
value: function getBias() {
|
|
83714
|
+
return this.bias;
|
|
83715
|
+
}
|
|
83582
83716
|
}, {
|
|
83583
83717
|
key: "addHelpers",
|
|
83584
83718
|
value: function addHelpers() {
|
|
@@ -83615,7 +83749,11 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
83615
83749
|
key: "toJSON",
|
|
83616
83750
|
value: function toJSON() {
|
|
83617
83751
|
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(PointLight.prototype), "toJSON", this).call(this)), {}, {
|
|
83618
|
-
distance: this.
|
|
83752
|
+
distance: this.getDistance(),
|
|
83753
|
+
decay: this.getDecay(),
|
|
83754
|
+
bias: this.getBias(),
|
|
83755
|
+
mapSize: this.getMapSize(),
|
|
83756
|
+
shadowCamera: this.getShadowCameraNearFar()
|
|
83619
83757
|
});
|
|
83620
83758
|
}
|
|
83621
83759
|
}]);
|
|
@@ -91430,11 +91568,6 @@ var DEFAULT_POSITION = {
|
|
|
91430
91568
|
y: 0,
|
|
91431
91569
|
z: 0
|
|
91432
91570
|
};
|
|
91433
|
-
var DEFAULT_TARGET_POSITION = {
|
|
91434
|
-
x: 0,
|
|
91435
|
-
y: 0,
|
|
91436
|
-
z: 0
|
|
91437
|
-
};
|
|
91438
91571
|
var DEFAULT_INTENSITY$1 = 0.5;
|
|
91439
91572
|
var DEFAULT_MAP_SIZE = 2048;
|
|
91440
91573
|
var DEFAULT_BIAS = -0.0001;
|
|
@@ -91475,6 +91608,27 @@ var SpotLight = /*#__PURE__*/function (_Light) {
|
|
|
91475
91608
|
intensity: intensity,
|
|
91476
91609
|
name: name
|
|
91477
91610
|
});
|
|
91611
|
+
|
|
91612
|
+
_defineProperty$1(_assertThisInitialized(_this), "setShadowCameraNearFar", function () {
|
|
91613
|
+
var near = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_NEAR;
|
|
91614
|
+
var far = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_FAR;
|
|
91615
|
+
_this.near = near;
|
|
91616
|
+
_this.far = far;
|
|
91617
|
+
var d = _this.far / 2;
|
|
91618
|
+
_this.getBody().shadow.camera.left = -d;
|
|
91619
|
+
_this.getBody().shadow.camera.right = d;
|
|
91620
|
+
_this.getBody().shadow.camera.top = d;
|
|
91621
|
+
_this.getBody().shadow.camera.bottom = -d;
|
|
91622
|
+
_this.getBody().shadow.camera.near = near;
|
|
91623
|
+
_this.getBody().shadow.camera.far = far;
|
|
91624
|
+
});
|
|
91625
|
+
|
|
91626
|
+
_defineProperty$1(_assertThisInitialized(_this), "setBias", function () {
|
|
91627
|
+
var bias = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_BIAS;
|
|
91628
|
+
_this.bias = bias;
|
|
91629
|
+
_this.getBody().shadow.bias = bias;
|
|
91630
|
+
});
|
|
91631
|
+
|
|
91478
91632
|
_this.options = options;
|
|
91479
91633
|
|
|
91480
91634
|
_this.setLight({
|
|
@@ -91517,8 +91671,12 @@ var SpotLight = /*#__PURE__*/function (_Light) {
|
|
|
91517
91671
|
});
|
|
91518
91672
|
} else {
|
|
91519
91673
|
this.setBody({
|
|
91520
|
-
body: new SpotLight$1(color, intensity
|
|
91674
|
+
body: new SpotLight$1(color, intensity)
|
|
91521
91675
|
});
|
|
91676
|
+
this.setDistance(distance);
|
|
91677
|
+
this.setAngle(angle);
|
|
91678
|
+
this.setPenumbra(penumbra);
|
|
91679
|
+
this.setDecay(decay);
|
|
91522
91680
|
}
|
|
91523
91681
|
|
|
91524
91682
|
if (this.hasBody()) {
|
|
@@ -91528,60 +91686,120 @@ var SpotLight = /*#__PURE__*/function (_Light) {
|
|
|
91528
91686
|
}, {
|
|
91529
91687
|
key: "postLightCreation",
|
|
91530
91688
|
value: function postLightCreation() {
|
|
91531
|
-
var _this$options = this.options,
|
|
91532
|
-
_this$options$positio
|
|
91533
|
-
|
|
91534
|
-
|
|
91535
|
-
|
|
91689
|
+
var _this$options$positio = this.options.position,
|
|
91690
|
+
position = _this$options$positio === void 0 ? DEFAULT_POSITION : _this$options$positio;
|
|
91691
|
+
var emptyTarget = new Element$1({
|
|
91692
|
+
body: new Object3D()
|
|
91693
|
+
});
|
|
91536
91694
|
this.setPosition(position);
|
|
91537
|
-
this.
|
|
91695
|
+
this.setTarget(emptyTarget);
|
|
91538
91696
|
this.setLightShadows();
|
|
91539
91697
|
this.addToScene();
|
|
91540
91698
|
}
|
|
91541
91699
|
}, {
|
|
91542
91700
|
key: "setLightShadows",
|
|
91543
91701
|
value: function setLightShadows() {
|
|
91544
|
-
var _this$
|
|
91545
|
-
_this$
|
|
91546
|
-
near = _this$
|
|
91547
|
-
_this$
|
|
91548
|
-
far = _this$
|
|
91549
|
-
_this$
|
|
91550
|
-
mapSize = _this$
|
|
91551
|
-
_this$
|
|
91552
|
-
bias = _this$
|
|
91702
|
+
var _this$options = this.options,
|
|
91703
|
+
_this$options$near = _this$options.near,
|
|
91704
|
+
near = _this$options$near === void 0 ? DEFAULT_NEAR : _this$options$near,
|
|
91705
|
+
_this$options$far = _this$options.far,
|
|
91706
|
+
far = _this$options$far === void 0 ? DEFAULT_FAR : _this$options$far,
|
|
91707
|
+
_this$options$mapSize = _this$options.mapSize,
|
|
91708
|
+
mapSize = _this$options$mapSize === void 0 ? DEFAULT_MAP_SIZE : _this$options$mapSize,
|
|
91709
|
+
_this$options$bias = _this$options.bias,
|
|
91710
|
+
bias = _this$options$bias === void 0 ? DEFAULT_BIAS : _this$options$bias;
|
|
91553
91711
|
|
|
91554
91712
|
if (Config$1.lights().shadows) {
|
|
91555
|
-
this.
|
|
91556
|
-
|
|
91557
|
-
this.
|
|
91558
|
-
this.
|
|
91559
|
-
|
|
91560
|
-
|
|
91561
|
-
|
|
91562
|
-
|
|
91563
|
-
|
|
91564
|
-
|
|
91565
|
-
|
|
91566
|
-
|
|
91567
|
-
}
|
|
91568
|
-
}, {
|
|
91569
|
-
key: "
|
|
91570
|
-
value: function
|
|
91571
|
-
|
|
91572
|
-
|
|
91573
|
-
|
|
91574
|
-
|
|
91575
|
-
|
|
91576
|
-
|
|
91577
|
-
|
|
91578
|
-
|
|
91579
|
-
|
|
91580
|
-
|
|
91581
|
-
|
|
91582
|
-
|
|
91583
|
-
|
|
91584
|
-
|
|
91713
|
+
this.setCastShadow(true);
|
|
91714
|
+
this.setMapSize(mapSize);
|
|
91715
|
+
this.setShadowCameraNearFar(near, far);
|
|
91716
|
+
this.setBias(bias);
|
|
91717
|
+
}
|
|
91718
|
+
}
|
|
91719
|
+
}, {
|
|
91720
|
+
key: "setDistance",
|
|
91721
|
+
value: function setDistance() {
|
|
91722
|
+
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_FAR;
|
|
91723
|
+
this.distance = distance;
|
|
91724
|
+
this.getBody().distance = distance;
|
|
91725
|
+
}
|
|
91726
|
+
}, {
|
|
91727
|
+
key: "getDistance",
|
|
91728
|
+
value: function getDistance() {
|
|
91729
|
+
return this.distance;
|
|
91730
|
+
}
|
|
91731
|
+
}, {
|
|
91732
|
+
key: "setAngle",
|
|
91733
|
+
value: function setAngle() {
|
|
91734
|
+
var angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_SPOTLIGHT_ANGLE;
|
|
91735
|
+
this.angle = angle;
|
|
91736
|
+
this.getBody().angle = angle;
|
|
91737
|
+
}
|
|
91738
|
+
}, {
|
|
91739
|
+
key: "getAngle",
|
|
91740
|
+
value: function getAngle() {
|
|
91741
|
+
return this.angle;
|
|
91742
|
+
}
|
|
91743
|
+
}, {
|
|
91744
|
+
key: "setPenumbra",
|
|
91745
|
+
value: function setPenumbra() {
|
|
91746
|
+
var penumbra = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_SPOTLIGHT_PENUMBRA;
|
|
91747
|
+
this.penumbra = penumbra;
|
|
91748
|
+
this.getBody().penumbra = penumbra;
|
|
91749
|
+
}
|
|
91750
|
+
}, {
|
|
91751
|
+
key: "getPenumbra",
|
|
91752
|
+
value: function getPenumbra() {
|
|
91753
|
+
return this.penumbra;
|
|
91754
|
+
}
|
|
91755
|
+
}, {
|
|
91756
|
+
key: "setDecay",
|
|
91757
|
+
value: function setDecay() {
|
|
91758
|
+
var decay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_SPOTLIGHT_DECAY;
|
|
91759
|
+
this.decay = decay;
|
|
91760
|
+
this.getBody().decay = decay;
|
|
91761
|
+
}
|
|
91762
|
+
}, {
|
|
91763
|
+
key: "getDecay",
|
|
91764
|
+
value: function getDecay() {
|
|
91765
|
+
return this.decay;
|
|
91766
|
+
}
|
|
91767
|
+
}, {
|
|
91768
|
+
key: "getShadowCameraNearFar",
|
|
91769
|
+
value: function getShadowCameraNearFar() {
|
|
91770
|
+
return {
|
|
91771
|
+
near: this.near,
|
|
91772
|
+
far: this.far
|
|
91773
|
+
};
|
|
91774
|
+
}
|
|
91775
|
+
}, {
|
|
91776
|
+
key: "setMapSize",
|
|
91777
|
+
value: function setMapSize() {
|
|
91778
|
+
var mapSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MAP_SIZE;
|
|
91779
|
+
this.mapSize = mapSize;
|
|
91780
|
+
this.getBody().shadow.mapSize.height = mapSize;
|
|
91781
|
+
this.getBody().shadow.mapSize.width = mapSize;
|
|
91782
|
+
}
|
|
91783
|
+
}, {
|
|
91784
|
+
key: "getMapSize",
|
|
91785
|
+
value: function getMapSize() {
|
|
91786
|
+
return this.mapSize;
|
|
91787
|
+
}
|
|
91788
|
+
}, {
|
|
91789
|
+
key: "getBias",
|
|
91790
|
+
value: function getBias() {
|
|
91791
|
+
return this.bias;
|
|
91792
|
+
}
|
|
91793
|
+
}, {
|
|
91794
|
+
key: "setTarget",
|
|
91795
|
+
value: function setTarget(target) {
|
|
91796
|
+
this.target = target;
|
|
91797
|
+
this.getBody().target = target.getBody();
|
|
91798
|
+
Scene$1.add(this.getBody().target, null, false);
|
|
91799
|
+
}
|
|
91800
|
+
}, {
|
|
91801
|
+
key: "getTarget",
|
|
91802
|
+
value: function getTarget() {
|
|
91585
91803
|
return this.target;
|
|
91586
91804
|
}
|
|
91587
91805
|
}, {
|
|
@@ -91630,7 +91848,14 @@ var SpotLight = /*#__PURE__*/function (_Light) {
|
|
|
91630
91848
|
key: "toJSON",
|
|
91631
91849
|
value: function toJSON() {
|
|
91632
91850
|
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(SpotLight.prototype), "toJSON", this).call(this)), {}, {
|
|
91633
|
-
target: this.
|
|
91851
|
+
target: this.getTarget(),
|
|
91852
|
+
distance: this.getDistance(),
|
|
91853
|
+
decay: this.getDecay(),
|
|
91854
|
+
bias: this.getBias(),
|
|
91855
|
+
mapSize: this.getMapSize(),
|
|
91856
|
+
shadowCamera: this.getShadowCameraNearFar(),
|
|
91857
|
+
penumbra: this.getPenumbra(),
|
|
91858
|
+
angle: this.getAngle()
|
|
91634
91859
|
});
|
|
91635
91860
|
}
|
|
91636
91861
|
}]);
|
|
@@ -91667,6 +91892,23 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
|
|
|
91667
91892
|
intensity: intensity,
|
|
91668
91893
|
name: name
|
|
91669
91894
|
});
|
|
91895
|
+
|
|
91896
|
+
_defineProperty$1(_assertThisInitialized(_this), "setColor", function () {
|
|
91897
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91898
|
+
sky = _ref.sky,
|
|
91899
|
+
ground = _ref.ground;
|
|
91900
|
+
|
|
91901
|
+
_this.getBody().color = sky;
|
|
91902
|
+
_this.getBody().groundColor = ground;
|
|
91903
|
+
});
|
|
91904
|
+
|
|
91905
|
+
_defineProperty$1(_assertThisInitialized(_this), "getColor", function () {
|
|
91906
|
+
return {
|
|
91907
|
+
sky: _this.getBody().color,
|
|
91908
|
+
ground: _this.getBody().groundColor
|
|
91909
|
+
};
|
|
91910
|
+
});
|
|
91911
|
+
|
|
91670
91912
|
_this.options = options;
|
|
91671
91913
|
|
|
91672
91914
|
_this.setLight({
|
|
@@ -91683,15 +91925,15 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
|
|
|
91683
91925
|
|
|
91684
91926
|
_createClass(HemisphereLight, [{
|
|
91685
91927
|
key: "setLight",
|
|
91686
|
-
value: function setLight(
|
|
91687
|
-
var light =
|
|
91688
|
-
|
|
91689
|
-
color =
|
|
91928
|
+
value: function setLight(_ref2) {
|
|
91929
|
+
var light = _ref2.light,
|
|
91930
|
+
_ref2$color = _ref2.color,
|
|
91931
|
+
color = _ref2$color === void 0 ? {
|
|
91690
91932
|
sky: DEFAULT_SKY_COLOR,
|
|
91691
91933
|
ground: DEFAULT_GROUND_COLOR
|
|
91692
|
-
} :
|
|
91693
|
-
|
|
91694
|
-
intensity =
|
|
91934
|
+
} : _ref2$color,
|
|
91935
|
+
_ref2$intensity = _ref2.intensity,
|
|
91936
|
+
intensity = _ref2$intensity === void 0 ? DEFAULT_INTENSITY : _ref2$intensity;
|
|
91695
91937
|
|
|
91696
91938
|
if (light) {
|
|
91697
91939
|
this.setBody({
|
|
@@ -91714,11 +91956,11 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
|
|
|
91714
91956
|
}, {
|
|
91715
91957
|
key: "addHelpers",
|
|
91716
91958
|
value: function addHelpers() {
|
|
91717
|
-
var
|
|
91718
|
-
|
|
91719
|
-
holderName =
|
|
91720
|
-
|
|
91721
|
-
holderSize =
|
|
91959
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
91960
|
+
_ref3$holderName = _ref3.holderName,
|
|
91961
|
+
holderName = _ref3$holderName === void 0 ? "hemispherelightholder" : _ref3$holderName,
|
|
91962
|
+
_ref3$holderSize = _ref3.holderSize,
|
|
91963
|
+
holderSize = _ref3$holderSize === void 0 ? 0.05 : _ref3$holderSize;
|
|
91722
91964
|
|
|
91723
91965
|
this.helper = new HemisphereLightHelper(this.getBody(), 2, GREEN);
|
|
91724
91966
|
this.addHolder(holderName, holderSize);
|
|
@@ -91736,6 +91978,13 @@ var HemisphereLight = /*#__PURE__*/function (_Light) {
|
|
|
91736
91978
|
});
|
|
91737
91979
|
}
|
|
91738
91980
|
}
|
|
91981
|
+
}, {
|
|
91982
|
+
key: "toJSON",
|
|
91983
|
+
value: function toJSON() {
|
|
91984
|
+
return _objectSpread2$1(_objectSpread2$1({}, _get(_getPrototypeOf(HemisphereLight.prototype), "toJSON", this).call(this)), {}, {
|
|
91985
|
+
color: this.getColor()
|
|
91986
|
+
});
|
|
91987
|
+
}
|
|
91739
91988
|
}]);
|
|
91740
91989
|
|
|
91741
91990
|
return HemisphereLight;
|