@galacean/engine 1.1.0-beta.3 → 1.1.0-beta.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/dist/browser.js +273 -183
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -7477,8 +7477,8 @@
|
|
|
7477
7477
|
var _this;
|
|
7478
7478
|
_this = EngineObject1.call(this, entity.engine) || this;
|
|
7479
7479
|
/** @internal */ _this._awoken = false;
|
|
7480
|
-
_this._phasedActive = false;
|
|
7481
7480
|
_this._phasedActiveInScene = false;
|
|
7481
|
+
_this._phasedActive = false;
|
|
7482
7482
|
_this._enabled = true;
|
|
7483
7483
|
_this._entity = entity;
|
|
7484
7484
|
return _this;
|
|
@@ -7611,10 +7611,10 @@
|
|
|
7611
7611
|
], Component.prototype, "_awoken", void 0);
|
|
7612
7612
|
__decorate$1([
|
|
7613
7613
|
ignoreClone
|
|
7614
|
-
], Component.prototype, "
|
|
7614
|
+
], Component.prototype, "_phasedActiveInScene", void 0);
|
|
7615
7615
|
__decorate$1([
|
|
7616
7616
|
ignoreClone
|
|
7617
|
-
], Component.prototype, "
|
|
7617
|
+
], Component.prototype, "_phasedActive", void 0);
|
|
7618
7618
|
__decorate$1([
|
|
7619
7619
|
assignmentClone
|
|
7620
7620
|
], Component.prototype, "_enabled", void 0);
|
|
@@ -17091,7 +17091,7 @@
|
|
|
17091
17091
|
_proto.drawBatches = function drawBatches(camera) {
|
|
17092
17092
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
17093
17093
|
var mesh = this._meshes[this._flushId];
|
|
17094
|
-
var subMeshes = mesh.subMeshes;
|
|
17094
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
17095
17095
|
var sceneData = camera.scene.shaderData;
|
|
17096
17096
|
var cameraData = camera.shaderData;
|
|
17097
17097
|
for(var i = 0, len = subMeshes.length; i < len; i++){
|
|
@@ -17123,7 +17123,7 @@
|
|
|
17123
17123
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
17124
17124
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
17125
17125
|
material.renderState._apply(engine, false, pass._renderStateDataMap, material.shaderData);
|
|
17126
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
17126
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
17127
17127
|
}
|
|
17128
17128
|
};
|
|
17129
17129
|
return SpriteMaskBatcher;
|
|
@@ -17362,16 +17362,31 @@
|
|
|
17362
17362
|
};
|
|
17363
17363
|
var _proto = SceneManager.prototype;
|
|
17364
17364
|
_proto.addScene = function addScene(indexOrScene, scene) {
|
|
17365
|
+
var scenes = this._scenes;
|
|
17366
|
+
var index;
|
|
17365
17367
|
if (typeof indexOrScene === "number") {
|
|
17366
|
-
|
|
17368
|
+
if (indexOrScene < 0 || indexOrScene > scenes.length) {
|
|
17369
|
+
throw "The index is out of range.";
|
|
17370
|
+
}
|
|
17371
|
+
index = indexOrScene;
|
|
17367
17372
|
} else {
|
|
17373
|
+
index = scenes.length;
|
|
17368
17374
|
scene = indexOrScene;
|
|
17369
|
-
this._scenes.push(scene);
|
|
17370
17375
|
}
|
|
17371
17376
|
if (scene.engine !== this.engine) {
|
|
17372
17377
|
throw "The scene is not belong to this engine.";
|
|
17373
17378
|
}
|
|
17374
|
-
scene.
|
|
17379
|
+
if (scene._sceneManager) {
|
|
17380
|
+
var currentIndex = scenes.indexOf(scene);
|
|
17381
|
+
if (currentIndex !== index) {
|
|
17382
|
+
scenes.removeByIndex(currentIndex);
|
|
17383
|
+
scenes.add(index, scene);
|
|
17384
|
+
}
|
|
17385
|
+
} else {
|
|
17386
|
+
scene._sceneManager = this;
|
|
17387
|
+
scenes.add(index, scene);
|
|
17388
|
+
scene.isActive && scene._processActive(true);
|
|
17389
|
+
}
|
|
17375
17390
|
};
|
|
17376
17391
|
/**
|
|
17377
17392
|
* Remove scene.
|
|
@@ -17382,7 +17397,8 @@
|
|
|
17382
17397
|
if (index !== -1) {
|
|
17383
17398
|
var removedScene = scenes.getArray()[index];
|
|
17384
17399
|
scenes.removeByIndex(index);
|
|
17385
|
-
|
|
17400
|
+
scene._sceneManager = null;
|
|
17401
|
+
removedScene.isActive && removedScene._processActive(false);
|
|
17386
17402
|
}
|
|
17387
17403
|
};
|
|
17388
17404
|
/**
|
|
@@ -18574,9 +18590,9 @@
|
|
|
18574
18590
|
oldCollider.removeShape(shape);
|
|
18575
18591
|
}
|
|
18576
18592
|
this._shapes.push(shape);
|
|
18577
|
-
this.scene.physics._addColliderShape(shape);
|
|
18578
18593
|
shape._collider = this;
|
|
18579
18594
|
this._nativeCollider.addShape(shape._nativeShape);
|
|
18595
|
+
this._phasedActiveInScene && this.scene.physics._addColliderShape(shape);
|
|
18580
18596
|
}
|
|
18581
18597
|
};
|
|
18582
18598
|
/**
|
|
@@ -18586,7 +18602,7 @@
|
|
|
18586
18602
|
var index = this._shapes.indexOf(shape);
|
|
18587
18603
|
if (index !== -1) {
|
|
18588
18604
|
this._shapes.splice(index, 1);
|
|
18589
|
-
this.scene.physics._removeColliderShape(shape);
|
|
18605
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
18590
18606
|
shape._collider = null;
|
|
18591
18607
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
18592
18608
|
}
|
|
@@ -18597,7 +18613,7 @@
|
|
|
18597
18613
|
var shapes = this._shapes;
|
|
18598
18614
|
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18599
18615
|
var shape = shapes[i];
|
|
18600
|
-
this.scene.physics._removeColliderShape(shape);
|
|
18616
|
+
this._phasedActiveInScene && this.scene.physics._removeColliderShape(shape);
|
|
18601
18617
|
shape._destroy();
|
|
18602
18618
|
this._nativeCollider.removeShape(shape._nativeShape);
|
|
18603
18619
|
}
|
|
@@ -18622,12 +18638,22 @@
|
|
|
18622
18638
|
/**
|
|
18623
18639
|
* @internal
|
|
18624
18640
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
18625
|
-
this.scene.physics
|
|
18641
|
+
var physics = this.scene.physics;
|
|
18642
|
+
physics._addCollider(this);
|
|
18643
|
+
var shapes = this.shapes;
|
|
18644
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18645
|
+
physics._addColliderShape(shapes[i]);
|
|
18646
|
+
}
|
|
18626
18647
|
};
|
|
18627
18648
|
/**
|
|
18628
18649
|
* @internal
|
|
18629
18650
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
18630
|
-
this.scene.physics
|
|
18651
|
+
var physics = this.scene.physics;
|
|
18652
|
+
physics._removeCollider(this);
|
|
18653
|
+
var shapes = this.shapes;
|
|
18654
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
18655
|
+
physics._removeColliderShape(shapes[i]);
|
|
18656
|
+
}
|
|
18631
18657
|
};
|
|
18632
18658
|
/**
|
|
18633
18659
|
* @internal
|
|
@@ -19000,12 +19026,22 @@
|
|
|
19000
19026
|
/**
|
|
19001
19027
|
* @internal
|
|
19002
19028
|
*/ _proto._onEnableInScene = function _onEnableInScene() {
|
|
19003
|
-
this.scene.physics
|
|
19029
|
+
var physics = this.scene.physics;
|
|
19030
|
+
physics._addCharacterController(this);
|
|
19031
|
+
var shapes = this.shapes;
|
|
19032
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
19033
|
+
physics._addColliderShape(shapes[i]);
|
|
19034
|
+
}
|
|
19004
19035
|
};
|
|
19005
19036
|
/**
|
|
19006
19037
|
* @internal
|
|
19007
19038
|
*/ _proto._onDisableInScene = function _onDisableInScene() {
|
|
19008
|
-
this.scene.physics
|
|
19039
|
+
var physics = this.scene.physics;
|
|
19040
|
+
physics._removeCharacterController(this);
|
|
19041
|
+
var shapes = this.shapes;
|
|
19042
|
+
for(var i = 0, n = shapes.length; i < n; i++){
|
|
19043
|
+
physics._removeColliderShape(shapes[i]);
|
|
19044
|
+
}
|
|
19009
19045
|
};
|
|
19010
19046
|
_proto._setUpDirection = function _setUpDirection() {
|
|
19011
19047
|
this._nativeCollider.setUpDirection(this._upDirection);
|
|
@@ -21105,10 +21141,6 @@
|
|
|
21105
21141
|
magentaMaterial.isGCIgnored = true;
|
|
21106
21142
|
magentaMaterial.shaderData.setColor("material_BaseColor", new Color(1.0, 0.0, 1.01, 1.0));
|
|
21107
21143
|
_this._magentaMaterial = magentaMaterial;
|
|
21108
|
-
var backgroundTextureMaterial = new Material(_assert_this_initialized(_this), Shader.find("background-texture"));
|
|
21109
|
-
backgroundTextureMaterial.isGCIgnored = true;
|
|
21110
|
-
backgroundTextureMaterial.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
21111
|
-
_this._backgroundTextureMaterial = backgroundTextureMaterial;
|
|
21112
21144
|
var innerSettings = _this._settings;
|
|
21113
21145
|
var colorSpace = configuration.colorSpace || exports.ColorSpace.Linear;
|
|
21114
21146
|
colorSpace === exports.ColorSpace.Gamma && _this._macroCollection.enable(Engine._gammaMacro);
|
|
@@ -21722,6 +21754,7 @@
|
|
|
21722
21754
|
this./** @internal */ _textureFillMode = exports.BackgroundTextureFillMode.AspectFitHeight;
|
|
21723
21755
|
this._texture = null;
|
|
21724
21756
|
this._initMesh(_engine);
|
|
21757
|
+
this._initMaterial(_engine);
|
|
21725
21758
|
};
|
|
21726
21759
|
var _proto = Background.prototype;
|
|
21727
21760
|
/**
|
|
@@ -21729,19 +21762,14 @@
|
|
|
21729
21762
|
*/ _proto.destroy = function destroy() {
|
|
21730
21763
|
this._mesh._addReferCount(-1);
|
|
21731
21764
|
this._mesh = null;
|
|
21765
|
+
this._material._addReferCount(-1);
|
|
21766
|
+
this._material = null;
|
|
21732
21767
|
this.texture = null;
|
|
21733
21768
|
this.solidColor = null;
|
|
21734
21769
|
this.sky.destroy();
|
|
21735
21770
|
};
|
|
21736
21771
|
/**
|
|
21737
21772
|
* @internal
|
|
21738
|
-
* Standalone for CanvasRenderer plugin.
|
|
21739
|
-
*/ _proto._initMesh = function _initMesh(engine) {
|
|
21740
|
-
this._mesh = this._createPlane(engine);
|
|
21741
|
-
this._mesh._addReferCount(1);
|
|
21742
|
-
};
|
|
21743
|
-
/**
|
|
21744
|
-
* @internal
|
|
21745
21773
|
*/ _proto._resizeBackgroundTexture = function _resizeBackgroundTexture() {
|
|
21746
21774
|
if (!this._texture) {
|
|
21747
21775
|
return;
|
|
@@ -21775,6 +21803,15 @@
|
|
|
21775
21803
|
_backgroundTextureMesh.setPositions(positions);
|
|
21776
21804
|
_backgroundTextureMesh.uploadData(false);
|
|
21777
21805
|
};
|
|
21806
|
+
_proto._initMesh = function _initMesh(engine) {
|
|
21807
|
+
this._mesh = this._createPlane(engine);
|
|
21808
|
+
this._mesh._addReferCount(1);
|
|
21809
|
+
};
|
|
21810
|
+
_proto._initMaterial = function _initMaterial(engine) {
|
|
21811
|
+
var material = this._material = new Material(engine, Shader.find("background-texture"));
|
|
21812
|
+
material.renderState.depthState.compareFunction = exports.CompareFunction.LessEqual;
|
|
21813
|
+
material._addReferCount(1);
|
|
21814
|
+
};
|
|
21778
21815
|
_proto._createPlane = function _createPlane(engine) {
|
|
21779
21816
|
var mesh = new ModelMesh(engine);
|
|
21780
21817
|
mesh.isGCIgnored = true;
|
|
@@ -21814,7 +21851,7 @@
|
|
|
21814
21851
|
(_value = value) == null ? void 0 : _value._addReferCount(1);
|
|
21815
21852
|
(_this__texture = this._texture) == null ? void 0 : _this__texture._addReferCount(-1);
|
|
21816
21853
|
this._texture = value;
|
|
21817
|
-
this.
|
|
21854
|
+
this._material.shaderData.setTexture("material_BaseTexture", value);
|
|
21818
21855
|
}
|
|
21819
21856
|
}
|
|
21820
21857
|
},
|
|
@@ -22381,11 +22418,6 @@
|
|
|
22381
22418
|
]);
|
|
22382
22419
|
return Light;
|
|
22383
22420
|
}(Component);
|
|
22384
|
-
(function() {
|
|
22385
|
-
/**
|
|
22386
|
-
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
22387
|
-
* */ Light._maxLight = 10;
|
|
22388
|
-
})();
|
|
22389
22421
|
__decorate$1([
|
|
22390
22422
|
ignoreClone
|
|
22391
22423
|
], Light.prototype, "_lightIndex", void 0);
|
|
@@ -22402,13 +22434,12 @@
|
|
|
22402
22434
|
var _proto = DirectLight.prototype;
|
|
22403
22435
|
/**
|
|
22404
22436
|
* @internal
|
|
22405
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
22437
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
22406
22438
|
var cullingMaskStart = lightIndex * 2;
|
|
22407
22439
|
var colorStart = lightIndex * 3;
|
|
22408
22440
|
var directionStart = lightIndex * 3;
|
|
22409
22441
|
var lightColor = this._getLightIntensityColor();
|
|
22410
22442
|
var direction = this.direction;
|
|
22411
|
-
var data = DirectLight._combinedData;
|
|
22412
22443
|
var cullingMask = this.cullingMask;
|
|
22413
22444
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
22414
22445
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -22437,8 +22468,7 @@
|
|
|
22437
22468
|
};
|
|
22438
22469
|
/**
|
|
22439
22470
|
* @internal
|
|
22440
|
-
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
22441
|
-
var data = DirectLight._combinedData;
|
|
22471
|
+
*/ DirectLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
22442
22472
|
shaderData.setIntArray(DirectLight._cullingMaskProperty, data.cullingMask);
|
|
22443
22473
|
shaderData.setFloatArray(DirectLight._colorProperty, data.color);
|
|
22444
22474
|
shaderData.setFloatArray(DirectLight._directionProperty, data.direction);
|
|
@@ -22481,13 +22511,6 @@
|
|
|
22481
22511
|
(function() {
|
|
22482
22512
|
DirectLight._directionProperty = ShaderProperty.getByName("scene_DirectLightDirection");
|
|
22483
22513
|
})();
|
|
22484
|
-
(function() {
|
|
22485
|
-
DirectLight._combinedData = {
|
|
22486
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
22487
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
22488
|
-
direction: new Float32Array(Light._maxLight * 3)
|
|
22489
|
-
};
|
|
22490
|
-
})();
|
|
22491
22514
|
/**
|
|
22492
22515
|
* Point light.
|
|
22493
22516
|
*/ var PointLight = /*#__PURE__*/ function(Light1) {
|
|
@@ -22501,14 +22524,13 @@
|
|
|
22501
22524
|
var _proto = PointLight.prototype;
|
|
22502
22525
|
/**
|
|
22503
22526
|
* @internal
|
|
22504
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
22527
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
22505
22528
|
var cullingMaskStart = lightIndex * 2;
|
|
22506
22529
|
var colorStart = lightIndex * 3;
|
|
22507
22530
|
var positionStart = lightIndex * 3;
|
|
22508
22531
|
var distanceStart = lightIndex;
|
|
22509
22532
|
var lightColor = this._getLightIntensityColor();
|
|
22510
22533
|
var lightPosition = this.position;
|
|
22511
|
-
var data = PointLight._combinedData;
|
|
22512
22534
|
var cullingMask = this.cullingMask;
|
|
22513
22535
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
22514
22536
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -22538,8 +22560,7 @@
|
|
|
22538
22560
|
};
|
|
22539
22561
|
/**
|
|
22540
22562
|
* @internal
|
|
22541
|
-
*/ PointLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
22542
|
-
var data = PointLight._combinedData;
|
|
22563
|
+
*/ PointLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
22543
22564
|
shaderData.setIntArray(PointLight._cullingMaskProperty, data.cullingMask);
|
|
22544
22565
|
shaderData.setFloatArray(PointLight._colorProperty, data.color);
|
|
22545
22566
|
shaderData.setFloatArray(PointLight._positionProperty, data.position);
|
|
@@ -22577,14 +22598,6 @@
|
|
|
22577
22598
|
(function() {
|
|
22578
22599
|
PointLight._distanceProperty = ShaderProperty.getByName("scene_PointLightDistance");
|
|
22579
22600
|
})();
|
|
22580
|
-
(function() {
|
|
22581
|
-
PointLight._combinedData = {
|
|
22582
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
22583
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
22584
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
22585
|
-
distance: new Float32Array(Light._maxLight)
|
|
22586
|
-
};
|
|
22587
|
-
})();
|
|
22588
22601
|
/**
|
|
22589
22602
|
* Spot light.
|
|
22590
22603
|
*/ var SpotLight = /*#__PURE__*/ function(Light1) {
|
|
@@ -22602,7 +22615,7 @@
|
|
|
22602
22615
|
var _proto = SpotLight.prototype;
|
|
22603
22616
|
/**
|
|
22604
22617
|
* @internal
|
|
22605
|
-
*/ _proto._appendData = function _appendData(lightIndex) {
|
|
22618
|
+
*/ _proto._appendData = function _appendData(lightIndex, data) {
|
|
22606
22619
|
var cullingMaskStart = lightIndex * 2;
|
|
22607
22620
|
var colorStart = lightIndex * 3;
|
|
22608
22621
|
var positionStart = lightIndex * 3;
|
|
@@ -22613,7 +22626,6 @@
|
|
|
22613
22626
|
var lightColor = this._getLightIntensityColor();
|
|
22614
22627
|
var position = this.position;
|
|
22615
22628
|
var direction = this.direction;
|
|
22616
|
-
var data = SpotLight._combinedData;
|
|
22617
22629
|
var cullingMask = this.cullingMask;
|
|
22618
22630
|
data.cullingMask[cullingMaskStart] = cullingMask & 65535;
|
|
22619
22631
|
data.cullingMask[cullingMaskStart + 1] = cullingMask >>> 16 & 65535;
|
|
@@ -22648,8 +22660,7 @@
|
|
|
22648
22660
|
};
|
|
22649
22661
|
/**
|
|
22650
22662
|
* @internal
|
|
22651
|
-
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData) {
|
|
22652
|
-
var data = SpotLight._combinedData;
|
|
22663
|
+
*/ SpotLight._updateShaderData = function _updateShaderData(shaderData, data) {
|
|
22653
22664
|
shaderData.setIntArray(SpotLight._cullingMaskProperty, data.cullingMask);
|
|
22654
22665
|
shaderData.setFloatArray(SpotLight._colorProperty, data.color);
|
|
22655
22666
|
shaderData.setFloatArray(SpotLight._positionProperty, data.position);
|
|
@@ -22719,25 +22730,34 @@
|
|
|
22719
22730
|
(function() {
|
|
22720
22731
|
SpotLight._penumbraCosProperty = ShaderProperty.getByName("scene_SpotLightPenumbraCos");
|
|
22721
22732
|
})();
|
|
22722
|
-
(function() {
|
|
22723
|
-
SpotLight._combinedData = {
|
|
22724
|
-
cullingMask: new Int32Array(Light._maxLight * 2),
|
|
22725
|
-
color: new Float32Array(Light._maxLight * 3),
|
|
22726
|
-
position: new Float32Array(Light._maxLight * 3),
|
|
22727
|
-
direction: new Float32Array(Light._maxLight * 3),
|
|
22728
|
-
distance: new Float32Array(Light._maxLight),
|
|
22729
|
-
angleCos: new Float32Array(Light._maxLight),
|
|
22730
|
-
penumbraCos: new Float32Array(Light._maxLight)
|
|
22731
|
-
};
|
|
22732
|
-
})();
|
|
22733
22733
|
/**
|
|
22734
22734
|
* Light manager.
|
|
22735
22735
|
*/ var LightManager = /*#__PURE__*/ function() {
|
|
22736
|
-
|
|
22736
|
+
function LightManager() {
|
|
22737
22737
|
/** @internal */ this._spotLights = new DisorderedArray();
|
|
22738
22738
|
/** @internal */ this._pointLights = new DisorderedArray();
|
|
22739
22739
|
/** @internal */ this._directLights = new DisorderedArray();
|
|
22740
|
-
|
|
22740
|
+
this._directData = {
|
|
22741
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
22742
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
22743
|
+
direction: new Float32Array(LightManager._maxLight * 3)
|
|
22744
|
+
};
|
|
22745
|
+
this._pointData = {
|
|
22746
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
22747
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
22748
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
22749
|
+
distance: new Float32Array(LightManager._maxLight)
|
|
22750
|
+
};
|
|
22751
|
+
this._spotData = {
|
|
22752
|
+
cullingMask: new Int32Array(LightManager._maxLight * 2),
|
|
22753
|
+
color: new Float32Array(LightManager._maxLight * 3),
|
|
22754
|
+
position: new Float32Array(LightManager._maxLight * 3),
|
|
22755
|
+
direction: new Float32Array(LightManager._maxLight * 3),
|
|
22756
|
+
distance: new Float32Array(LightManager._maxLight),
|
|
22757
|
+
angleCos: new Float32Array(LightManager._maxLight),
|
|
22758
|
+
penumbraCos: new Float32Array(LightManager._maxLight)
|
|
22759
|
+
};
|
|
22760
|
+
}
|
|
22741
22761
|
var _proto = LightManager.prototype;
|
|
22742
22762
|
/**
|
|
22743
22763
|
* @internal
|
|
@@ -22796,38 +22816,34 @@
|
|
|
22796
22816
|
/**
|
|
22797
22817
|
* @internal
|
|
22798
22818
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
22799
|
-
var spotLight =
|
|
22800
|
-
var
|
|
22801
|
-
var directLight = this._directLights;
|
|
22819
|
+
var _this = this, spotLight = _this._spotLights, pointLight = _this._pointLights, directLight = _this._directLights;
|
|
22820
|
+
var _this1 = this, spotData = _this1._spotData, pointData = _this1._pointData, directData = _this1._directData;
|
|
22802
22821
|
var spotLightCount = spotLight.length;
|
|
22803
22822
|
var pointLightCount = pointLight.length;
|
|
22804
22823
|
var directLightCount = directLight.length;
|
|
22805
|
-
for(var i = 0
|
|
22806
|
-
|
|
22807
|
-
light._appendData(i);
|
|
22824
|
+
for(var i = 0; i < spotLightCount; i++){
|
|
22825
|
+
spotLight.get(i)._appendData(i, spotData);
|
|
22808
22826
|
}
|
|
22809
|
-
for(var i1 = 0
|
|
22810
|
-
|
|
22811
|
-
light1._appendData(i1);
|
|
22827
|
+
for(var i1 = 0; i1 < pointLightCount; i1++){
|
|
22828
|
+
pointLight.get(i1)._appendData(i1, pointData);
|
|
22812
22829
|
}
|
|
22813
|
-
for(var i2 = 0
|
|
22814
|
-
|
|
22815
|
-
light2._appendData(i2);
|
|
22830
|
+
for(var i2 = 0; i2 < directLightCount; i2++){
|
|
22831
|
+
directLight.get(i2)._appendData(i2, directData);
|
|
22816
22832
|
}
|
|
22817
22833
|
if (directLightCount) {
|
|
22818
|
-
DirectLight._updateShaderData(shaderData);
|
|
22834
|
+
DirectLight._updateShaderData(shaderData, directData);
|
|
22819
22835
|
shaderData.enableMacro("SCENE_DIRECT_LIGHT_COUNT", directLightCount.toString());
|
|
22820
22836
|
} else {
|
|
22821
22837
|
shaderData.disableMacro("SCENE_DIRECT_LIGHT_COUNT");
|
|
22822
22838
|
}
|
|
22823
22839
|
if (pointLightCount) {
|
|
22824
|
-
PointLight._updateShaderData(shaderData);
|
|
22840
|
+
PointLight._updateShaderData(shaderData, pointData);
|
|
22825
22841
|
shaderData.enableMacro("SCENE_POINT_LIGHT_COUNT", pointLightCount.toString());
|
|
22826
22842
|
} else {
|
|
22827
22843
|
shaderData.disableMacro("SCENE_POINT_LIGHT_COUNT");
|
|
22828
22844
|
}
|
|
22829
22845
|
if (spotLightCount) {
|
|
22830
|
-
SpotLight._updateShaderData(shaderData);
|
|
22846
|
+
SpotLight._updateShaderData(shaderData, spotData);
|
|
22831
22847
|
shaderData.enableMacro("SCENE_SPOT_LIGHT_COUNT", spotLightCount.toString());
|
|
22832
22848
|
} else {
|
|
22833
22849
|
shaderData.disableMacro("SCENE_SPOT_LIGHT_COUNT");
|
|
@@ -22868,6 +22884,11 @@
|
|
|
22868
22884
|
};
|
|
22869
22885
|
return LightManager;
|
|
22870
22886
|
}();
|
|
22887
|
+
(function() {
|
|
22888
|
+
/**
|
|
22889
|
+
* Each type of light source is at most 10, beyond which it will not take effect.
|
|
22890
|
+
* */ LightManager._maxLight = 10;
|
|
22891
|
+
})();
|
|
22871
22892
|
/**
|
|
22872
22893
|
* Scene.
|
|
22873
22894
|
*/ var Scene = /*#__PURE__*/ function(EngineObject1) {
|
|
@@ -22897,6 +22918,7 @@
|
|
|
22897
22918
|
_this._fogEnd = 300;
|
|
22898
22919
|
_this._fogDensity = 0.01;
|
|
22899
22920
|
_this._fogParams = new Vector4();
|
|
22921
|
+
_this._isActive = true;
|
|
22900
22922
|
_this.name = name1 || "";
|
|
22901
22923
|
var shaderData = _this.shaderData;
|
|
22902
22924
|
shaderData._addReferCount(1);
|
|
@@ -23144,6 +23166,24 @@
|
|
|
23144
23166
|
this._fogParams.w = density / Math.sqrt(Math.LN2);
|
|
23145
23167
|
};
|
|
23146
23168
|
_create_class$3(Scene, [
|
|
23169
|
+
{
|
|
23170
|
+
key: "isActive",
|
|
23171
|
+
get: /**
|
|
23172
|
+
* Whether the scene is active.
|
|
23173
|
+
*/ function get() {
|
|
23174
|
+
return this._isActive;
|
|
23175
|
+
},
|
|
23176
|
+
set: function set(value) {
|
|
23177
|
+
if (this._isActive !== value) {
|
|
23178
|
+
this._isActive = value;
|
|
23179
|
+
if (value) {
|
|
23180
|
+
this._sceneManager && this._processActive(true);
|
|
23181
|
+
} else {
|
|
23182
|
+
this._sceneManager && this._processActive(false);
|
|
23183
|
+
}
|
|
23184
|
+
}
|
|
23185
|
+
}
|
|
23186
|
+
},
|
|
23147
23187
|
{
|
|
23148
23188
|
key: "shaderData",
|
|
23149
23189
|
get: /**
|
|
@@ -23461,7 +23501,11 @@
|
|
|
23461
23501
|
* @internal
|
|
23462
23502
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
23463
23503
|
Component1.prototype._onDestroy.call(this);
|
|
23464
|
-
this.scene
|
|
23504
|
+
if (this.scene) {
|
|
23505
|
+
this.scene._componentsManager.addPendingDestroyScript(this);
|
|
23506
|
+
} else {
|
|
23507
|
+
this.onDestroy();
|
|
23508
|
+
}
|
|
23465
23509
|
};
|
|
23466
23510
|
return Script;
|
|
23467
23511
|
}(Component);
|
|
@@ -23601,7 +23645,7 @@
|
|
|
23601
23645
|
_proto.drawBatches = function drawBatches(camera) {
|
|
23602
23646
|
var _this = this, engine = _this._engine, batchedQueue = _this._batchedQueue;
|
|
23603
23647
|
var mesh = this._meshes[this._flushId];
|
|
23604
|
-
var subMeshes = mesh.subMeshes;
|
|
23648
|
+
var subMeshes = mesh.subMeshes, primitive = mesh._primitive;
|
|
23605
23649
|
var maskManager = engine._spriteMaskManager;
|
|
23606
23650
|
var sceneData = camera.scene.shaderData;
|
|
23607
23651
|
var cameraData = camera.shaderData;
|
|
@@ -23631,7 +23675,7 @@
|
|
|
23631
23675
|
program.uploadAll(program.rendererUniformBlock, renderer.shaderData);
|
|
23632
23676
|
program.uploadAll(program.materialUniformBlock, material.shaderData);
|
|
23633
23677
|
material.renderState._apply(engine, false, shaderPass._renderStateDataMap, material.shaderData);
|
|
23634
|
-
engine._hardwareRenderer.drawPrimitive(
|
|
23678
|
+
engine._hardwareRenderer.drawPrimitive(primitive, subMesh, program);
|
|
23635
23679
|
maskManager.postRender(renderer);
|
|
23636
23680
|
}
|
|
23637
23681
|
};
|
|
@@ -24998,8 +25042,8 @@
|
|
|
24998
25042
|
};
|
|
24999
25043
|
_proto._drawBackgroundTexture = function _drawBackgroundTexture(engine, background) {
|
|
25000
25044
|
var rhi = engine._hardwareRenderer;
|
|
25001
|
-
var
|
|
25002
|
-
var mesh = background._mesh;
|
|
25045
|
+
var canvas = engine.canvas;
|
|
25046
|
+
var material = background._material, mesh = background._mesh;
|
|
25003
25047
|
if ((this._lastCanvasSize.x !== canvas.width || this._lastCanvasSize.y !== canvas.height) && background._textureFillMode !== exports.BackgroundTextureFillMode.Fill) {
|
|
25004
25048
|
this._lastCanvasSize.set(canvas.width, canvas.height);
|
|
25005
25049
|
background._resizeBackgroundTexture();
|
|
@@ -25172,7 +25216,7 @@
|
|
|
25172
25216
|
// Use the intersection of the near clipping plane as the origin point.
|
|
25173
25217
|
var origin = this._innerViewportToWorldPoint(point.x, point.y, 0.0, invViewProjMat, out.origin);
|
|
25174
25218
|
// Use the intersection of the far clipping plane as the origin point.
|
|
25175
|
-
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1.
|
|
25219
|
+
var direction = this._innerViewportToWorldPoint(point.x, point.y, 1 - MathUtil$1.zeroTolerance, invViewProjMat, out.direction);
|
|
25176
25220
|
Vector3.subtract(direction, origin, direction);
|
|
25177
25221
|
direction.normalize();
|
|
25178
25222
|
return out;
|
|
@@ -28948,16 +28992,22 @@
|
|
|
28948
28992
|
/**
|
|
28949
28993
|
* @internal
|
|
28950
28994
|
*/ var BlendShapeWeightsAnimationCurveOwnerAssembler = /*#__PURE__*/ function() {
|
|
28951
|
-
var BlendShapeWeightsAnimationCurveOwnerAssembler = function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
28995
|
+
var BlendShapeWeightsAnimationCurveOwnerAssembler = function BlendShapeWeightsAnimationCurveOwnerAssembler() {
|
|
28996
|
+
this._skinnedMeshRenderer = [];
|
|
28997
|
+
};
|
|
28952
28998
|
var _proto = BlendShapeWeightsAnimationCurveOwnerAssembler.prototype;
|
|
28953
28999
|
_proto.initialize = function initialize(owner) {
|
|
28954
|
-
|
|
29000
|
+
// @todo: Compatible with multiple SkinnedMeshRenderer in a entity, optimize later.
|
|
29001
|
+
owner.target.getComponents(SkinnedMeshRenderer, this._skinnedMeshRenderer);
|
|
28955
29002
|
};
|
|
28956
29003
|
_proto.getTargetValue = function getTargetValue() {
|
|
28957
|
-
return this._skinnedMeshRenderer.blendShapeWeights;
|
|
29004
|
+
return this._skinnedMeshRenderer[0].blendShapeWeights;
|
|
28958
29005
|
};
|
|
28959
29006
|
_proto.setTargetValue = function setTargetValue(value) {
|
|
28960
|
-
this._skinnedMeshRenderer
|
|
29007
|
+
var skinnedMeshRenderer = this._skinnedMeshRenderer;
|
|
29008
|
+
for(var i = 0, n = skinnedMeshRenderer.length; i < n; i++){
|
|
29009
|
+
skinnedMeshRenderer[i].blendShapeWeights = value;
|
|
29010
|
+
}
|
|
28961
29011
|
};
|
|
28962
29012
|
return BlendShapeWeightsAnimationCurveOwnerAssembler;
|
|
28963
29013
|
}();
|
|
@@ -32298,15 +32348,13 @@
|
|
|
32298
32348
|
/** The initial lifetime of particles when emitted. */ this.startLifetime = new ParticleCompositeCurve(5);
|
|
32299
32349
|
/** The initial speed of particles when the Particle Generator first spawns them. */ this.startSpeed = new ParticleCompositeCurve(5);
|
|
32300
32350
|
/** A flag to enable specifying particle size individually for each axis. */ this.startSize3D = false;
|
|
32301
|
-
/** The initial size of particles when the Particle Generator first spawns them. */ this.startSize = new ParticleCompositeCurve(1);
|
|
32302
32351
|
/** The initial size of particles along the x-axis when the Particle Generator first spawns them. */ this.startSizeX = new ParticleCompositeCurve(1);
|
|
32303
32352
|
/** The initial size of particles along the y-axis when the Particle Generator first spawns them. */ this.startSizeY = new ParticleCompositeCurve(1);
|
|
32304
32353
|
/** The initial size of particles along the z-axis when the Particle Generator first spawns them. */ this.startSizeZ = new ParticleCompositeCurve(1);
|
|
32305
|
-
/** A flag to enable 3D particle rotation. */ this.startRotation3D = false;
|
|
32306
|
-
/** The initial rotation of particles when the Particle Generator first spawns them. */ this.startRotation = new ParticleCompositeCurve(0);
|
|
32354
|
+
/** A flag to enable 3D particle rotation, when disabled, only `startRotationZ` is used. */ this.startRotation3D = false;
|
|
32307
32355
|
/** The initial rotation of particles around the x-axis when emitted.*/ this.startRotationX = new ParticleCompositeCurve(0);
|
|
32308
32356
|
/** The initial rotation of particles around the y-axis when emitted. */ this.startRotationY = new ParticleCompositeCurve(0);
|
|
32309
|
-
this.startRotationZ = new ParticleCompositeCurve(0);
|
|
32357
|
+
/** The initial rotation of particles around the z-axis when emitted. */ this.startRotationZ = new ParticleCompositeCurve(0);
|
|
32310
32358
|
/** Makes some particles spin in the opposite direction. */ this.flipRotation = 0;
|
|
32311
32359
|
/** The mode of start color */ this.startColor = new ParticleCompositeGradient(new Color$1(1, 1, 1, 1));
|
|
32312
32360
|
/** A scale that this Particle Generator applies to gravity, defined by Physics.gravity. */ this.gravityModifier = new ParticleCompositeCurve(0);
|
|
@@ -32409,6 +32457,17 @@
|
|
|
32409
32457
|
}
|
|
32410
32458
|
}
|
|
32411
32459
|
}
|
|
32460
|
+
},
|
|
32461
|
+
{
|
|
32462
|
+
key: "startSize",
|
|
32463
|
+
get: /**
|
|
32464
|
+
* The initial size of particles when the Particle Generator first spawns them.
|
|
32465
|
+
*/ function get() {
|
|
32466
|
+
return this.startSizeX;
|
|
32467
|
+
},
|
|
32468
|
+
set: function set(value) {
|
|
32469
|
+
this.startSizeX = value;
|
|
32470
|
+
}
|
|
32412
32471
|
}
|
|
32413
32472
|
]);
|
|
32414
32473
|
return MainModule;
|
|
@@ -32452,9 +32511,6 @@
|
|
|
32452
32511
|
__decorate$1([
|
|
32453
32512
|
deepClone
|
|
32454
32513
|
], MainModule.prototype, "startSpeed", void 0);
|
|
32455
|
-
__decorate$1([
|
|
32456
|
-
deepClone
|
|
32457
|
-
], MainModule.prototype, "startSize", void 0);
|
|
32458
32514
|
__decorate$1([
|
|
32459
32515
|
deepClone
|
|
32460
32516
|
], MainModule.prototype, "startSizeX", void 0);
|
|
@@ -32464,9 +32520,6 @@
|
|
|
32464
32520
|
__decorate$1([
|
|
32465
32521
|
deepClone
|
|
32466
32522
|
], MainModule.prototype, "startSizeZ", void 0);
|
|
32467
|
-
__decorate$1([
|
|
32468
|
-
deepClone
|
|
32469
|
-
], MainModule.prototype, "startRotation", void 0);
|
|
32470
32523
|
__decorate$1([
|
|
32471
32524
|
deepClone
|
|
32472
32525
|
], MainModule.prototype, "startRotationX", void 0);
|
|
@@ -32474,7 +32527,6 @@
|
|
|
32474
32527
|
deepClone
|
|
32475
32528
|
], MainModule.prototype, "startRotationY", void 0);
|
|
32476
32529
|
__decorate$1([
|
|
32477
|
-
deepClone,
|
|
32478
32530
|
deepClone
|
|
32479
32531
|
], MainModule.prototype, "startRotationZ", void 0);
|
|
32480
32532
|
__decorate$1([
|
|
@@ -32513,7 +32565,7 @@
|
|
|
32513
32565
|
var RotationOverLifetimeModule = function RotationOverLifetimeModule() {
|
|
32514
32566
|
var _this;
|
|
32515
32567
|
_this = ParticleGeneratorModule1.apply(this, arguments) || this;
|
|
32516
|
-
/** Specifies whether the rotation is separate on each axis, when disabled only
|
|
32568
|
+
/** Specifies whether the rotation is separate on each axis, when disabled, only `rotationZ` is used. */ _this.separateAxes = false;
|
|
32517
32569
|
/** Rotation over lifetime for z axis. */ _this.rotationX = new ParticleCompositeCurve(0);
|
|
32518
32570
|
/** Rotation over lifetime for z axis. */ _this.rotationY = new ParticleCompositeCurve(0);
|
|
32519
32571
|
/** Rotation over lifetime for z axis. */ _this.rotationZ = new ParticleCompositeCurve(45);
|
|
@@ -32865,9 +32917,6 @@
|
|
|
32865
32917
|
_inherits$2(TextureSheetAnimationModule, ParticleGeneratorModule1);
|
|
32866
32918
|
var _proto = TextureSheetAnimationModule.prototype;
|
|
32867
32919
|
/**
|
|
32868
|
-
* @inheritDoc
|
|
32869
|
-
*/ _proto.cloneTo = function cloneTo(dest) {};
|
|
32870
|
-
/**
|
|
32871
32920
|
* @internal
|
|
32872
32921
|
*/ _proto._updateShaderData = function _updateShaderData(shaderData) {
|
|
32873
32922
|
var frameMacro = null;
|
|
@@ -33353,7 +33402,7 @@
|
|
|
33353
33402
|
instanceVertices[offset + 16] = MathUtil$1.degreeToRadian(main.startRotationY.evaluate(undefined, startRotationRand.random()));
|
|
33354
33403
|
instanceVertices[offset + 17] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
33355
33404
|
} else {
|
|
33356
|
-
instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.
|
|
33405
|
+
instanceVertices[offset + 15] = MathUtil$1.degreeToRadian(main.startRotationZ.evaluate(undefined, startRotationRand.random()));
|
|
33357
33406
|
}
|
|
33358
33407
|
// Start speed
|
|
33359
33408
|
instanceVertices[offset + 18] = startSpeed;
|
|
@@ -37450,12 +37499,12 @@
|
|
|
37450
37499
|
return _construct.apply(null, arguments);
|
|
37451
37500
|
}
|
|
37452
37501
|
var ReflectionParser = /*#__PURE__*/ function() {
|
|
37453
|
-
var ReflectionParser = function ReflectionParser() {
|
|
37454
|
-
|
|
37455
|
-
this.customParseComponentHandles[componentType] = handle;
|
|
37502
|
+
var ReflectionParser = function ReflectionParser(_context) {
|
|
37503
|
+
this._context = _context;
|
|
37456
37504
|
};
|
|
37457
|
-
|
|
37458
|
-
|
|
37505
|
+
var _proto = ReflectionParser.prototype;
|
|
37506
|
+
_proto.parseEntity = function parseEntity(entityConfig) {
|
|
37507
|
+
return this._getEntityByConfig(entityConfig).then(function(entity) {
|
|
37459
37508
|
var _entityConfig_isActive;
|
|
37460
37509
|
entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : true;
|
|
37461
37510
|
var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale;
|
|
@@ -37465,72 +37514,29 @@
|
|
|
37465
37514
|
return entity;
|
|
37466
37515
|
});
|
|
37467
37516
|
};
|
|
37468
|
-
|
|
37469
|
-
// @ts-ignore
|
|
37470
|
-
var assetRefId = entityConfig.assetRefId;
|
|
37471
|
-
if (assetRefId) {
|
|
37472
|
-
return engine.resourceManager // @ts-ignore
|
|
37473
|
-
.getResourceByRef({
|
|
37474
|
-
refId: assetRefId,
|
|
37475
|
-
key: entityConfig.key,
|
|
37476
|
-
isClone: entityConfig.isClone
|
|
37477
|
-
}).then(function(entity) {
|
|
37478
|
-
entity.name = entityConfig.name;
|
|
37479
|
-
return entity;
|
|
37480
|
-
});
|
|
37481
|
-
} else {
|
|
37482
|
-
var entity = new Entity(engine, entityConfig.name);
|
|
37483
|
-
return Promise.resolve(entity);
|
|
37484
|
-
}
|
|
37485
|
-
};
|
|
37486
|
-
ReflectionParser.parseClassObject = function parseClassObject(item, engine, resourceManager) {
|
|
37487
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37517
|
+
_proto.parseClassObject = function parseClassObject(item) {
|
|
37488
37518
|
var Class = Loader.getClass(item.class);
|
|
37489
37519
|
var _item_constructParams;
|
|
37490
37520
|
var params = (_item_constructParams = item.constructParams) != null ? _item_constructParams : [];
|
|
37491
37521
|
var instance = _construct(Class, [].concat(params));
|
|
37492
|
-
return this.parsePropsAndMethods(instance, item
|
|
37493
|
-
};
|
|
37494
|
-
ReflectionParser.parseBasicType = function parseBasicType(value, engine, resourceManager) {
|
|
37495
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37496
|
-
var _this = this;
|
|
37497
|
-
if (Array.isArray(value)) {
|
|
37498
|
-
return Promise.all(value.map(function(item) {
|
|
37499
|
-
return _this.parseBasicType(item, engine, resourceManager);
|
|
37500
|
-
}));
|
|
37501
|
-
} else if (typeof value === "object" && value != null) {
|
|
37502
|
-
if (this._isClass(value)) {
|
|
37503
|
-
// class object
|
|
37504
|
-
return this.parseClassObject(value, engine, resourceManager);
|
|
37505
|
-
} else if (this._isRef(value)) {
|
|
37506
|
-
// reference object
|
|
37507
|
-
return resourceManager.getResourceByRef(value);
|
|
37508
|
-
} else {
|
|
37509
|
-
// basic type
|
|
37510
|
-
return Promise.resolve(value);
|
|
37511
|
-
}
|
|
37512
|
-
} else {
|
|
37513
|
-
return Promise.resolve(value);
|
|
37514
|
-
}
|
|
37522
|
+
return this.parsePropsAndMethods(instance, item);
|
|
37515
37523
|
};
|
|
37516
|
-
|
|
37517
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37518
|
-
var _this = this;
|
|
37524
|
+
_proto.parsePropsAndMethods = function parsePropsAndMethods(instance, item) {
|
|
37519
37525
|
var promises = [];
|
|
37520
37526
|
if (item.methods) {
|
|
37521
37527
|
for(var methodName in item.methods){
|
|
37522
37528
|
var methodParams = item.methods[methodName];
|
|
37523
37529
|
for(var i = 0, count = methodParams.length; i < count; i++){
|
|
37524
37530
|
var params = methodParams[i];
|
|
37525
|
-
var promise = this.parseMethod(instance, methodName, params
|
|
37531
|
+
var promise = this.parseMethod(instance, methodName, params);
|
|
37526
37532
|
promises.push(promise);
|
|
37527
37533
|
}
|
|
37528
37534
|
}
|
|
37529
37535
|
}
|
|
37530
37536
|
if (item.props) {
|
|
37531
|
-
var
|
|
37537
|
+
var _this = this, _loop = function _loop(key) {
|
|
37532
37538
|
var value = item.props[key];
|
|
37533
|
-
var promise =
|
|
37539
|
+
var promise = _this.parseBasicType(value).then(function(v) {
|
|
37534
37540
|
return instance[key] = v;
|
|
37535
37541
|
});
|
|
37536
37542
|
promises.push(promise);
|
|
@@ -37538,27 +37544,76 @@
|
|
|
37538
37544
|
for(var key in item.props)_loop(key);
|
|
37539
37545
|
}
|
|
37540
37546
|
return Promise.all(promises).then(function() {
|
|
37541
|
-
var handle =
|
|
37542
|
-
if (handle) return handle(instance, item
|
|
37547
|
+
var handle = ReflectionParser.customParseComponentHandles[instance.constructor.name];
|
|
37548
|
+
if (handle) return handle(instance, item);
|
|
37543
37549
|
else return instance;
|
|
37544
37550
|
});
|
|
37545
37551
|
};
|
|
37546
|
-
|
|
37547
|
-
if (resourceManager === void 0) resourceManager = engine.resourceManager;
|
|
37552
|
+
_proto.parseMethod = function parseMethod(instance, methodName, methodParams) {
|
|
37548
37553
|
var _this = this;
|
|
37549
37554
|
return Promise.all(methodParams.map(function(param) {
|
|
37550
|
-
return _this.parseBasicType(param
|
|
37555
|
+
return _this.parseBasicType(param);
|
|
37551
37556
|
})).then(function(result) {
|
|
37552
37557
|
var _instance;
|
|
37553
37558
|
return (_instance = instance)[methodName].apply(_instance, [].concat(result));
|
|
37554
37559
|
});
|
|
37555
37560
|
};
|
|
37561
|
+
_proto.parseBasicType = function parseBasicType(value) {
|
|
37562
|
+
var _this = this;
|
|
37563
|
+
if (Array.isArray(value)) {
|
|
37564
|
+
return Promise.all(value.map(function(item) {
|
|
37565
|
+
return _this.parseBasicType(item);
|
|
37566
|
+
}));
|
|
37567
|
+
} else if (typeof value === "object" && value != null) {
|
|
37568
|
+
if (ReflectionParser._isClass(value)) {
|
|
37569
|
+
// class object
|
|
37570
|
+
return this.parseClassObject(value);
|
|
37571
|
+
} else if (ReflectionParser._isAssetRef(value)) {
|
|
37572
|
+
// reference object
|
|
37573
|
+
// @ts-ignore
|
|
37574
|
+
return this._context.resourceManager.getResourceByRef(value);
|
|
37575
|
+
} else if (ReflectionParser._isEntityRef(value)) {
|
|
37576
|
+
// entity reference
|
|
37577
|
+
return Promise.resolve(this._context.entityMap.get(value.entityId));
|
|
37578
|
+
} else {
|
|
37579
|
+
// basic type
|
|
37580
|
+
return Promise.resolve(value);
|
|
37581
|
+
}
|
|
37582
|
+
} else {
|
|
37583
|
+
return Promise.resolve(value);
|
|
37584
|
+
}
|
|
37585
|
+
};
|
|
37586
|
+
_proto._getEntityByConfig = function _getEntityByConfig(entityConfig) {
|
|
37587
|
+
// @ts-ignore
|
|
37588
|
+
var assetRefId = entityConfig.assetRefId;
|
|
37589
|
+
var engine = this._context.engine;
|
|
37590
|
+
if (assetRefId) {
|
|
37591
|
+
return engine.resourceManager // @ts-ignore
|
|
37592
|
+
.getResourceByRef({
|
|
37593
|
+
refId: assetRefId,
|
|
37594
|
+
key: entityConfig.key,
|
|
37595
|
+
isClone: entityConfig.isClone
|
|
37596
|
+
}).then(function(entity) {
|
|
37597
|
+
entity.name = entityConfig.name;
|
|
37598
|
+
return entity;
|
|
37599
|
+
});
|
|
37600
|
+
} else {
|
|
37601
|
+
var entity = new Entity(engine, entityConfig.name);
|
|
37602
|
+
return Promise.resolve(entity);
|
|
37603
|
+
}
|
|
37604
|
+
};
|
|
37605
|
+
ReflectionParser.registerCustomParseComponent = function registerCustomParseComponent(componentType, handle) {
|
|
37606
|
+
this.customParseComponentHandles[componentType] = handle;
|
|
37607
|
+
};
|
|
37556
37608
|
ReflectionParser._isClass = function _isClass(value) {
|
|
37557
37609
|
return value["class"] != undefined;
|
|
37558
37610
|
};
|
|
37559
|
-
ReflectionParser.
|
|
37611
|
+
ReflectionParser._isAssetRef = function _isAssetRef(value) {
|
|
37560
37612
|
return value["refId"] != undefined;
|
|
37561
37613
|
};
|
|
37614
|
+
ReflectionParser._isEntityRef = function _isEntityRef(value) {
|
|
37615
|
+
return value["entityId"] != undefined;
|
|
37616
|
+
};
|
|
37562
37617
|
return ReflectionParser;
|
|
37563
37618
|
}();
|
|
37564
37619
|
(function() {
|
|
@@ -37814,6 +37869,8 @@
|
|
|
37814
37869
|
this.assets = new Map();
|
|
37815
37870
|
this.entityConfigMap = new Map();
|
|
37816
37871
|
this.rootIds = [];
|
|
37872
|
+
this.engine = scene.engine;
|
|
37873
|
+
this.resourceManager = scene.engine.resourceManager;
|
|
37817
37874
|
};
|
|
37818
37875
|
var _proto = SceneParserContext.prototype;
|
|
37819
37876
|
_proto.destroy = function destroy() {
|
|
@@ -37829,7 +37886,7 @@
|
|
|
37829
37886
|
var SceneParser = function SceneParser(context) {
|
|
37830
37887
|
var _this = this;
|
|
37831
37888
|
this.context = context;
|
|
37832
|
-
this._engine =
|
|
37889
|
+
this._engine = context.scene.engine;
|
|
37833
37890
|
this._organizeEntities = this._organizeEntities.bind(this);
|
|
37834
37891
|
this._parseComponents = this._parseComponents.bind(this);
|
|
37835
37892
|
this._clearAndResolveScene = this._clearAndResolveScene.bind(this);
|
|
@@ -37837,22 +37894,24 @@
|
|
|
37837
37894
|
_this._reject = reject;
|
|
37838
37895
|
_this._resolve = resolve;
|
|
37839
37896
|
});
|
|
37897
|
+
this._reflectionParser = new ReflectionParser(context);
|
|
37840
37898
|
};
|
|
37841
37899
|
var _proto = SceneParser.prototype;
|
|
37842
37900
|
/** start parse the scene */ _proto.start = function start() {
|
|
37843
37901
|
this._parseEntities().then(this._organizeEntities).then(this._parseComponents).then(this._clearAndResolveScene).then(this._resolve).catch(this._reject);
|
|
37844
37902
|
};
|
|
37845
37903
|
_proto._parseEntities = function _parseEntities() {
|
|
37904
|
+
var _this = this;
|
|
37846
37905
|
var entitiesConfig = this.context.originalData.entities;
|
|
37847
37906
|
var entityConfigMap = this.context.entityConfigMap;
|
|
37848
37907
|
var entitiesMap = this.context.entityMap;
|
|
37849
37908
|
var rootIds = this.context.rootIds;
|
|
37850
|
-
|
|
37909
|
+
this._engine;
|
|
37851
37910
|
var promises = entitiesConfig.map(function(entityConfig) {
|
|
37852
37911
|
entityConfigMap.set(entityConfig.id, entityConfig);
|
|
37853
37912
|
// record root entities
|
|
37854
37913
|
if (!entityConfig.parent) rootIds.push(entityConfig.id);
|
|
37855
|
-
return
|
|
37914
|
+
return _this._reflectionParser.parseEntity(entityConfig);
|
|
37856
37915
|
});
|
|
37857
37916
|
return Promise.all(promises).then(function(entities) {
|
|
37858
37917
|
for(var i = 0, l = entities.length; i < l; i++){
|
|
@@ -37890,7 +37949,7 @@
|
|
|
37890
37949
|
component = entity.getComponent(Loader.getClass(key));
|
|
37891
37950
|
}
|
|
37892
37951
|
component = component || entity.addComponent(Loader.getClass(key));
|
|
37893
|
-
var promise =
|
|
37952
|
+
var promise = this._reflectionParser.parsePropsAndMethods(component, componentConfig);
|
|
37894
37953
|
promises.push(promise);
|
|
37895
37954
|
}
|
|
37896
37955
|
}
|
|
@@ -40473,12 +40532,12 @@
|
|
|
40473
40532
|
if (curve2.interpolation === exports.InterpolationType.CubicSpine) {
|
|
40474
40533
|
keyframe2.inTangent = Array.from(output.subarray(offset2, offset2 + outputSize));
|
|
40475
40534
|
offset2 += outputSize;
|
|
40476
|
-
keyframe2.value = output.
|
|
40535
|
+
keyframe2.value = output.slice(offset2, offset2 + outputSize);
|
|
40477
40536
|
offset2 += outputSize;
|
|
40478
40537
|
keyframe2.outTangent = Array.from(output.subarray(offset2, offset2 + outputSize));
|
|
40479
40538
|
offset2 += outputSize;
|
|
40480
40539
|
} else {
|
|
40481
|
-
keyframe2.value = output.
|
|
40540
|
+
keyframe2.value = output.slice(offset2, offset2 + outputSize);
|
|
40482
40541
|
offset2 += outputSize;
|
|
40483
40542
|
}
|
|
40484
40543
|
curve2.addKey(keyframe2);
|
|
@@ -41221,8 +41280,7 @@
|
|
|
41221
41280
|
mipmap: (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap
|
|
41222
41281
|
}
|
|
41223
41282
|
}).then(function(texture) {
|
|
41224
|
-
|
|
41225
|
-
(_texture = texture).name || (_texture.name = textureName || imageName || "texture_" + index);
|
|
41283
|
+
texture.name = textureName || imageName || texture.name || "texture_" + index;
|
|
41226
41284
|
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
41227
41285
|
return texture;
|
|
41228
41286
|
});
|
|
@@ -42310,6 +42368,38 @@
|
|
|
42310
42368
|
""
|
|
42311
42369
|
])
|
|
42312
42370
|
], TextureCubeLoader);
|
|
42371
|
+
var ProjectLoader = /*#__PURE__*/ function(Loader1) {
|
|
42372
|
+
var ProjectLoader = function ProjectLoader() {
|
|
42373
|
+
return Loader1.apply(this, arguments);
|
|
42374
|
+
};
|
|
42375
|
+
_inherits(ProjectLoader, Loader1);
|
|
42376
|
+
var _proto = ProjectLoader.prototype;
|
|
42377
|
+
_proto.load = function load(item, resourceManager) {
|
|
42378
|
+
var _this = this;
|
|
42379
|
+
var engine = resourceManager.engine;
|
|
42380
|
+
return new AssetPromise(function(resolve, reject) {
|
|
42381
|
+
_this.request(item.url, {
|
|
42382
|
+
type: "json"
|
|
42383
|
+
}).then(function(data) {
|
|
42384
|
+
// @ts-ignore
|
|
42385
|
+
engine.resourceManager.initVirtualResources(data.files);
|
|
42386
|
+
return resourceManager.load({
|
|
42387
|
+
type: exports.AssetType.Scene,
|
|
42388
|
+
url: data.scene
|
|
42389
|
+
}).then(function(scene) {
|
|
42390
|
+
engine.sceneManager.activeScene = scene;
|
|
42391
|
+
resolve();
|
|
42392
|
+
});
|
|
42393
|
+
}).catch(reject);
|
|
42394
|
+
});
|
|
42395
|
+
};
|
|
42396
|
+
return ProjectLoader;
|
|
42397
|
+
}(Loader);
|
|
42398
|
+
ProjectLoader = __decorate([
|
|
42399
|
+
resourceLoader(exports.AssetType.Project, [
|
|
42400
|
+
"proj"
|
|
42401
|
+
], true)
|
|
42402
|
+
], ProjectLoader);
|
|
42313
42403
|
var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
42314
42404
|
var SceneLoader = function SceneLoader() {
|
|
42315
42405
|
return Loader1.apply(this, arguments);
|
|
@@ -42906,7 +42996,7 @@
|
|
|
42906
42996
|
], GALACEAN_animation_event);
|
|
42907
42997
|
|
|
42908
42998
|
//@ts-ignore
|
|
42909
|
-
var version = "1.1.0-beta.
|
|
42999
|
+
var version = "1.1.0-beta.5";
|
|
42910
43000
|
console.log("Galacean engine version: " + version);
|
|
42911
43001
|
for(var key in CoreObjects){
|
|
42912
43002
|
Loader.registerClass(key, CoreObjects[key]);
|