@galacean/engine 1.0.0-beta.0 → 1.0.0-beta.3
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 +142 -315
- 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
|
@@ -5507,7 +5507,6 @@
|
|
|
5507
5507
|
_inherits$2(ReferResource, EngineObject);
|
|
5508
5508
|
var _proto = ReferResource.prototype;
|
|
5509
5509
|
/**
|
|
5510
|
-
* @override
|
|
5511
5510
|
* Destroy self.
|
|
5512
5511
|
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
5513
5512
|
* @returns Whether the release was successful.
|
|
@@ -5534,9 +5533,7 @@
|
|
|
5534
5533
|
*/ _proto._addToResourceManager = function _addToResourceManager(path) {
|
|
5535
5534
|
this._engine.resourceManager._addAsset(path, this);
|
|
5536
5535
|
};
|
|
5537
|
-
|
|
5538
|
-
* @override
|
|
5539
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
5536
|
+
_proto._onDestroy = function _onDestroy() {
|
|
5540
5537
|
EngineObject.prototype._onDestroy.call(this);
|
|
5541
5538
|
this._engine.resourceManager._deleteReferResource(this);
|
|
5542
5539
|
var refCount = this._getReferCount();
|
|
@@ -5660,9 +5657,7 @@
|
|
|
5660
5657
|
};
|
|
5661
5658
|
_inherits$2(GraphicsResource, ReferResource);
|
|
5662
5659
|
var _proto = GraphicsResource.prototype;
|
|
5663
|
-
|
|
5664
|
-
* @override
|
|
5665
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
5660
|
+
_proto._onDestroy = function _onDestroy() {
|
|
5666
5661
|
ReferResource.prototype._onDestroy.call(this);
|
|
5667
5662
|
this.engine.resourceManager._deleteGraphicResource(this);
|
|
5668
5663
|
};
|
|
@@ -5729,7 +5724,6 @@
|
|
|
5729
5724
|
}
|
|
5730
5725
|
};
|
|
5731
5726
|
/**
|
|
5732
|
-
* @override
|
|
5733
5727
|
* @internal
|
|
5734
5728
|
*/ _proto._rebuild = function _rebuild() {
|
|
5735
5729
|
var platformTexture = this._platformTexture;
|
|
@@ -5740,10 +5734,7 @@
|
|
|
5740
5734
|
platformTexture.depthCompareFunction = this._depthCompareFunction;
|
|
5741
5735
|
platformTexture.setUseDepthCompareMode(this._useDepthCompareMode);
|
|
5742
5736
|
};
|
|
5743
|
-
|
|
5744
|
-
* @override
|
|
5745
|
-
* @internal
|
|
5746
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
5737
|
+
_proto._onDestroy = function _onDestroy() {
|
|
5747
5738
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
5748
5739
|
this._platformTexture.destroy();
|
|
5749
5740
|
this._platformTexture = null;
|
|
@@ -5930,9 +5921,7 @@
|
|
|
5930
5921
|
this._depthTexture && this._depthTexture.generateMipmaps();
|
|
5931
5922
|
}
|
|
5932
5923
|
};
|
|
5933
|
-
|
|
5934
|
-
* @override
|
|
5935
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
5924
|
+
_proto._onDestroy = function _onDestroy() {
|
|
5936
5925
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
5937
5926
|
this._platformRenderTarget.destroy();
|
|
5938
5927
|
this._colorTextures.length = 0;
|
|
@@ -5950,7 +5939,6 @@
|
|
|
5950
5939
|
this._platformRenderTarget.blitRenderTarget();
|
|
5951
5940
|
};
|
|
5952
5941
|
/**
|
|
5953
|
-
* @override
|
|
5954
5942
|
* @internal
|
|
5955
5943
|
*/ _proto._rebuild = function _rebuild() {
|
|
5956
5944
|
this._platformRenderTarget = this._engine._hardwareRenderer.createPlatformRenderTarget(this);
|
|
@@ -6151,7 +6139,7 @@
|
|
|
6151
6139
|
}
|
|
6152
6140
|
};
|
|
6153
6141
|
/**
|
|
6154
|
-
* @
|
|
6142
|
+
* @internal
|
|
6155
6143
|
*/ _proto._rebuild = function _rebuild() {
|
|
6156
6144
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTexture2DArray(this);
|
|
6157
6145
|
Texture.prototype._rebuild.call(this);
|
|
@@ -6234,7 +6222,7 @@
|
|
|
6234
6222
|
}
|
|
6235
6223
|
};
|
|
6236
6224
|
/**
|
|
6237
|
-
* @
|
|
6225
|
+
* @internal
|
|
6238
6226
|
*/ _proto._rebuild = function _rebuild() {
|
|
6239
6227
|
this._platformTexture = this._engine._hardwareRenderer.createPlatformTextureCube(this);
|
|
6240
6228
|
Texture.prototype._rebuild.call(this);
|
|
@@ -6307,10 +6295,7 @@
|
|
|
6307
6295
|
_proto.getCharInfo = function getCharInfo(char) {
|
|
6308
6296
|
return this._charInfoMap[char.charCodeAt(0)];
|
|
6309
6297
|
};
|
|
6310
|
-
|
|
6311
|
-
* @override
|
|
6312
|
-
* @internal
|
|
6313
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
6298
|
+
_proto._onDestroy = function _onDestroy() {
|
|
6314
6299
|
ReferResource.prototype._onDestroy.call(this);
|
|
6315
6300
|
this.texture.destroy();
|
|
6316
6301
|
this.texture = null;
|
|
@@ -6868,10 +6853,7 @@
|
|
|
6868
6853
|
subFontMap[key] = subFont;
|
|
6869
6854
|
return subFont;
|
|
6870
6855
|
};
|
|
6871
|
-
|
|
6872
|
-
* @override
|
|
6873
|
-
* @internal
|
|
6874
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
6856
|
+
_proto._onDestroy = function _onDestroy() {
|
|
6875
6857
|
ReferResource.prototype._onDestroy.call(this);
|
|
6876
6858
|
var subFontMap = this._subFontMap;
|
|
6877
6859
|
for(var k in subFontMap){
|
|
@@ -8031,53 +8013,6 @@
|
|
|
8031
8013
|
};
|
|
8032
8014
|
return ComponentsManager;
|
|
8033
8015
|
}();
|
|
8034
|
-
var ComponentCloner = /*#__PURE__*/ function() {
|
|
8035
|
-
var ComponentCloner = function ComponentCloner() {};
|
|
8036
|
-
/**
|
|
8037
|
-
* Clone component.
|
|
8038
|
-
* @param source - Clone source
|
|
8039
|
-
* @param target - Clone target
|
|
8040
|
-
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
8041
|
-
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
8042
|
-
var keys = Object.keys(source);
|
|
8043
|
-
for(var i = 0, n = keys.length; i < n; i++){
|
|
8044
|
-
var k = keys[i];
|
|
8045
|
-
var cloneMode = cloneModes[k];
|
|
8046
|
-
switch(cloneMode){
|
|
8047
|
-
case undefined:
|
|
8048
|
-
case CloneMode.Assignment:
|
|
8049
|
-
target[k] = source[k];
|
|
8050
|
-
break;
|
|
8051
|
-
case CloneMode.Shallow:
|
|
8052
|
-
var sourcePropS = source[k];
|
|
8053
|
-
if (_instanceof1$2(sourcePropS, Object)) {
|
|
8054
|
-
var tarProp = target[k];
|
|
8055
|
-
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
8056
|
-
Object.assign(tarProp, sourcePropS);
|
|
8057
|
-
} else {
|
|
8058
|
-
// Null or undefined and primitive type.
|
|
8059
|
-
target[k] = sourcePropS;
|
|
8060
|
-
}
|
|
8061
|
-
break;
|
|
8062
|
-
case CloneMode.Deep:
|
|
8063
|
-
var sourcePropD = source[k];
|
|
8064
|
-
if (_instanceof1$2(sourcePropD, Object)) {
|
|
8065
|
-
var tarProp1 = target[k];
|
|
8066
|
-
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
8067
|
-
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
8068
|
-
} else {
|
|
8069
|
-
// Null or undefined and primitive type.
|
|
8070
|
-
target[k] = sourcePropD;
|
|
8071
|
-
}
|
|
8072
|
-
break;
|
|
8073
|
-
}
|
|
8074
|
-
}
|
|
8075
|
-
if (source._cloneTo) {
|
|
8076
|
-
source._cloneTo(target);
|
|
8077
|
-
}
|
|
8078
|
-
};
|
|
8079
|
-
return ComponentCloner;
|
|
8080
|
-
}();
|
|
8081
8016
|
/**
|
|
8082
8017
|
* The base class of the components.
|
|
8083
8018
|
*/ var Component = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -8125,10 +8060,7 @@
|
|
|
8125
8060
|
}
|
|
8126
8061
|
}
|
|
8127
8062
|
};
|
|
8128
|
-
|
|
8129
|
-
* @override
|
|
8130
|
-
* @internal
|
|
8131
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
8063
|
+
_proto._onDestroy = function _onDestroy() {
|
|
8132
8064
|
EngineObject.prototype._onDestroy.call(this);
|
|
8133
8065
|
this._entity._removeComponent(this);
|
|
8134
8066
|
if (this._entity.isActiveInHierarchy) {
|
|
@@ -9351,6 +9283,53 @@
|
|
|
9351
9283
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldScale */ "WmWpWs"] = 0xa4] = "WmWpWs";
|
|
9352
9284
|
TransformModifyFlags[TransformModifyFlags[/** WorldMatrix | WorldPosition | WorldEuler | WorldQuat | WorldScale */ "WmWpWeWqWs"] = 0xbc] = "WmWpWeWqWs";
|
|
9353
9285
|
})(TransformModifyFlags || (TransformModifyFlags = {}));
|
|
9286
|
+
var ComponentCloner = /*#__PURE__*/ function() {
|
|
9287
|
+
var ComponentCloner = function ComponentCloner() {};
|
|
9288
|
+
/**
|
|
9289
|
+
* Clone component.
|
|
9290
|
+
* @param source - Clone source
|
|
9291
|
+
* @param target - Clone target
|
|
9292
|
+
*/ ComponentCloner.cloneComponent = function cloneComponent(source, target) {
|
|
9293
|
+
var cloneModes = CloneManager.getCloneMode(source.constructor);
|
|
9294
|
+
var keys = Object.keys(source);
|
|
9295
|
+
for(var i = 0, n = keys.length; i < n; i++){
|
|
9296
|
+
var k = keys[i];
|
|
9297
|
+
var cloneMode = cloneModes[k];
|
|
9298
|
+
switch(cloneMode){
|
|
9299
|
+
case undefined:
|
|
9300
|
+
case CloneMode.Assignment:
|
|
9301
|
+
target[k] = source[k];
|
|
9302
|
+
break;
|
|
9303
|
+
case CloneMode.Shallow:
|
|
9304
|
+
var sourcePropS = source[k];
|
|
9305
|
+
if (_instanceof1$2(sourcePropS, Object)) {
|
|
9306
|
+
var tarProp = target[k];
|
|
9307
|
+
tarProp == null && (tarProp = target[k] = sourcePropS.constructor());
|
|
9308
|
+
Object.assign(tarProp, sourcePropS);
|
|
9309
|
+
} else {
|
|
9310
|
+
// Null or undefined and primitive type.
|
|
9311
|
+
target[k] = sourcePropS;
|
|
9312
|
+
}
|
|
9313
|
+
break;
|
|
9314
|
+
case CloneMode.Deep:
|
|
9315
|
+
var sourcePropD = source[k];
|
|
9316
|
+
if (_instanceof1$2(sourcePropD, Object)) {
|
|
9317
|
+
var tarProp1 = target[k];
|
|
9318
|
+
tarProp1 == null && (tarProp1 = target[k] = sourcePropD.constructor());
|
|
9319
|
+
CloneManager.deepCloneObject(sourcePropD, tarProp1);
|
|
9320
|
+
} else {
|
|
9321
|
+
// Null or undefined and primitive type.
|
|
9322
|
+
target[k] = sourcePropD;
|
|
9323
|
+
}
|
|
9324
|
+
break;
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
if (source._cloneTo) {
|
|
9328
|
+
source._cloneTo(target);
|
|
9329
|
+
}
|
|
9330
|
+
};
|
|
9331
|
+
return ComponentCloner;
|
|
9332
|
+
}();
|
|
9354
9333
|
/**
|
|
9355
9334
|
* Entity, be used as components container.
|
|
9356
9335
|
*/ var Entity = /*#__PURE__*/ function(EngineObject) {
|
|
@@ -10821,21 +10800,16 @@
|
|
|
10821
10800
|
* @internal
|
|
10822
10801
|
*/ _proto._onLateUpdate = function _onLateUpdate() {};
|
|
10823
10802
|
/**
|
|
10824
|
-
* @override
|
|
10825
10803
|
* @internal
|
|
10826
10804
|
*/ _proto._onEnable = function _onEnable() {
|
|
10827
10805
|
this.engine.physicsManager._addCollider(this);
|
|
10828
10806
|
};
|
|
10829
10807
|
/**
|
|
10830
|
-
* @override
|
|
10831
10808
|
* @internal
|
|
10832
10809
|
*/ _proto._onDisable = function _onDisable() {
|
|
10833
10810
|
this.engine.physicsManager._removeCollider(this);
|
|
10834
10811
|
};
|
|
10835
|
-
|
|
10836
|
-
* @override
|
|
10837
|
-
* @internal
|
|
10838
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
10812
|
+
_proto._onDestroy = function _onDestroy() {
|
|
10839
10813
|
Component.prototype._onDestroy.call(this);
|
|
10840
10814
|
this.clearShapes();
|
|
10841
10815
|
this._nativeCollider.destroy();
|
|
@@ -10871,7 +10845,6 @@
|
|
|
10871
10845
|
var CharacterController = function CharacterController(entity) {
|
|
10872
10846
|
var _this;
|
|
10873
10847
|
_this = Collider.call(this, entity) || this;
|
|
10874
|
-
/** @internal */ _this._index = -1;
|
|
10875
10848
|
_this._stepOffset = 0.5;
|
|
10876
10849
|
_this._nonWalkableMode = exports.ControllerNonWalkableMode.PreventClimbing;
|
|
10877
10850
|
_this._upDirection = new Vector3(0, 1, 0);
|
|
@@ -10896,7 +10869,6 @@
|
|
|
10896
10869
|
/**
|
|
10897
10870
|
* Add collider shape on this controller.
|
|
10898
10871
|
* @param shape - Collider shape
|
|
10899
|
-
* @override
|
|
10900
10872
|
*/ _proto.addShape = function addShape(shape) {
|
|
10901
10873
|
if (this._shapes.length > 0) {
|
|
10902
10874
|
throw "only allow single shape on controller!";
|
|
@@ -10906,7 +10878,6 @@
|
|
|
10906
10878
|
};
|
|
10907
10879
|
/**
|
|
10908
10880
|
* Remove all shape attached.
|
|
10909
|
-
* @override
|
|
10910
10881
|
*/ _proto.clearShapes = function clearShapes() {
|
|
10911
10882
|
if (this._shapes.length > 0) {
|
|
10912
10883
|
Collider.prototype.removeShape.call(this, this._shapes[0]);
|
|
@@ -10914,7 +10885,6 @@
|
|
|
10914
10885
|
};
|
|
10915
10886
|
/**
|
|
10916
10887
|
* @internal
|
|
10917
|
-
* @override
|
|
10918
10888
|
*/ _proto._onUpdate = function _onUpdate() {
|
|
10919
10889
|
if (this._updateFlag.flag) {
|
|
10920
10890
|
var transform = this.entity.transform;
|
|
@@ -10929,7 +10899,6 @@
|
|
|
10929
10899
|
};
|
|
10930
10900
|
/**
|
|
10931
10901
|
* @internal
|
|
10932
|
-
* @override
|
|
10933
10902
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
10934
10903
|
var position = this.entity.transform.worldPosition;
|
|
10935
10904
|
this._nativeCollider.getWorldPosition(position);
|
|
@@ -10937,13 +10906,11 @@
|
|
|
10937
10906
|
this._updateFlag.flag = false;
|
|
10938
10907
|
};
|
|
10939
10908
|
/**
|
|
10940
|
-
* @override
|
|
10941
10909
|
* @internal
|
|
10942
10910
|
*/ _proto._onEnable = function _onEnable() {
|
|
10943
10911
|
this.engine.physicsManager._addCharacterController(this);
|
|
10944
10912
|
};
|
|
10945
10913
|
/**
|
|
10946
|
-
* @override
|
|
10947
10914
|
* @internal
|
|
10948
10915
|
*/ _proto._onDisable = function _onDisable() {
|
|
10949
10916
|
this.engine.physicsManager._removeCharacterController(this);
|
|
@@ -11428,7 +11395,6 @@
|
|
|
11428
11395
|
_inherits$2(FixedJoint, Joint);
|
|
11429
11396
|
var _proto = FixedJoint.prototype;
|
|
11430
11397
|
/**
|
|
11431
|
-
* @override
|
|
11432
11398
|
* @internal
|
|
11433
11399
|
*/ _proto._onAwake = function _onAwake() {
|
|
11434
11400
|
var collider = this._collider;
|
|
@@ -11460,7 +11426,6 @@
|
|
|
11460
11426
|
_inherits$2(HingeJoint, Joint);
|
|
11461
11427
|
var _proto = HingeJoint.prototype;
|
|
11462
11428
|
/**
|
|
11463
|
-
* @override
|
|
11464
11429
|
* @internal
|
|
11465
11430
|
*/ _proto._onAwake = function _onAwake() {
|
|
11466
11431
|
var collider = this._collider;
|
|
@@ -11611,7 +11576,6 @@
|
|
|
11611
11576
|
_inherits$2(SpringJoint, Joint);
|
|
11612
11577
|
var _proto = SpringJoint.prototype;
|
|
11613
11578
|
/**
|
|
11614
|
-
* @override
|
|
11615
11579
|
* @internal
|
|
11616
11580
|
*/ _proto._onAwake = function _onAwake() {
|
|
11617
11581
|
var collider = this._collider;
|
|
@@ -11811,7 +11775,6 @@
|
|
|
11811
11775
|
this._nativeCollider.wakeUp();
|
|
11812
11776
|
};
|
|
11813
11777
|
/**
|
|
11814
|
-
* @override
|
|
11815
11778
|
* @internal
|
|
11816
11779
|
*/ _proto._onLateUpdate = function _onLateUpdate() {
|
|
11817
11780
|
var transform = this.entity.transform;
|
|
@@ -12755,14 +12718,12 @@
|
|
|
12755
12718
|
/**
|
|
12756
12719
|
* Mount to the current Scene.
|
|
12757
12720
|
* @internal
|
|
12758
|
-
* @override
|
|
12759
12721
|
*/ _proto._onEnable = function _onEnable() {
|
|
12760
12722
|
this.engine._lightManager._attachDirectLight(this);
|
|
12761
12723
|
};
|
|
12762
12724
|
/**
|
|
12763
12725
|
* Unmount from the current Scene.
|
|
12764
12726
|
* @internal
|
|
12765
|
-
* @override
|
|
12766
12727
|
*/ _proto._onDisable = function _onDisable() {
|
|
12767
12728
|
this.engine._lightManager._detachDirectLight(this);
|
|
12768
12729
|
};
|
|
@@ -12796,7 +12757,6 @@
|
|
|
12796
12757
|
key: "_shadowProjectionMatrix",
|
|
12797
12758
|
get: /**
|
|
12798
12759
|
* @internal
|
|
12799
|
-
* @override
|
|
12800
12760
|
*/ function get() {
|
|
12801
12761
|
throw "Unknown!";
|
|
12802
12762
|
}
|
|
@@ -12855,14 +12815,12 @@
|
|
|
12855
12815
|
/**
|
|
12856
12816
|
* Mount to the current Scene.
|
|
12857
12817
|
* @internal
|
|
12858
|
-
* @override
|
|
12859
12818
|
*/ _proto._onEnable = function _onEnable() {
|
|
12860
12819
|
this.engine._lightManager._attachPointLight(this);
|
|
12861
12820
|
};
|
|
12862
12821
|
/**
|
|
12863
12822
|
* Unmount from the current Scene.
|
|
12864
12823
|
* @internal
|
|
12865
|
-
* @override
|
|
12866
12824
|
*/ _proto._onDisable = function _onDisable() {
|
|
12867
12825
|
this.engine._lightManager._detachPointLight(this);
|
|
12868
12826
|
};
|
|
@@ -12888,7 +12846,6 @@
|
|
|
12888
12846
|
key: "_shadowProjectionMatrix",
|
|
12889
12847
|
get: /**
|
|
12890
12848
|
* @internal
|
|
12891
|
-
* @override
|
|
12892
12849
|
*/ function get() {
|
|
12893
12850
|
throw "Unknown!";
|
|
12894
12851
|
}
|
|
@@ -12964,14 +12921,12 @@
|
|
|
12964
12921
|
/**
|
|
12965
12922
|
* Mount to the current Scene.
|
|
12966
12923
|
* @internal
|
|
12967
|
-
* @override
|
|
12968
12924
|
*/ _proto._onEnable = function _onEnable() {
|
|
12969
12925
|
this.engine._lightManager._attachSpotLight(this);
|
|
12970
12926
|
};
|
|
12971
12927
|
/**
|
|
12972
12928
|
* Unmount from the current Scene.
|
|
12973
12929
|
* @internal
|
|
12974
|
-
* @override
|
|
12975
12930
|
*/ _proto._onDisable = function _onDisable() {
|
|
12976
12931
|
this.engine._lightManager._detachSpotLight(this);
|
|
12977
12932
|
};
|
|
@@ -13017,7 +12972,6 @@
|
|
|
13017
12972
|
key: "_shadowProjectionMatrix",
|
|
13018
12973
|
get: /**
|
|
13019
12974
|
* @internal
|
|
13020
|
-
* @override
|
|
13021
12975
|
*/ function get() {
|
|
13022
12976
|
var matrix = this._projectMatrix;
|
|
13023
12977
|
var fov = Math.min(Math.PI / 2, this.angle * 2 * Math.sqrt(2));
|
|
@@ -14166,9 +14120,7 @@
|
|
|
14166
14120
|
this.shaderData.cloneTo(target.shaderData);
|
|
14167
14121
|
CloneManager.deepCloneObject(this.renderStates, target.renderStates);
|
|
14168
14122
|
};
|
|
14169
|
-
|
|
14170
|
-
* @override
|
|
14171
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
14123
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
14172
14124
|
ReferResource.prototype._addReferCount.call(this, value);
|
|
14173
14125
|
this.shaderData._addReferCount(value);
|
|
14174
14126
|
};
|
|
@@ -14287,25 +14239,25 @@
|
|
|
14287
14239
|
var color_share = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_VERTEXCOLOR\nvarying vec4 v_color;\n#endif\n"; // eslint-disable-line
|
|
14288
14240
|
var FogFragmentDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;uniform vec4 scene_FogColor;uniform vec4 scene_FogParams;float ComputeFogIntensity(float fogDepth){\n#if SCENE_FOG_MODE == 1\nreturn clamp(fogDepth*scene_FogParams.x+scene_FogParams.y,0.0,1.0);\n#elif SCENE_FOG_MODE == 2\nreturn clamp(exp2(-fogDepth*scene_FogParams.z),0.0,1.0);\n#elif SCENE_FOG_MODE == 3\nfloat factor=fogDepth*scene_FogParams.w;return clamp(exp2(-factor*factor),0.0,1.0);\n#endif\n}\n#endif\n"; // eslint-disable-line
|
|
14289
14241
|
var FogVertexDeclaration = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvarying vec3 v_positionVS;\n#endif\n"; // eslint-disable-line
|
|
14290
|
-
var normal_share = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvarying vec3 v_normal;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14242
|
+
var normal_share = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvarying vec3 v_normal;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvarying mat3 v_TBN;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
14291
14243
|
var uv_share = "#define GLSLIFY 1\nvarying vec2 v_uv;\n#ifdef RENDERER_HAS_UV1\nvarying vec2 v_uv1;\n#endif\n"; // eslint-disable-line
|
|
14292
|
-
var worldpos_share = "#define GLSLIFY 1\n#ifdef
|
|
14244
|
+
var worldpos_share = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvarying vec3 v_pos;\n#endif\n"; // eslint-disable-line
|
|
14293
14245
|
var begin_normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=vec3(NORMAL);\n#endif\n#ifdef RENDERER_HAS_TANGENT\nvec4 tangent=vec4(TANGENT);\n#endif\n#endif\n"; // eslint-disable-line
|
|
14294
14246
|
var begin_position_vert = "#define GLSLIFY 1\nvec4 position=vec4(POSITION,1.0);"; // eslint-disable-line
|
|
14295
14247
|
var blendShape_input = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nuniform mediump sampler2DArray renderer_BlendShapeTexture;uniform ivec3 renderer_BlendShapeTextureInfo;uniform float renderer_BlendShapeWeights[RENDERER_BLENDSHAPE_COUNT];\n#else\nattribute vec3 POSITION_BS0;attribute vec3 POSITION_BS1;\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;uniform float renderer_BlendShapeWeights[2];\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;\n#ifdef RENDERER_BLENDSHAPE_HAS_NORMAL\nattribute vec3 NORMAL_BS0;attribute vec3 NORMAL_BS1;attribute vec3 NORMAL_BS2;attribute vec3 NORMAL_BS3;\n#endif\n#ifdef RENDERER_BLENDSHAPE_HAS_TANGENT\nattribute vec3 TANGENT_BS0;attribute vec3 TANGENT_BS1;attribute vec3 TANGENT_BS2;attribute vec3 TANGENT_BS3;\n#endif\nuniform float renderer_BlendShapeWeights[4];\n#else\nattribute vec3 POSITION_BS2;attribute vec3 POSITION_BS3;attribute vec3 POSITION_BS4;attribute vec3 POSITION_BS5;attribute vec3 POSITION_BS6;attribute vec3 POSITION_BS7;uniform float renderer_BlendShapeWeights[8];\n#endif\n#endif\n#endif\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nvec3 getBlendShapeVertexElement(int blendShapeIndex,int vertexElementIndex){int y=vertexElementIndex/renderer_BlendShapeTextureInfo.y;int x=vertexElementIndex-y*renderer_BlendShapeTextureInfo.y;ivec3 uv=ivec3(x,y,blendShapeIndex);return texelFetch(renderer_BlendShapeTexture,uv,0).xyz;}\n#endif\n#endif\n"; // eslint-disable-line
|
|
14296
|
-
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14248
|
+
var blendShape_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_BLENDSHAPE\n#ifdef RENDERER_BLENDSHAPE_USE_TEXTURE\nint vertexOffset=gl_VertexID*renderer_BlendShapeTextureInfo.x;for(int i=0;i<RENDERER_BLENDSHAPE_COUNT;i++){int vertexElementOffset=vertexOffset;float weight=renderer_BlendShapeWeights[i];position.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#ifndef MATERIAL_OMIT_NORMAL\n#if defined( RENDERER_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_NORMAL )\nvertexElementOffset+=1;normal+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvertexElementOffset+=1;tangent.xyz+=getBlendShapeVertexElement(i,vertexElementOffset)*weight;\n#endif\n#endif\n}\n#else\nposition.xyz+=POSITION_BS0*renderer_BlendShapeWeights[0];position.xyz+=POSITION_BS1*renderer_BlendShapeWeights[1];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];\n#endif\n#if defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];\n#endif\n#endif\n#else\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) || defined( RENDERER_BLENDSHAPE_HAS_TANGENT )\n#ifndef MATERIAL_OMIT_NORMAL\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];\n#if defined( RENDERER_BLENDSHAPE_HAS_NORMAL ) && defined( RENDERER_HAS_NORMAL )\nnormal+=NORMAL_BS0*renderer_BlendShapeWeights[0];normal+=NORMAL_BS1*renderer_BlendShapeWeights[1];normal+=NORMAL_BS2*renderer_BlendShapeWeights[2];normal+=NORMAL_BS3*renderer_BlendShapeWeights[3];\n#endif\n#if defined(RENDERER_BLENDSHAPE_HAS_TANGENT) && defined( RENDERER_HAS_TANGENT ) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz+=TANGENT_BS0*renderer_BlendShapeWeights[0];tangent.xyz+=TANGENT_BS1*renderer_BlendShapeWeights[1];tangent.xyz+=TANGENT_BS2*renderer_BlendShapeWeights[2];tangent.xyz+=TANGENT_BS3*renderer_BlendShapeWeights[3];\n#endif\n#endif\n#else\nposition.xyz+=POSITION_BS2*renderer_BlendShapeWeights[2];position.xyz+=POSITION_BS3*renderer_BlendShapeWeights[3];position.xyz+=POSITION_BS4*renderer_BlendShapeWeights[4];position.xyz+=POSITION_BS5*renderer_BlendShapeWeights[5];position.xyz+=POSITION_BS6*renderer_BlendShapeWeights[6];position.xyz+=POSITION_BS7*renderer_BlendShapeWeights[7];\n#endif\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
14297
14249
|
var color_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_VERTEXCOLOR\nv_color=COLOR_0;\n#endif\n"; // eslint-disable-line
|
|
14298
14250
|
var FogVertex = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nvec4 positionVS=renderer_MVMat*position;v_positionVS=positionVS.xyz/positionVS.w;\n#endif\n"; // eslint-disable-line
|
|
14299
|
-
var normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nv_normal=normalize(mat3(renderer_NormalMat)*normal);\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14251
|
+
var normal_vert = "#define GLSLIFY 1\n#ifndef MATERIAL_OMIT_NORMAL\n#ifdef RENDERER_HAS_NORMAL\nv_normal=normalize(mat3(renderer_NormalMat)*normal);\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nvec3 normalW=normalize(mat3(renderer_NormalMat)*normal.xyz);vec3 tangentW=normalize(mat3(renderer_NormalMat)*tangent.xyz);vec3 bitangentW=cross(normalW,tangentW)*tangent.w;v_TBN=mat3(tangentW,bitangentW,normalW);\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
14300
14252
|
var position_vert = "#define GLSLIFY 1\ngl_Position=renderer_MVPMat*position;"; // eslint-disable-line
|
|
14301
|
-
var skinning_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_SKIN\n#ifdef RENDERER_USE_JOINT_TEXTURE\nmat4 skinMatrix=WEIGHTS_0.x*getJointMatrix(renderer_JointSampler,JOINTS_0.x)+WEIGHTS_0.y*getJointMatrix(renderer_JointSampler,JOINTS_0.y)+WEIGHTS_0.z*getJointMatrix(renderer_JointSampler,JOINTS_0.z)+WEIGHTS_0.w*getJointMatrix(renderer_JointSampler,JOINTS_0.w);\n#else\nmat4 skinMatrix=WEIGHTS_0.x*renderer_JointMatrix[int(JOINTS_0.x)]+WEIGHTS_0.y*renderer_JointMatrix[int(JOINTS_0.y)]+WEIGHTS_0.z*renderer_JointMatrix[int(JOINTS_0.z)]+WEIGHTS_0.w*renderer_JointMatrix[int(JOINTS_0.w)];\n#endif\nposition=skinMatrix*position;\n#if defined(RENDERER_HAS_NORMAL) && !defined(MATERIAL_OMIT_NORMAL)\nmat3 skinNormalMatrix=INVERSE_MAT(mat3(skinMatrix));normal=normal*skinNormalMatrix;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14302
|
-
var uv_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_UV\nv_uv=TEXCOORD_0;\n#else\nv_uv=vec2(0.,0.);\n#endif\n#ifdef RENDERER_HAS_UV1\nv_uv1=TEXCOORD_1;\n#endif\n#ifdef
|
|
14303
|
-
var worldpos_vert = "#define GLSLIFY 1\n#ifdef
|
|
14253
|
+
var skinning_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_SKIN\n#ifdef RENDERER_USE_JOINT_TEXTURE\nmat4 skinMatrix=WEIGHTS_0.x*getJointMatrix(renderer_JointSampler,JOINTS_0.x)+WEIGHTS_0.y*getJointMatrix(renderer_JointSampler,JOINTS_0.y)+WEIGHTS_0.z*getJointMatrix(renderer_JointSampler,JOINTS_0.z)+WEIGHTS_0.w*getJointMatrix(renderer_JointSampler,JOINTS_0.w);\n#else\nmat4 skinMatrix=WEIGHTS_0.x*renderer_JointMatrix[int(JOINTS_0.x)]+WEIGHTS_0.y*renderer_JointMatrix[int(JOINTS_0.y)]+WEIGHTS_0.z*renderer_JointMatrix[int(JOINTS_0.z)]+WEIGHTS_0.w*renderer_JointMatrix[int(JOINTS_0.w)];\n#endif\nposition=skinMatrix*position;\n#if defined(RENDERER_HAS_NORMAL) && !defined(MATERIAL_OMIT_NORMAL)\nmat3 skinNormalMatrix=INVERSE_MAT(mat3(skinMatrix));normal=normal*skinNormalMatrix;\n#if defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\ntangent.xyz=tangent.xyz*skinNormalMatrix;\n#endif\n#endif\n#endif\n"; // eslint-disable-line
|
|
14254
|
+
var uv_vert = "#define GLSLIFY 1\n#ifdef RENDERER_HAS_UV\nv_uv=TEXCOORD_0;\n#else\nv_uv=vec2(0.,0.);\n#endif\n#ifdef RENDERER_HAS_UV1\nv_uv1=TEXCOORD_1;\n#endif\n#ifdef MATERIAL_NEED_TILING_OFFSET\nv_uv=v_uv*material_TilingOffset.xy+material_TilingOffset.zw;\n#endif\n"; // eslint-disable-line
|
|
14255
|
+
var worldpos_vert = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec4 temp_pos=renderer_ModelMat*position;v_pos=temp_pos.xyz/temp_pos.w;\n#endif\n"; // eslint-disable-line
|
|
14304
14256
|
var FogFragment = "#define GLSLIFY 1\n#if SCENE_FOG_MODE != 0\nfloat fogIntensity=ComputeFogIntensity(length(v_positionVS));gl_FragColor.rgb=mix(scene_FogColor.rgb,gl_FragColor.rgb,fogIntensity);\n#endif\n"; // eslint-disable-line
|
|
14305
14257
|
var light_frag_define = "#define GLSLIFY 1\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nstruct DirectLight{vec3 color;vec3 direction;};uniform ivec2 scene_DirectLightCullingMask[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightColor[SCENE_DIRECT_LIGHT_COUNT];uniform vec3 scene_DirectLightDirection[SCENE_DIRECT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nstruct PointLight{vec3 color;vec3 position;float distance;};uniform ivec2 scene_PointLightCullingMask[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightColor[SCENE_POINT_LIGHT_COUNT];uniform vec3 scene_PointLightPosition[SCENE_POINT_LIGHT_COUNT];uniform float scene_PointLightDistance[SCENE_POINT_LIGHT_COUNT];\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nstruct SpotLight{vec3 color;vec3 position;vec3 direction;float distance;float angleCos;float penumbraCos;};uniform ivec2 scene_SpotLightCullingMask[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightColor[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightPosition[SCENE_SPOT_LIGHT_COUNT];uniform vec3 scene_SpotLightDirection[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightDistance[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightAngleCos[SCENE_SPOT_LIGHT_COUNT];uniform float scene_SpotLightPenumbraCos[SCENE_SPOT_LIGHT_COUNT];\n#endif\nstruct EnvMapLight{vec3 diffuse;float mipMapLevel;float diffuseIntensity;float specularIntensity;};uniform EnvMapLight scene_EnvMapLight;uniform ivec4 renderer_Layer;\n#ifdef SCENE_USE_SH\nuniform vec3 scene_EnvSH[9];\n#endif\n#ifdef SCENE_USE_SPECULAR_ENV\nuniform samplerCube scene_EnvSpecularSampler;\n#endif\n#ifndef GRAPHICS_API_WEBGL2\nbool isBitSet(float value,float mask,float bitIndex){return mod(floor(value/pow(2.0,bitIndex)),2.0)==1.0&&mod(floor(mask/pow(2.0,bitIndex)),2.0)==1.0;}\n#endif\nbool isRendererCulledByLight(ivec2 rendererLayer,ivec2 lightCullingMask){\n#ifdef GRAPHICS_API_WEBGL2\nreturn!((rendererLayer.x&lightCullingMask.x)!=0||(rendererLayer.y&lightCullingMask.y)!=0);\n#else\nfor(int i=0;i<16;i++){if(isBitSet(float(rendererLayer.x),float(lightCullingMask.x),float(i))||isBitSet(float(rendererLayer.y),float(lightCullingMask.y),float(i))){return false;}}return true;\n#endif\n}"; // eslint-disable-line
|
|
14306
14258
|
var mobile_material_frag = "#define GLSLIFY 1\nuniform vec4 material_EmissiveColor;uniform vec4 material_BaseColor;uniform vec4 material_SpecularColor;uniform float material_Shininess;uniform float material_NormalIntensity;uniform float material_AlphaCutoff;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nuniform sampler2D material_SpecularTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n"; // eslint-disable-line
|
|
14307
14259
|
var begin_mobile_frag = "#define GLSLIFY 1\nvec4 ambient=vec4(0.0);vec4 emission=material_EmissiveColor;vec4 diffuse=material_BaseColor;vec4 specular=material_SpecularColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveTextureColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveTextureColor=gammaToLinear(emissiveTextureColor);\n#endif\nemission*=emissiveTextureColor;\n#endif\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 diffuseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ndiffuseTextureColor=gammaToLinear(diffuseTextureColor);\n#endif\ndiffuse*=diffuseTextureColor;\n#endif\n#ifdef RENDERER_HAS_VERTEXCOLOR\ndiffuse*=v_color;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_TEXTURE\nvec4 specularTextureColor=texture2D(material_SpecularTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularTextureColor=gammaToLinear(specularTextureColor);\n#endif\nspecular*=specularTextureColor;\n#endif\nambient=vec4(scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity,1.0)*diffuse;"; // eslint-disable-line
|
|
14308
|
-
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef
|
|
14260
|
+
var begin_viewdir_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_NEED_WORLD_POS\nvec3 V=normalize(camera_Position-v_pos);\n#endif\n"; // eslint-disable-line
|
|
14309
14261
|
var mobile_blinnphong_frag = "#define GLSLIFY 1\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nmat3 tbn=getTBN();vec3 N=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\nvec3 N=getNormal();\n#endif\nvec3 lightDiffuse=vec3(0.0,0.0,0.0);vec3 lightSpecular=vec3(0.0,0.0,0.0);float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];float d=max(dot(N,-directionalLight.direction),0.0);lightDiffuse+=directionalLight.color*d;vec3 halfDir=normalize(V-directionalLight.direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess);lightSpecular+=directionalLight.color*s;}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];vec3 direction=v_pos-pointLight.position;float dist=length(direction);direction/=dist;float decay=clamp(1.0-pow(dist/pointLight.distance,4.0),0.0,1.0);float d=max(dot(N,-direction),0.0)*decay;lightDiffuse+=pointLight.color*d;vec3 halfDir=normalize(V-direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decay;lightSpecular+=pointLight.color*s;}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];vec3 direction=spotLight.position-v_pos;float lightDistance=length(direction);direction/=lightDistance;float angleCos=dot(direction,-spotLight.direction);float decay=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayTotal=decay*spotEffect;float d=max(dot(N,direction),0.0)*decayTotal;lightDiffuse+=spotLight.color*d;vec3 halfDir=normalize(V+direction);float s=pow(clamp(dot(N,halfDir),0.0,1.0),material_Shininess)*decayTotal;lightSpecular+=spotLight.color*s;}\n#endif\ndiffuse*=vec4(lightDiffuse,1.0);specular*=vec4(lightSpecular,1.0);\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(diffuse.a<material_AlphaCutoff){discard;}\n#endif\n"; // eslint-disable-line
|
|
14310
14262
|
var noise_cellular = "#define GLSLIFY 1\n#include <noise_cellular_2D>\n#include <noise_cellular_3D>\n#include <noise_cellular_2x2>\n#include <noise_cellular_2x2x2>\n"; // eslint-disable-line
|
|
14311
14263
|
var noise_cellular_2D = "#define GLSLIFY 1\nvec2 cellular(vec2 P){vec2 Pi=mod289(floor(P));vec2 Pf=fract(P);vec3 oi=vec3(-1.0,0.0,1.0);vec3 of=vec3(-0.5,0.5,1.5);vec3 px=permute(Pi.x+oi);vec3 p=permute(px.x+Pi.y+oi);vec3 ox=fract(p*K)-Ko;vec3 oy=mod7(floor(p*K))*K-Ko;vec3 dx=Pf.x+0.5+jitter*ox;vec3 dy=Pf.y-of+jitter*oy;vec3 d1=dx*dx+dy*dy;p=permute(px.y+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-0.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d2=dx*dx+dy*dy;p=permute(px.z+Pi.y+oi);ox=fract(p*K)-Ko;oy=mod7(floor(p*K))*K-Ko;dx=Pf.x-1.5+jitter*ox;dy=Pf.y-of+jitter*oy;vec3 d3=dx*dx+dy*dy;vec3 d1a=min(d1,d2);d2=max(d1,d2);d2=min(d2,d3);d1=min(d1a,d2);d2=max(d1a,d2);d1.xy=(d1.x<d1.y)? d1.xy : d1.yx;d1.xz=(d1.x<d1.z)? d1.xz : d1.zx;d1.yz=min(d1.yz,d2.yz);d1.y=min(d1.y,d1.z);d1.y=min(d1.y,d2.x);return sqrt(d1.xy);}"; // eslint-disable-line
|
|
@@ -14323,12 +14275,12 @@
|
|
|
14323
14275
|
var noise_simplex_3D = "#define GLSLIFY 1\nfloat simplex(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}"; // eslint-disable-line
|
|
14324
14276
|
var noise_simplex_3D_grad = "#define GLSLIFY 1\nfloat simplex(vec3 v,out vec3 gradient){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);vec4 m2=m*m;vec4 m4=m2*m2;vec4 pdotx=vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3));vec4 temp=m2*m*pdotx;gradient=-8.0*(temp.x*x0+temp.y*x1+temp.z*x2+temp.w*x3);gradient+=m4.x*p0+m4.y*p1+m4.z*p2+m4.w*p3;gradient*=42.0;return 42.0*dot(m4,pdotx);}"; // eslint-disable-line
|
|
14325
14277
|
var noise_simplex_4D = "#define GLSLIFY 1\nvec4 grad4(float j,vec4 ip){const vec4 ones=vec4(1.0,1.0,1.0,-1.0);vec4 p,s;p.xyz=floor(fract(vec3(j)*ip.xyz)*7.0)*ip.z-1.0;p.w=1.5-dot(abs(p.xyz),ones.xyz);s=vec4(lessThan(p,vec4(0.0)));p.xyz=p.xyz+(s.xyz*2.0-1.0)*s.www;return p;}\n#define F4 0.309016994374947451\nfloat simplex(vec4 v){const vec4 C=vec4(0.138196601125011,0.276393202250021,0.414589803375032,-0.447213595499958);vec4 i=floor(v+dot(v,vec4(F4)));vec4 x0=v-i+dot(i,C.xxxx);vec4 i0;vec3 isX=step(x0.yzw,x0.xxx);vec3 isYZ=step(x0.zww,x0.yyz);i0.x=isX.x+isX.y+isX.z;i0.yzw=1.0-isX;i0.y+=isYZ.x+isYZ.y;i0.zw+=1.0-isYZ.xy;i0.z+=isYZ.z;i0.w+=1.0-isYZ.z;vec4 i3=clamp(i0,0.0,1.0);vec4 i2=clamp(i0-1.0,0.0,1.0);vec4 i1=clamp(i0-2.0,0.0,1.0);vec4 x1=x0-i1+C.xxxx;vec4 x2=x0-i2+C.yyyy;vec4 x3=x0-i3+C.zzzz;vec4 x4=x0+C.wwww;i=mod289(i);float j0=permute(permute(permute(permute(i.w)+i.z)+i.y)+i.x);vec4 j1=permute(permute(permute(permute(i.w+vec4(i1.w,i2.w,i3.w,1.0))+i.z+vec4(i1.z,i2.z,i3.z,1.0))+i.y+vec4(i1.y,i2.y,i3.y,1.0))+i.x+vec4(i1.x,i2.x,i3.x,1.0));vec4 ip=vec4(1.0/294.0,1.0/49.0,1.0/7.0,0.0);vec4 p0=grad4(j0,ip);vec4 p1=grad4(j1.x,ip);vec4 p2=grad4(j1.y,ip);vec4 p3=grad4(j1.z,ip);vec4 p4=grad4(j1.w,ip);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;p4*=taylorInvSqrt(dot(p4,p4));vec3 m0=max(0.6-vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2)),0.0);vec2 m1=max(0.6-vec2(dot(x3,x3),dot(x4,x4)),0.0);m0=m0*m0;m1=m1*m1;return 49.0*(dot(m0*m0,vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2)))+dot(m1*m1,vec2(dot(p3,x3),dot(p4,x4))));}"; // eslint-disable-line
|
|
14326
|
-
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef
|
|
14327
|
-
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14278
|
+
var pbr_frag_define = "#define GLSLIFY 1\nuniform float material_AlphaCutoff;uniform vec4 material_BaseColor;uniform float material_Metal;uniform float material_Roughness;uniform vec3 material_PBRSpecularColor;uniform float material_Glossiness;uniform vec3 material_EmissiveColor;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nuniform float material_ClearCoat;uniform float material_ClearCoatRoughness;\n#endif\nuniform float material_NormalIntensity;uniform float material_OcclusionIntensity;uniform float material_OcclusionTextureCoord;\n#ifdef MATERIAL_HAS_BASETEXTURE\nuniform sampler2D material_BaseTexture;\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\nuniform sampler2D material_NormalTexture;\n#endif\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nuniform sampler2D material_EmissiveTexture;\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nuniform sampler2D material_RoughnessMetallicTexture;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nuniform sampler2D material_SpecularGlossinessTexture;\n#endif\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nuniform sampler2D material_OcclusionTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nuniform sampler2D material_ClearCoatTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nuniform sampler2D material_ClearCoatRoughnessTexture;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\nuniform sampler2D material_ClearCoatNormalTexture;\n#endif\nstruct ReflectedLight{vec3 directDiffuse;vec3 directSpecular;vec3 indirectDiffuse;vec3 indirectSpecular;};struct Geometry{vec3 position;vec3 normal;vec3 viewDir;float dotNV;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatNormal;float clearCoatDotNV;\n#endif\n};struct Material{vec3 diffuseColor;float roughness;vec3 specularColor;float opacity;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoat;float clearCoatRoughness;\n#endif\n};"; // eslint-disable-line
|
|
14279
|
+
var pbr_helper = "#define GLSLIFY 1\n#include <normal_get>\nfloat computeSpecularOcclusion(float ambientOcclusion,float roughness,float dotNV){return saturate(pow(dotNV+ambientOcclusion,exp2(-16.0*roughness-1.0))-1.0+ambientOcclusion);}float getAARoughnessFactor(vec3 normal){\n#ifdef HAS_DERIVATIVES\nvec3 dxy=max(abs(dFdx(normal)),abs(dFdy(normal)));return 0.04+max(max(dxy.x,dxy.y),dxy.z);\n#else\nreturn 0.04;\n#endif\n}void initGeometry(out Geometry geometry){geometry.position=v_pos;geometry.viewDir=normalize(camera_Position-v_pos);\n#if defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE)\nmat3 tbn=getTBN();\n#endif\n#ifdef MATERIAL_HAS_NORMALTEXTURE\ngeometry.normal=getNormalByNormalTexture(tbn,material_NormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.normal=getNormal();\n#endif\ngeometry.dotNV=saturate(dot(geometry.normal,geometry.viewDir));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\n#ifdef MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE\ngeometry.clearCoatNormal=getNormalByNormalTexture(tbn,material_ClearCoatNormalTexture,material_NormalIntensity,v_uv);\n#else\ngeometry.clearCoatNormal=getNormal();\n#endif\ngeometry.clearCoatDotNV=saturate(dot(geometry.clearCoatNormal,geometry.viewDir));\n#endif\n}void initMaterial(out Material material,const in Geometry geometry){vec4 baseColor=material_BaseColor;float metal=material_Metal;float roughness=material_Roughness;vec3 specularColor=material_PBRSpecularColor;float glossiness=material_Glossiness;float alphaCutoff=material_AlphaCutoff;\n#ifdef MATERIAL_HAS_BASETEXTURE\nvec4 baseTextureColor=texture2D(material_BaseTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nbaseTextureColor=gammaToLinear(baseTextureColor);\n#endif\nbaseColor*=baseTextureColor;\n#endif\n#ifdef RENDERER_HAS_VERTEXCOLOR\nbaseColor*=v_color;\n#endif\n#ifdef MATERIAL_IS_ALPHA_CUTOFF\nif(baseColor.a<alphaCutoff){discard;}\n#endif\n#ifdef MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE\nvec4 metalRoughMapColor=texture2D(material_RoughnessMetallicTexture,v_uv);roughness*=metalRoughMapColor.g;metal*=metalRoughMapColor.b;\n#endif\n#ifdef MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE\nvec4 specularGlossinessColor=texture2D(material_SpecularGlossinessTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nspecularGlossinessColor=gammaToLinear(specularGlossinessColor);\n#endif\nspecularColor*=specularGlossinessColor.rgb;glossiness*=specularGlossinessColor.a;\n#endif\n#ifdef IS_METALLIC_WORKFLOW\nmaterial.diffuseColor=baseColor.rgb*(1.0-metal);material.specularColor=mix(vec3(0.04),baseColor.rgb,metal);material.roughness=roughness;\n#else\nfloat specularStrength=max(max(specularColor.r,specularColor.g),specularColor.b);material.diffuseColor=baseColor.rgb*(1.0-specularStrength);material.specularColor=specularColor;material.roughness=1.0-glossiness;\n#endif\nmaterial.roughness=max(material.roughness,getAARoughnessFactor(geometry.normal));\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nmaterial.clearCoat=material_ClearCoat;material.clearCoatRoughness=material_ClearCoatRoughness;\n#ifdef MATERIAL_HAS_CLEAR_COAT_TEXTURE\nmaterial.clearCoat*=texture2D(material_ClearCoatTexture,v_uv).r;\n#endif\n#ifdef MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE\nmaterial.clearCoatRoughness*=texture2D(material_ClearCoatRoughnessTexture,v_uv).g;\n#endif\nmaterial.clearCoat=saturate(material.clearCoat);material.clearCoatRoughness=max(material.clearCoatRoughness,getAARoughnessFactor(geometry.clearCoatNormal));\n#endif\n#ifdef MATERIAL_IS_TRANSPARENT\nmaterial.opacity=baseColor.a;\n#else\nmaterial.opacity=1.0;\n#endif\n}\n#include <brdf>\n#include <direct_irradiance_frag_define>\n#include <ibl_frag_define>\n"; // eslint-disable-line
|
|
14328
14280
|
var brdf = "#define GLSLIFY 1\nfloat F_Schlick(float dotLH){return 0.04+0.96*(pow(1.0-dotLH,5.0));}vec3 F_Schlick(vec3 specularColor,float dotLH){float fresnel=exp2((-5.55473*dotLH-6.98316)*dotLH);return(1.0-specularColor)*fresnel+specularColor;}float G_GGX_SmithCorrelated(float alpha,float dotNL,float dotNV){float a2=pow2(alpha);float gv=dotNL*sqrt(a2+(1.0-a2)*pow2(dotNV));float gl=dotNV*sqrt(a2+(1.0-a2)*pow2(dotNL));return 0.5/max(gv+gl,EPSILON);}float D_GGX(float alpha,float dotNH){float a2=pow2(alpha);float denom=pow2(dotNH)*(a2-1.0)+1.0;return RECIPROCAL_PI*a2/pow2(denom);}vec3 BRDF_Specular_GGX(vec3 incidentDirection,vec3 viewDir,vec3 normal,vec3 specularColor,float roughness){float alpha=pow2(roughness);vec3 halfDir=normalize(incidentDirection+viewDir);float dotNL=saturate(dot(normal,incidentDirection));float dotNV=saturate(dot(normal,viewDir));float dotNH=saturate(dot(normal,halfDir));float dotLH=saturate(dot(incidentDirection,halfDir));vec3 F=F_Schlick(specularColor,dotLH);float G=G_GGX_SmithCorrelated(alpha,dotNL,dotNV);float D=D_GGX(alpha,dotNH);return F*(G*D);}vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor){return RECIPROCAL_PI*diffuseColor;}"; // eslint-disable-line
|
|
14329
|
-
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef
|
|
14281
|
+
var direct_irradiance_frag_define = "#define GLSLIFY 1\n#include <ShadowFragmentDeclaration>\nvoid addDirectRadiance(vec3 incidentDirection,vec3 color,Geometry geometry,Material material,inout ReflectedLight reflectedLight){float attenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nfloat clearCoatDotNL=saturate(dot(geometry.clearCoatNormal,incidentDirection));vec3 clearCoatIrradiance=clearCoatDotNL*color;reflectedLight.directSpecular+=material.clearCoat*clearCoatIrradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.clearCoatNormal,vec3(0.04),material.clearCoatRoughness);attenuation-=material.clearCoat*F_Schlick(geometry.clearCoatDotNV);\n#endif\nfloat dotNL=saturate(dot(geometry.normal,incidentDirection));vec3 irradiance=dotNL*color*PI;reflectedLight.directSpecular+=attenuation*irradiance*BRDF_Specular_GGX(incidentDirection,geometry.viewDir,geometry.normal,material.specularColor,material.roughness);reflectedLight.directDiffuse+=attenuation*irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);}\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nvoid addDirectionalDirectLightRadiance(DirectLight directionalLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 color=directionalLight.color;vec3 direction=-directionalLight.direction;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nvoid addPointDirectLightRadiance(PointLight pointLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=pointLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);vec3 color=pointLight.color;color*=clamp(1.0-pow(lightDistance/pointLight.distance,4.0),0.0,1.0);addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nvoid addSpotDirectLightRadiance(SpotLight spotLight,Geometry geometry,Material material,inout ReflectedLight reflectedLight){vec3 lVector=spotLight.position-geometry.position;vec3 direction=normalize(lVector);float lightDistance=length(lVector);float angleCos=dot(direction,-spotLight.direction);float spotEffect=smoothstep(spotLight.penumbraCos,spotLight.angleCos,angleCos);float decayEffect=clamp(1.0-pow(lightDistance/spotLight.distance,4.0),0.0,1.0);vec3 color=spotLight.color;color*=spotEffect*decayEffect;addDirectRadiance(direction,color,geometry,material,reflectedLight);}\n#endif\nvoid addTotalDirectRadiance(Geometry geometry,Material material,inout ReflectedLight reflectedLight){float shadowAttenuation=1.0;\n#ifdef SCENE_DIRECT_LIGHT_COUNT\nshadowAttenuation=1.0;\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nshadowAttenuation*=sampleShadowMap();int sunIndex=int(scene_ShadowInfo.z);\n#endif\nDirectLight directionalLight;for(int i=0;i<SCENE_DIRECT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_DirectLightCullingMask[i]))continue;directionalLight.color=scene_DirectLightColor[i];\n#ifdef SCENE_IS_CALCULATE_SHADOWS\nif(i==sunIndex){directionalLight.color*=shadowAttenuation;}\n#endif\ndirectionalLight.direction=scene_DirectLightDirection[i];addDirectionalDirectLightRadiance(directionalLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_POINT_LIGHT_COUNT\nPointLight pointLight;for(int i=0;i<SCENE_POINT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_PointLightCullingMask[i]))continue;pointLight.color=scene_PointLightColor[i];pointLight.position=scene_PointLightPosition[i];pointLight.distance=scene_PointLightDistance[i];addPointDirectLightRadiance(pointLight,geometry,material,reflectedLight);}\n#endif\n#ifdef SCENE_SPOT_LIGHT_COUNT\nSpotLight spotLight;for(int i=0;i<SCENE_SPOT_LIGHT_COUNT;i++){if(isRendererCulledByLight(renderer_Layer.xy,scene_SpotLightCullingMask[i]))continue;spotLight.color=scene_SpotLightColor[i];spotLight.position=scene_SpotLightPosition[i];spotLight.direction=scene_SpotLightDirection[i];spotLight.distance=scene_SpotLightDistance[i];spotLight.angleCos=scene_SpotLightAngleCos[i];spotLight.penumbraCos=scene_SpotLightPenumbraCos[i];addSpotDirectLightRadiance(spotLight,geometry,material,reflectedLight);}\n#endif\n}"; // eslint-disable-line
|
|
14330
14282
|
var ibl_frag_define = "#define GLSLIFY 1\nvec3 getLightProbeIrradiance(vec3 sh[9],vec3 normal){normal.x=-normal.x;vec3 result=sh[0]+sh[1]*(normal.y)+sh[2]*(normal.z)+sh[3]*(normal.x)+sh[4]*(normal.y*normal.x)+sh[5]*(normal.y*normal.z)+sh[6]*(3.0*normal.z*normal.z-1.0)+sh[7]*(normal.z*normal.x)+sh[8]*(normal.x*normal.x-normal.y*normal.y);return max(result,vec3(0.0));}vec3 envBRDFApprox(vec3 specularColor,float roughness,float dotNV){const vec4 c0=vec4(-1,-0.0275,-0.572,0.022);const vec4 c1=vec4(1,0.0425,1.04,-0.04);vec4 r=roughness*c0+c1;float a004=min(r.x*r.x,exp2(-9.28*dotNV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}float getSpecularMIPLevel(float roughness,int maxMIPLevel){return roughness*float(maxMIPLevel);}vec3 getLightProbeRadiance(vec3 viewDir,vec3 normal,float roughness,int maxMIPLevel,float specularIntensity){\n#ifndef SCENE_USE_SPECULAR_ENV\nreturn vec3(0);\n#else\nvec3 reflectVec=reflect(-viewDir,normal);reflectVec.x=-reflectVec.x;float specularMIPLevel=getSpecularMIPLevel(roughness,maxMIPLevel);\n#ifdef HAS_TEX_LOD\nvec4 envMapColor=textureCubeLodEXT(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#else\nvec4 envMapColor=textureCube(scene_EnvSpecularSampler,reflectVec,specularMIPLevel);\n#endif\n#ifdef SCENE_IS_DECODE_ENV_RGBM\nenvMapColor.rgb=RGBMToLinear(envMapColor,5.0).rgb;\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=linearToGamma(envMapColor);\n#endif\n#else\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nenvMapColor=gammaToLinear(envMapColor);\n#endif\n#endif\nreturn envMapColor.rgb*specularIntensity;\n#endif\n}"; // eslint-disable-line
|
|
14331
|
-
var pbr_frag = "#define GLSLIFY 1\nGeometry geometry;Material material;ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));initGeometry(geometry);initMaterial(material,geometry);addTotalDirectRadiance(geometry,material,reflectedLight);\n#ifdef SCENE_USE_SH\nvec3 irradiance=getLightProbeIrradiance(scene_EnvSH,geometry.normal);\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nirradiance=linearToGamma(vec4(irradiance,1.0)).rgb;\n#endif\nirradiance*=scene_EnvMapLight.diffuseIntensity;\n#else\nvec3 irradiance=scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity;irradiance*=PI;\n#endif\nreflectedLight.indirectDiffuse+=irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);vec3 radiance=getLightProbeRadiance(geometry.viewDir,geometry.normal,material.roughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);float radianceAttenuation=1.0;\n#ifdef
|
|
14283
|
+
var pbr_frag = "#define GLSLIFY 1\nGeometry geometry;Material material;ReflectedLight reflectedLight=ReflectedLight(vec3(0.0),vec3(0.0),vec3(0.0),vec3(0.0));initGeometry(geometry);initMaterial(material,geometry);addTotalDirectRadiance(geometry,material,reflectedLight);\n#ifdef SCENE_USE_SH\nvec3 irradiance=getLightProbeIrradiance(scene_EnvSH,geometry.normal);\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\nirradiance=linearToGamma(vec4(irradiance,1.0)).rgb;\n#endif\nirradiance*=scene_EnvMapLight.diffuseIntensity;\n#else\nvec3 irradiance=scene_EnvMapLight.diffuse*scene_EnvMapLight.diffuseIntensity;irradiance*=PI;\n#endif\nreflectedLight.indirectDiffuse+=irradiance*BRDF_Diffuse_Lambert(material.diffuseColor);vec3 radiance=getLightProbeRadiance(geometry.viewDir,geometry.normal,material.roughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);float radianceAttenuation=1.0;\n#ifdef MATERIAL_ENABLE_CLEAR_COAT\nvec3 clearCoatRadiance=getLightProbeRadiance(geometry.viewDir,geometry.clearCoatNormal,material.clearCoatRoughness,int(scene_EnvMapLight.mipMapLevel),scene_EnvMapLight.specularIntensity);reflectedLight.indirectSpecular+=clearCoatRadiance*material.clearCoat*envBRDFApprox(vec3(0.04),material.clearCoatRoughness,geometry.clearCoatDotNV);radianceAttenuation-=material.clearCoat*F_Schlick(geometry.clearCoatDotNV);\n#endif\nreflectedLight.indirectSpecular+=radianceAttenuation*radiance*envBRDFApprox(material.specularColor,material.roughness,geometry.dotNV);\n#ifdef MATERIAL_HAS_OCCLUSION_TEXTURE\nvec2 aoUV=v_uv;\n#ifdef RENDERER_HAS_UV1\nif(material_OcclusionTextureCoord==1.0){aoUV=v_uv1;}\n#endif\nfloat ambientOcclusion=(texture2D(material_OcclusionTexture,aoUV).r-1.0)*material_OcclusionIntensity+1.0;reflectedLight.indirectDiffuse*=ambientOcclusion;\n#ifdef SCENE_USE_SPECULAR_ENV\nreflectedLight.indirectSpecular*=computeSpecularOcclusion(ambientOcclusion,material.roughness,geometry.dotNV);\n#endif\n#endif\nvec3 emissiveRadiance=material_EmissiveColor;\n#ifdef MATERIAL_HAS_EMISSIVETEXTURE\nvec4 emissiveColor=texture2D(material_EmissiveTexture,v_uv);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\nemissiveColor=gammaToLinear(emissiveColor);\n#endif\nemissiveRadiance*=emissiveColor.rgb;\n#endif\nvec3 totalRadiance=reflectedLight.directDiffuse+reflectedLight.indirectDiffuse+reflectedLight.directSpecular+reflectedLight.indirectSpecular+emissiveRadiance;vec4 targetColor=vec4(totalRadiance,material.opacity);gl_FragColor=targetColor;"; // eslint-disable-line
|
|
14332
14284
|
var PBRShaderLib = {
|
|
14333
14285
|
pbr_frag_define: pbr_frag_define,
|
|
14334
14286
|
pbr_helper: pbr_helper,
|
|
@@ -14349,7 +14301,7 @@
|
|
|
14349
14301
|
ShadowVertexDeclaration: ShadowVertexDeclaration,
|
|
14350
14302
|
ShadowVertex: ShadowVertex
|
|
14351
14303
|
};
|
|
14352
|
-
var normal_get = "#define GLSLIFY 1\nvec3 getNormal(){\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=normalize(v_normal);\n#elif defined(HAS_DERIVATIVES)\nvec3 pos_dx=dFdx(v_pos);vec3 pos_dy=dFdy(v_pos);vec3 normal=normalize(cross(pos_dx,pos_dy));\n#else\nvec3 normal=vec3(0,0,1);\n#endif\nnormal*=float(gl_FrontFacing)*2.0-1.0;return normal;}vec3 getNormalByNormalTexture(mat3 tbn,sampler2D normalTexture,float normalIntensity,vec2 uv){vec3 normal=texture2D(normalTexture,uv).rgb;normal=normalize(tbn*((2.0*normal-1.0)*vec3(normalIntensity,normalIntensity,1.0)));normal*=float(gl_FrontFacing)*2.0-1.0;return normal;}mat3 getTBN(){\n#if defined(RENDERER_HAS_NORMAL) && defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(
|
|
14304
|
+
var normal_get = "#define GLSLIFY 1\nvec3 getNormal(){\n#ifdef RENDERER_HAS_NORMAL\nvec3 normal=normalize(v_normal);\n#elif defined(HAS_DERIVATIVES)\nvec3 pos_dx=dFdx(v_pos);vec3 pos_dy=dFdy(v_pos);vec3 normal=normalize(cross(pos_dx,pos_dy));\n#else\nvec3 normal=vec3(0,0,1);\n#endif\nnormal*=float(gl_FrontFacing)*2.0-1.0;return normal;}vec3 getNormalByNormalTexture(mat3 tbn,sampler2D normalTexture,float normalIntensity,vec2 uv){vec3 normal=texture2D(normalTexture,uv).rgb;normal=normalize(tbn*((2.0*normal-1.0)*vec3(normalIntensity,normalIntensity,1.0)));normal*=float(gl_FrontFacing)*2.0-1.0;return normal;}mat3 getTBN(){\n#if defined(RENDERER_HAS_NORMAL) && defined(RENDERER_HAS_TANGENT) && ( defined(MATERIAL_HAS_NORMALTEXTURE) || defined(MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE) )\nmat3 tbn=v_TBN;\n#else\nvec3 normal=getNormal();vec3 position=v_pos;vec2 uv=gl_FrontFacing? v_uv:-v_uv;\n#ifdef HAS_DERIVATIVES\nvec3 dp1=dFdx(position);vec3 dp2=dFdy(position);vec2 duv1=dFdx(uv);vec2 duv2=dFdy(uv);vec3 dp2perp=cross(dp2,normal);vec3 dp1perp=cross(normal,dp1);vec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;vec3 binormal=dp2perp*duv1.y+dp1perp*duv2.y;float invmax=inversesqrt(max(dot(tangent,tangent),dot(binormal,binormal)));mat3 tbn=mat3(tangent*invmax,binormal*invmax,normal);\n#else\nmat3 tbn=mat3(vec3(0.0),vec3(0.0),normal);\n#endif\n#endif\nreturn tbn;}"; // eslint-disable-line
|
|
14353
14305
|
var ShaderLib = _extends$2({
|
|
14354
14306
|
common: common,
|
|
14355
14307
|
common_vert: common_vert,
|
|
@@ -15450,7 +15402,6 @@
|
|
|
15450
15402
|
};
|
|
15451
15403
|
_proto.update = function update(deltaTime) {};
|
|
15452
15404
|
/**
|
|
15453
|
-
* @override
|
|
15454
15405
|
* @internal
|
|
15455
15406
|
*/ _proto._onEnable = function _onEnable() {
|
|
15456
15407
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -15460,7 +15411,6 @@
|
|
|
15460
15411
|
componentsManager.addRenderer(this);
|
|
15461
15412
|
};
|
|
15462
15413
|
/**
|
|
15463
|
-
* @override
|
|
15464
15414
|
* @internal
|
|
15465
15415
|
*/ _proto._onDisable = function _onDisable() {
|
|
15466
15416
|
var componentsManager = this.engine._componentsManager;
|
|
@@ -15487,7 +15437,6 @@
|
|
|
15487
15437
|
ShaderMacroCollection.unionCollection(context.camera._globalShaderMacro, this.shaderData._macroCollection, this._globalShaderMacro);
|
|
15488
15438
|
};
|
|
15489
15439
|
/**
|
|
15490
|
-
* @override
|
|
15491
15440
|
* @internal
|
|
15492
15441
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
15493
15442
|
Component.prototype._onDestroy.call(this);
|
|
@@ -15873,9 +15822,7 @@
|
|
|
15873
15822
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
15874
15823
|
target.sprite = this._sprite;
|
|
15875
15824
|
};
|
|
15876
|
-
|
|
15877
|
-
* @override
|
|
15878
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
15825
|
+
_proto._updateBounds = function _updateBounds(worldBounds) {
|
|
15879
15826
|
var _this_sprite;
|
|
15880
15827
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
15881
15828
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -15885,7 +15832,6 @@
|
|
|
15885
15832
|
}
|
|
15886
15833
|
};
|
|
15887
15834
|
/**
|
|
15888
|
-
* @override
|
|
15889
15835
|
* @inheritdoc
|
|
15890
15836
|
*/ _proto._render = function _render(context) {
|
|
15891
15837
|
var _this_sprite;
|
|
@@ -15911,7 +15857,6 @@
|
|
|
15911
15857
|
this._maskElement = renderElement;
|
|
15912
15858
|
};
|
|
15913
15859
|
/**
|
|
15914
|
-
* @override
|
|
15915
15860
|
* @inheritdoc
|
|
15916
15861
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
15917
15862
|
var _this__sprite;
|
|
@@ -16325,16 +16270,11 @@
|
|
|
16325
16270
|
if (dataOffset === void 0) dataOffset = 0;
|
|
16326
16271
|
this._platformBuffer.getData(data, bufferByteOffset, dataOffset, dataLength);
|
|
16327
16272
|
};
|
|
16328
|
-
|
|
16329
|
-
* @override
|
|
16330
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
16273
|
+
_proto._rebuild = function _rebuild() {
|
|
16331
16274
|
var platformBuffer = this._engine._hardwareRenderer.createPlatformBuffer(this._type, this._byteLength, this._bufferUsage);
|
|
16332
16275
|
this._platformBuffer = platformBuffer;
|
|
16333
16276
|
};
|
|
16334
|
-
|
|
16335
|
-
* @override
|
|
16336
|
-
* @internal
|
|
16337
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
16277
|
+
_proto._onDestroy = function _onDestroy() {
|
|
16338
16278
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
16339
16279
|
this._platformBuffer.destroy();
|
|
16340
16280
|
};
|
|
@@ -16522,22 +16462,17 @@
|
|
|
16522
16462
|
this._platformPrimitive.draw(shaderProgram, subMesh);
|
|
16523
16463
|
this._bufferStructChanged = false;
|
|
16524
16464
|
};
|
|
16525
|
-
|
|
16526
|
-
* @override
|
|
16527
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
16465
|
+
_proto._addReferCount = function _addReferCount(value) {
|
|
16528
16466
|
GraphicsResource.prototype._addReferCount.call(this, value);
|
|
16529
16467
|
var vertexBufferBindings = this._vertexBufferBindings;
|
|
16530
16468
|
for(var i = 0, n = vertexBufferBindings.length; i < n; i++){
|
|
16531
16469
|
vertexBufferBindings[i]._buffer._addReferCount(value);
|
|
16532
16470
|
}
|
|
16533
16471
|
};
|
|
16534
|
-
|
|
16535
|
-
* @override
|
|
16536
|
-
*/ _proto._rebuild = function _rebuild() {
|
|
16472
|
+
_proto._rebuild = function _rebuild() {
|
|
16537
16473
|
this._engine._hardwareRenderer.createPlatformPrimitive(this);
|
|
16538
16474
|
};
|
|
16539
16475
|
/**
|
|
16540
|
-
* @override
|
|
16541
16476
|
* @internal
|
|
16542
16477
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
16543
16478
|
GraphicsResource.prototype._onDestroy.call(this);
|
|
@@ -17687,10 +17622,7 @@
|
|
|
17687
17622
|
}
|
|
17688
17623
|
this.setTangents(tangents);
|
|
17689
17624
|
};
|
|
17690
|
-
|
|
17691
|
-
* @override
|
|
17692
|
-
* @internal
|
|
17693
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
17625
|
+
_proto._onDestroy = function _onDestroy() {
|
|
17694
17626
|
Mesh.prototype._onDestroy.call(this);
|
|
17695
17627
|
this._readable && this._releaseCache();
|
|
17696
17628
|
};
|
|
@@ -18163,10 +18095,7 @@
|
|
|
18163
18095
|
};
|
|
18164
18096
|
_inherits$2(MeshRenderer, Renderer);
|
|
18165
18097
|
var _proto = MeshRenderer.prototype;
|
|
18166
|
-
|
|
18167
|
-
* @internal
|
|
18168
|
-
* @override
|
|
18169
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
18098
|
+
_proto._onDestroy = function _onDestroy() {
|
|
18170
18099
|
Renderer.prototype._onDestroy.call(this);
|
|
18171
18100
|
var mesh = this._mesh;
|
|
18172
18101
|
if (mesh && !mesh.destroyed) {
|
|
@@ -18179,9 +18108,7 @@
|
|
|
18179
18108
|
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
18180
18109
|
target.mesh = this._mesh;
|
|
18181
18110
|
};
|
|
18182
|
-
|
|
18183
|
-
* @override
|
|
18184
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18111
|
+
_proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18185
18112
|
var mesh = this._mesh;
|
|
18186
18113
|
if (mesh) {
|
|
18187
18114
|
var localBounds = mesh.bounds;
|
|
@@ -18192,9 +18119,7 @@
|
|
|
18192
18119
|
worldBounds.max.set(0, 0, 0);
|
|
18193
18120
|
}
|
|
18194
18121
|
};
|
|
18195
|
-
|
|
18196
|
-
* @override
|
|
18197
|
-
*/ _proto._render = function _render(context) {
|
|
18122
|
+
_proto._render = function _render(context) {
|
|
18198
18123
|
var mesh = this._mesh;
|
|
18199
18124
|
if (mesh) {
|
|
18200
18125
|
if (this._dirtyUpdateFlag & 0x2) {
|
|
@@ -18354,9 +18279,7 @@
|
|
|
18354
18279
|
}
|
|
18355
18280
|
}
|
|
18356
18281
|
};
|
|
18357
|
-
|
|
18358
|
-
* @override
|
|
18359
|
-
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
18282
|
+
_proto._updateShaderData = function _updateShaderData(context) {
|
|
18360
18283
|
var entity = this.entity;
|
|
18361
18284
|
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
18362
18285
|
this._updateTransformShaderData(context, worldMatrix);
|
|
@@ -18411,14 +18334,10 @@
|
|
|
18411
18334
|
MeshRenderer.prototype._cloneTo.call(this, target);
|
|
18412
18335
|
this._blendShapeWeights && (target._blendShapeWeights = this._blendShapeWeights.slice());
|
|
18413
18336
|
};
|
|
18414
|
-
|
|
18415
|
-
* @override
|
|
18416
|
-
*/ _proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
18337
|
+
_proto._registerEntityTransformListener = function _registerEntityTransformListener() {
|
|
18417
18338
|
// Cancel register listener to entity transform.
|
|
18418
18339
|
};
|
|
18419
|
-
|
|
18420
|
-
* @override
|
|
18421
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18340
|
+
_proto._updateBounds = function _updateBounds(worldBounds) {
|
|
18422
18341
|
if (this._rootBone) {
|
|
18423
18342
|
var localBounds = this._localBounds;
|
|
18424
18343
|
var worldMatrix = this._rootBone.transform.worldMatrix;
|
|
@@ -18637,9 +18556,7 @@
|
|
|
18637
18556
|
};
|
|
18638
18557
|
_inherits$2(PrimitiveMeshRestorer, ContentRestorer);
|
|
18639
18558
|
var _proto = PrimitiveMeshRestorer.prototype;
|
|
18640
|
-
|
|
18641
|
-
* @override
|
|
18642
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
18559
|
+
_proto.restoreContent = function restoreContent() {
|
|
18643
18560
|
var primitiveInfo = this.primitiveInfo;
|
|
18644
18561
|
switch(primitiveInfo.type){
|
|
18645
18562
|
case 0:
|
|
@@ -18698,7 +18615,6 @@
|
|
|
18698
18615
|
_this = PrimitiveRestoreInfo.call(this, 0, noLongerAccessible) || this;
|
|
18699
18616
|
_this.radius = radius;
|
|
18700
18617
|
_this.segments = segments;
|
|
18701
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18702
18618
|
return _this;
|
|
18703
18619
|
};
|
|
18704
18620
|
_inherits$2(SphereRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18713,7 +18629,6 @@
|
|
|
18713
18629
|
_this.width = width;
|
|
18714
18630
|
_this.height = height;
|
|
18715
18631
|
_this.depth = depth;
|
|
18716
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18717
18632
|
return _this;
|
|
18718
18633
|
};
|
|
18719
18634
|
_inherits$2(CuboidRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18729,7 +18644,6 @@
|
|
|
18729
18644
|
_this.height = height;
|
|
18730
18645
|
_this.horizontalSegments = horizontalSegments;
|
|
18731
18646
|
_this.verticalSegments = verticalSegments;
|
|
18732
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18733
18647
|
return _this;
|
|
18734
18648
|
};
|
|
18735
18649
|
_inherits$2(PlaneRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18746,7 +18660,6 @@
|
|
|
18746
18660
|
_this.height = height;
|
|
18747
18661
|
_this.radialSegments = radialSegments;
|
|
18748
18662
|
_this.heightSegments = heightSegments;
|
|
18749
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18750
18663
|
return _this;
|
|
18751
18664
|
};
|
|
18752
18665
|
_inherits$2(CylinderRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18763,7 +18676,6 @@
|
|
|
18763
18676
|
_this.radialSegments = radialSegments;
|
|
18764
18677
|
_this.tubularSegments = tubularSegments;
|
|
18765
18678
|
_this.arc = arc;
|
|
18766
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18767
18679
|
return _this;
|
|
18768
18680
|
};
|
|
18769
18681
|
_inherits$2(TorusRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18779,7 +18691,6 @@
|
|
|
18779
18691
|
_this.height = height;
|
|
18780
18692
|
_this.radialSegments = radialSegments;
|
|
18781
18693
|
_this.heightSegments = heightSegments;
|
|
18782
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18783
18694
|
return _this;
|
|
18784
18695
|
};
|
|
18785
18696
|
_inherits$2(ConeRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -18795,7 +18706,6 @@
|
|
|
18795
18706
|
_this.height = height;
|
|
18796
18707
|
_this.radialSegments = radialSegments;
|
|
18797
18708
|
_this.heightSegments = heightSegments;
|
|
18798
|
-
_this.noLongerAccessible = noLongerAccessible;
|
|
18799
18709
|
return _this;
|
|
18800
18710
|
};
|
|
18801
18711
|
_inherits$2(CapsuleRestoreInfo, PrimitiveRestoreInfo);
|
|
@@ -21741,14 +21651,12 @@
|
|
|
21741
21651
|
/**
|
|
21742
21652
|
* @internal
|
|
21743
21653
|
* @inheritDoc
|
|
21744
|
-
* @override
|
|
21745
21654
|
*/ _proto._onAwake = function _onAwake() {
|
|
21746
21655
|
this.onAwake();
|
|
21747
21656
|
};
|
|
21748
21657
|
/**
|
|
21749
21658
|
* @internal
|
|
21750
21659
|
* @inheritDoc
|
|
21751
|
-
* @override
|
|
21752
21660
|
*/ _proto._onEnable = function _onEnable() {
|
|
21753
21661
|
if (this._waitHandlingInValid) {
|
|
21754
21662
|
this._waitHandlingInValid = false;
|
|
@@ -21774,7 +21682,6 @@
|
|
|
21774
21682
|
/**
|
|
21775
21683
|
* @internal
|
|
21776
21684
|
* @inheritDoc
|
|
21777
|
-
* @override
|
|
21778
21685
|
*/ _proto._onDisable = function _onDisable() {
|
|
21779
21686
|
this._waitHandlingInValid = true;
|
|
21780
21687
|
this._engine._componentsManager.addDisableScript(this);
|
|
@@ -21797,10 +21704,7 @@
|
|
|
21797
21704
|
this._entity._removeScript(this);
|
|
21798
21705
|
this._waitHandlingInValid = false;
|
|
21799
21706
|
};
|
|
21800
|
-
|
|
21801
|
-
* @override
|
|
21802
|
-
* @internal
|
|
21803
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
21707
|
+
_proto._onDestroy = function _onDestroy() {
|
|
21804
21708
|
Component.prototype._onDestroy.call(this);
|
|
21805
21709
|
this._engine._componentsManager.addPendingDestroyScript(this);
|
|
21806
21710
|
};
|
|
@@ -23463,19 +23367,16 @@
|
|
|
23463
23367
|
this._replacementSubShaderTag = null;
|
|
23464
23368
|
};
|
|
23465
23369
|
/**
|
|
23466
|
-
* @override
|
|
23467
23370
|
* @inheritdoc
|
|
23468
23371
|
*/ _proto._onEnable = function _onEnable() {
|
|
23469
23372
|
this.entity.scene._attachRenderCamera(this);
|
|
23470
23373
|
};
|
|
23471
23374
|
/**
|
|
23472
|
-
* @override
|
|
23473
23375
|
* @inheritdoc
|
|
23474
23376
|
*/ _proto._onDisable = function _onDisable() {
|
|
23475
23377
|
this.entity.scene._detachRenderCamera(this);
|
|
23476
23378
|
};
|
|
23477
23379
|
/**
|
|
23478
|
-
* @override
|
|
23479
23380
|
* @inheritdoc
|
|
23480
23381
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
23481
23382
|
var _this__renderPipeline;
|
|
@@ -24033,7 +23934,6 @@
|
|
|
24033
23934
|
}
|
|
24034
23935
|
};
|
|
24035
23936
|
/**
|
|
24036
|
-
* @override
|
|
24037
23937
|
* Clone and return the instance.
|
|
24038
23938
|
*/ _proto.clone = function clone() {
|
|
24039
23939
|
var dest = new BaseMaterial(this._engine, this.shader);
|
|
@@ -24041,7 +23941,6 @@
|
|
|
24041
23941
|
return dest;
|
|
24042
23942
|
};
|
|
24043
23943
|
/**
|
|
24044
|
-
* @override
|
|
24045
23944
|
* Clone to the target material.
|
|
24046
23945
|
* @param target - target material
|
|
24047
23946
|
*/ _proto.cloneTo = function cloneTo(target) {
|
|
@@ -24201,8 +24100,8 @@
|
|
|
24201
24100
|
var _this;
|
|
24202
24101
|
_this = BaseMaterial.call(this, engine, Shader.find("blinn-phong")) || this;
|
|
24203
24102
|
var shaderData = _this.shaderData;
|
|
24204
|
-
shaderData.enableMacro("
|
|
24205
|
-
shaderData.enableMacro("
|
|
24103
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
24104
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
24206
24105
|
shaderData.setColor(BlinnPhongMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
24207
24106
|
shaderData.setColor(BlinnPhongMaterial._specularColorProp, new Color$1(1, 1, 1, 1));
|
|
24208
24107
|
shaderData.setColor(BlinnPhongMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
@@ -24212,9 +24111,7 @@
|
|
|
24212
24111
|
return _this;
|
|
24213
24112
|
}
|
|
24214
24113
|
var _proto = BlinnPhongMaterial.prototype;
|
|
24215
|
-
|
|
24216
|
-
* @override
|
|
24217
|
-
*/ _proto.clone = function clone() {
|
|
24114
|
+
_proto.clone = function clone() {
|
|
24218
24115
|
var dest = new BlinnPhongMaterial(this._engine);
|
|
24219
24116
|
this.cloneTo(dest);
|
|
24220
24117
|
return dest;
|
|
@@ -24395,8 +24292,8 @@
|
|
|
24395
24292
|
var _this;
|
|
24396
24293
|
_this = BaseMaterial.call(this, engine, shader) || this;
|
|
24397
24294
|
var shaderData = _this.shaderData;
|
|
24398
|
-
shaderData.enableMacro("
|
|
24399
|
-
shaderData.enableMacro("
|
|
24295
|
+
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
24296
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
24400
24297
|
shaderData.setColor(PBRBaseMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
24401
24298
|
shaderData.setColor(PBRBaseMaterial._emissiveColorProp, new Color$1(0, 0, 0, 1));
|
|
24402
24299
|
shaderData.setVector4(PBRBaseMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
@@ -24505,9 +24402,9 @@
|
|
|
24505
24402
|
set: function set(value) {
|
|
24506
24403
|
this.shaderData.setTexture(PBRBaseMaterial._occlusionTextureProp, value);
|
|
24507
24404
|
if (value) {
|
|
24508
|
-
this.shaderData.enableMacro("
|
|
24405
|
+
this.shaderData.enableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
24509
24406
|
} else {
|
|
24510
|
-
this.shaderData.disableMacro("
|
|
24407
|
+
this.shaderData.disableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
24511
24408
|
}
|
|
24512
24409
|
}
|
|
24513
24410
|
},
|
|
@@ -24561,9 +24458,9 @@
|
|
|
24561
24458
|
set: function set(value) {
|
|
24562
24459
|
if (!!this.shaderData.getFloat(PBRBaseMaterial._clearCoatProp) !== !!value) {
|
|
24563
24460
|
if (value === 0) {
|
|
24564
|
-
this.shaderData.disableMacro("
|
|
24461
|
+
this.shaderData.disableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
24565
24462
|
} else {
|
|
24566
|
-
this.shaderData.enableMacro("
|
|
24463
|
+
this.shaderData.enableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
24567
24464
|
}
|
|
24568
24465
|
}
|
|
24569
24466
|
this.shaderData.setFloat(PBRBaseMaterial._clearCoatProp, value);
|
|
@@ -24579,9 +24476,9 @@
|
|
|
24579
24476
|
set: function set(value) {
|
|
24580
24477
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatTextureProp, value);
|
|
24581
24478
|
if (value) {
|
|
24582
|
-
this.shaderData.enableMacro("
|
|
24479
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
24583
24480
|
} else {
|
|
24584
|
-
this.shaderData.disableMacro("
|
|
24481
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
24585
24482
|
}
|
|
24586
24483
|
}
|
|
24587
24484
|
},
|
|
@@ -24606,9 +24503,9 @@
|
|
|
24606
24503
|
set: function set(value) {
|
|
24607
24504
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatRoughnessTextureProp, value);
|
|
24608
24505
|
if (value) {
|
|
24609
|
-
this.shaderData.enableMacro("
|
|
24506
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
24610
24507
|
} else {
|
|
24611
|
-
this.shaderData.disableMacro("
|
|
24508
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
24612
24509
|
}
|
|
24613
24510
|
}
|
|
24614
24511
|
},
|
|
@@ -24622,9 +24519,9 @@
|
|
|
24622
24519
|
set: function set(value) {
|
|
24623
24520
|
this.shaderData.setTexture(PBRBaseMaterial._clearCoatNormalTextureProp, value);
|
|
24624
24521
|
if (value) {
|
|
24625
|
-
this.shaderData.enableMacro("
|
|
24522
|
+
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
24626
24523
|
} else {
|
|
24627
|
-
this.shaderData.disableMacro("
|
|
24524
|
+
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
24628
24525
|
}
|
|
24629
24526
|
}
|
|
24630
24527
|
}
|
|
@@ -24668,7 +24565,7 @@
|
|
|
24668
24565
|
}
|
|
24669
24566
|
var _proto = PBRMaterial.prototype;
|
|
24670
24567
|
/**
|
|
24671
|
-
* @
|
|
24568
|
+
* @inheritdoc
|
|
24672
24569
|
*/ _proto.clone = function clone() {
|
|
24673
24570
|
var dest = new PBRMaterial(this._engine);
|
|
24674
24571
|
this.cloneTo(dest);
|
|
@@ -24708,9 +24605,9 @@
|
|
|
24708
24605
|
set: function set(value) {
|
|
24709
24606
|
this.shaderData.setTexture(PBRMaterial._roughnessMetallicTextureProp, value);
|
|
24710
24607
|
if (value) {
|
|
24711
|
-
this.shaderData.enableMacro("
|
|
24608
|
+
this.shaderData.enableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
24712
24609
|
} else {
|
|
24713
|
-
this.shaderData.disableMacro("
|
|
24610
|
+
this.shaderData.disableMacro("MATERIAL_HAS_ROUGHNESS_METALLIC_TEXTURE");
|
|
24714
24611
|
}
|
|
24715
24612
|
}
|
|
24716
24613
|
}
|
|
@@ -24739,7 +24636,7 @@
|
|
|
24739
24636
|
}
|
|
24740
24637
|
var _proto = PBRSpecularMaterial.prototype;
|
|
24741
24638
|
/**
|
|
24742
|
-
* @
|
|
24639
|
+
* @inheritdoc
|
|
24743
24640
|
*/ _proto.clone = function clone() {
|
|
24744
24641
|
var dest = new PBRSpecularMaterial(this._engine);
|
|
24745
24642
|
this.cloneTo(dest);
|
|
@@ -24801,7 +24698,7 @@
|
|
|
24801
24698
|
PBRSpecularMaterial._specularGlossinessTextureProp = ShaderProperty.getByName("material_SpecularGlossinessTexture");
|
|
24802
24699
|
})();
|
|
24803
24700
|
(function() {
|
|
24804
|
-
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("
|
|
24701
|
+
PBRSpecularMaterial._specularGlossinessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_GLOSSINESS_TEXTURE");
|
|
24805
24702
|
})();
|
|
24806
24703
|
/**
|
|
24807
24704
|
* Unlit Material.
|
|
@@ -24812,14 +24709,14 @@
|
|
|
24812
24709
|
_this = BaseMaterial.call(this, engine, Shader.find("unlit")) || this;
|
|
24813
24710
|
var shaderData = _this.shaderData;
|
|
24814
24711
|
shaderData.enableMacro("MATERIAL_OMIT_NORMAL");
|
|
24815
|
-
shaderData.enableMacro("
|
|
24712
|
+
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
24816
24713
|
shaderData.setColor(UnlitMaterial._baseColorProp, new Color$1(1, 1, 1, 1));
|
|
24817
24714
|
shaderData.setVector4(UnlitMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
24818
24715
|
return _this;
|
|
24819
24716
|
}
|
|
24820
24717
|
var _proto = UnlitMaterial.prototype;
|
|
24821
24718
|
/**
|
|
24822
|
-
* @
|
|
24719
|
+
* @inheritdoc
|
|
24823
24720
|
*/ _proto.clone = function clone() {
|
|
24824
24721
|
var dest = new UnlitMaterial(this._engine);
|
|
24825
24722
|
this.cloneTo(dest);
|
|
@@ -24934,10 +24831,7 @@
|
|
|
24934
24831
|
*/ _proto._addSprite = function _addSprite(sprite) {
|
|
24935
24832
|
this._spriteNamesToIndex[sprite.name] = this._sprites.push(sprite) - 1;
|
|
24936
24833
|
};
|
|
24937
|
-
|
|
24938
|
-
* @override
|
|
24939
|
-
* @internal
|
|
24940
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
24834
|
+
_proto._onDestroy = function _onDestroy() {
|
|
24941
24835
|
ReferResource.prototype._onDestroy.call(this);
|
|
24942
24836
|
this._sprites = null;
|
|
24943
24837
|
this._spriteNamesToIndex = null;
|
|
@@ -25043,10 +24937,7 @@
|
|
|
25043
24937
|
this._dirtyUpdateFlag & 0x1 && this._updatePositions();
|
|
25044
24938
|
return this._bounds;
|
|
25045
24939
|
};
|
|
25046
|
-
|
|
25047
|
-
* @override
|
|
25048
|
-
* @internal
|
|
25049
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
24940
|
+
_proto._onDestroy = function _onDestroy() {
|
|
25050
24941
|
ReferResource.prototype._onDestroy.call(this);
|
|
25051
24942
|
this._texture = null;
|
|
25052
24943
|
};
|
|
@@ -25781,15 +25672,11 @@
|
|
|
25781
25672
|
target._assembler.resetData(target);
|
|
25782
25673
|
target.sprite = this._sprite;
|
|
25783
25674
|
};
|
|
25784
|
-
|
|
25785
|
-
* @override
|
|
25786
|
-
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
25675
|
+
_proto._updateShaderData = function _updateShaderData(context) {
|
|
25787
25676
|
// @ts-ignore
|
|
25788
25677
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
25789
25678
|
};
|
|
25790
|
-
|
|
25791
|
-
* @override
|
|
25792
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
25679
|
+
_proto._updateBounds = function _updateBounds(worldBounds) {
|
|
25793
25680
|
var _this_sprite;
|
|
25794
25681
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
25795
25682
|
worldBounds.min.set(0, 0, 0);
|
|
@@ -25798,9 +25685,7 @@
|
|
|
25798
25685
|
this._assembler.updatePositions(this);
|
|
25799
25686
|
}
|
|
25800
25687
|
};
|
|
25801
|
-
|
|
25802
|
-
* @override
|
|
25803
|
-
*/ _proto._render = function _render(context) {
|
|
25688
|
+
_proto._render = function _render(context) {
|
|
25804
25689
|
var _this_sprite;
|
|
25805
25690
|
if (!((_this_sprite = this.sprite) == null ? void 0 : _this_sprite.texture) || !this.width || !this.height) {
|
|
25806
25691
|
return;
|
|
@@ -25823,7 +25708,6 @@
|
|
|
25823
25708
|
context.camera._renderPipeline.pushRenderData(context, renderData);
|
|
25824
25709
|
};
|
|
25825
25710
|
/**
|
|
25826
|
-
* @override
|
|
25827
25711
|
* @internal
|
|
25828
25712
|
*/ _proto._onDestroy = function _onDestroy() {
|
|
25829
25713
|
var _this__sprite;
|
|
@@ -26209,9 +26093,7 @@
|
|
|
26209
26093
|
this._font._addReferCount(1);
|
|
26210
26094
|
this.setMaterial(engine._spriteDefaultMaterial);
|
|
26211
26095
|
};
|
|
26212
|
-
|
|
26213
|
-
* @internal
|
|
26214
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
26096
|
+
_proto._onDestroy = function _onDestroy() {
|
|
26215
26097
|
Renderer.prototype._onDestroy.call(this);
|
|
26216
26098
|
// Clear render data.
|
|
26217
26099
|
var charRenderDatas = this._charRenderDatas;
|
|
@@ -26246,20 +26128,14 @@
|
|
|
26246
26128
|
*/ _proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
26247
26129
|
this._dirtyFlag &= ~type;
|
|
26248
26130
|
};
|
|
26249
|
-
|
|
26250
|
-
* @override
|
|
26251
|
-
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
26131
|
+
_proto._updateShaderData = function _updateShaderData(context) {
|
|
26252
26132
|
// @ts-ignore
|
|
26253
26133
|
this._updateTransformShaderData(context, Matrix._identity);
|
|
26254
26134
|
};
|
|
26255
|
-
|
|
26256
|
-
* @override
|
|
26257
|
-
*/ _proto._updateBounds = function _updateBounds(worldBounds) {
|
|
26135
|
+
_proto._updateBounds = function _updateBounds(worldBounds) {
|
|
26258
26136
|
BoundingBox.transform(this._localBounds, this._entity.transform.worldMatrix, worldBounds);
|
|
26259
26137
|
};
|
|
26260
|
-
|
|
26261
|
-
* @override
|
|
26262
|
-
*/ _proto._render = function _render(context) {
|
|
26138
|
+
_proto._render = function _render(context) {
|
|
26263
26139
|
if (this._text === "" || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0) {
|
|
26264
26140
|
return;
|
|
26265
26141
|
}
|
|
@@ -27478,7 +27354,6 @@
|
|
|
27478
27354
|
var _proto = AnimationFloatArrayCurve.prototype;
|
|
27479
27355
|
/**
|
|
27480
27356
|
* @inheritdoc
|
|
27481
|
-
* @override
|
|
27482
27357
|
*/ _proto.addKey = function addKey(key) {
|
|
27483
27358
|
AnimationCurve.prototype.addKey.call(this, key);
|
|
27484
27359
|
var evaluateData = this._evaluateData;
|
|
@@ -28244,7 +28119,6 @@
|
|
|
28244
28119
|
return this._getAnimatorStateInfo(stateName, layerIndex).state;
|
|
28245
28120
|
};
|
|
28246
28121
|
/**
|
|
28247
|
-
* @override
|
|
28248
28122
|
* @internal
|
|
28249
28123
|
*/ _proto._onEnable = function _onEnable() {
|
|
28250
28124
|
this.engine._componentsManager.addOnUpdateAnimations(this);
|
|
@@ -28252,7 +28126,6 @@
|
|
|
28252
28126
|
this._entity.getComponentsIncludeChildren(exports.Renderer, this._controlledRenderers);
|
|
28253
28127
|
};
|
|
28254
28128
|
/**
|
|
28255
|
-
* @override
|
|
28256
28129
|
* @internal
|
|
28257
28130
|
*/ _proto._onDisable = function _onDisable() {
|
|
28258
28131
|
this.engine._componentsManager.removeOnUpdateAnimations(this);
|
|
@@ -29068,9 +28941,7 @@
|
|
|
29068
28941
|
return _this;
|
|
29069
28942
|
}
|
|
29070
28943
|
var _proto = SkyBoxMaterial.prototype;
|
|
29071
|
-
|
|
29072
|
-
* @override
|
|
29073
|
-
*/ _proto.clone = function clone() {
|
|
28944
|
+
_proto.clone = function clone() {
|
|
29074
28945
|
var dest = new SkyBoxMaterial(this._engine);
|
|
29075
28946
|
this.cloneTo(dest);
|
|
29076
28947
|
return dest;
|
|
@@ -29182,7 +29053,7 @@
|
|
|
29182
29053
|
_inherits$2(SkyProceduralMaterial, Material);
|
|
29183
29054
|
var _proto = SkyProceduralMaterial.prototype;
|
|
29184
29055
|
/**
|
|
29185
|
-
* @
|
|
29056
|
+
* @inheritDoc
|
|
29186
29057
|
*/ _proto.clone = function clone() {
|
|
29187
29058
|
var dest = new SkyProceduralMaterial(this._engine);
|
|
29188
29059
|
this.cloneTo(dest);
|
|
@@ -29379,7 +29250,6 @@
|
|
|
29379
29250
|
_inherits$2(ParticleRenderer, MeshRenderer);
|
|
29380
29251
|
var _proto = ParticleRenderer.prototype;
|
|
29381
29252
|
/**
|
|
29382
|
-
* @override
|
|
29383
29253
|
* @internal
|
|
29384
29254
|
*/ _proto.update = function update(deltaTime) {
|
|
29385
29255
|
if (!this._isInit || !this._isStart) {
|
|
@@ -29397,7 +29267,6 @@
|
|
|
29397
29267
|
this.shaderData.setFloat("u_time", this._time);
|
|
29398
29268
|
};
|
|
29399
29269
|
/**
|
|
29400
|
-
* @override
|
|
29401
29270
|
* @internal
|
|
29402
29271
|
*/ _proto._onEnable = function _onEnable() {
|
|
29403
29272
|
MeshRenderer.prototype._onEnable.call(this);
|
|
@@ -30172,9 +30041,7 @@
|
|
|
30172
30041
|
this.getMaterial().shaderData.setTexture("u_texture", texture);
|
|
30173
30042
|
}
|
|
30174
30043
|
};
|
|
30175
|
-
|
|
30176
|
-
* @override
|
|
30177
|
-
*/ _proto._render = function _render(context) {
|
|
30044
|
+
_proto._render = function _render(context) {
|
|
30178
30045
|
this._updateStrapVertices(context.camera, this._points);
|
|
30179
30046
|
this._updateStrapCoords();
|
|
30180
30047
|
this._vertexBuffer.setData(this._vertices);
|
|
@@ -30319,9 +30186,7 @@
|
|
|
30319
30186
|
* Provide hooks for users to exchange Texture.
|
|
30320
30187
|
* @remarks Prevent issue: Feedback Loops Between Textures and the Framebuffer.
|
|
30321
30188
|
*/ _proto.onTextureChange = function onTextureChange(renderColorTexture) {};
|
|
30322
|
-
|
|
30323
|
-
* @override
|
|
30324
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
30189
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
30325
30190
|
if (!this.enabled) return;
|
|
30326
30191
|
this._camera = camera;
|
|
30327
30192
|
this._oriCameraCullingMask = camera.cullingMask;
|
|
@@ -30334,9 +30199,7 @@
|
|
|
30334
30199
|
this._oriCameraRenderTarget = camera.renderTarget;
|
|
30335
30200
|
camera.renderTarget = this._activeRenderTarget;
|
|
30336
30201
|
};
|
|
30337
|
-
|
|
30338
|
-
* @override
|
|
30339
|
-
*/ _proto.onEndRender = function onEndRender(camera) {
|
|
30202
|
+
_proto.onEndRender = function onEndRender(camera) {
|
|
30340
30203
|
if (!this.enabled) return;
|
|
30341
30204
|
this.onTextureChange && this.onTextureChange(this._texture);
|
|
30342
30205
|
this._activeRenderTarget = this._activeRenderTarget === this._renderTarget ? this._renderTargetSwap : this._renderTarget;
|
|
@@ -30369,17 +30232,13 @@
|
|
|
30369
30232
|
/**
|
|
30370
30233
|
* The position of the probe can be set, the default is the origin [0,0,0].
|
|
30371
30234
|
*/ _this.position = new Vector3(0, 0, 0);
|
|
30372
|
-
|
|
30373
|
-
* @override
|
|
30374
|
-
*/ _this._isCube = true;
|
|
30235
|
+
_this._isCube = true;
|
|
30375
30236
|
_this.oriViewMatrix = new Matrix();
|
|
30376
30237
|
return _this;
|
|
30377
30238
|
};
|
|
30378
30239
|
_inherits$2(CubeProbe, Probe);
|
|
30379
30240
|
var _proto = CubeProbe.prototype;
|
|
30380
|
-
|
|
30381
|
-
* @override
|
|
30382
|
-
*/ _proto.onBeginRender = function onBeginRender(camera) {
|
|
30241
|
+
_proto.onBeginRender = function onBeginRender(camera) {
|
|
30383
30242
|
if (!this.enabled) return;
|
|
30384
30243
|
Probe.prototype.onBeginRender.call(this, camera);
|
|
30385
30244
|
this._storeCamera(camera);
|
|
@@ -30832,8 +30691,8 @@
|
|
|
30832
30691
|
*/ WebGLEngine.create = function create(configuration) {
|
|
30833
30692
|
var canvas = configuration.canvas;
|
|
30834
30693
|
var webCanvas = new WebCanvas(typeof canvas === "string" ? document.getElementById(canvas) : canvas);
|
|
30835
|
-
var
|
|
30836
|
-
var engine = new WebGLEngine(webCanvas,
|
|
30694
|
+
var webGLGraphicDevice = new WebGLGraphicDevice(configuration.graphicDeviceOptions);
|
|
30695
|
+
var engine = new WebGLEngine(webCanvas, webGLGraphicDevice, configuration);
|
|
30837
30696
|
return engine._initialize(configuration);
|
|
30838
30697
|
};
|
|
30839
30698
|
_create_class$2(WebGLEngine, [
|
|
@@ -33308,9 +33167,7 @@
|
|
|
33308
33167
|
};
|
|
33309
33168
|
_inherits(GLTFContentRestorer, ContentRestorer);
|
|
33310
33169
|
var _proto = GLTFContentRestorer.prototype;
|
|
33311
|
-
|
|
33312
|
-
* @override
|
|
33313
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
33170
|
+
_proto.restoreContent = function restoreContent() {
|
|
33314
33171
|
var _this = this;
|
|
33315
33172
|
return new AssetPromise(function(resolve, reject) {
|
|
33316
33173
|
Promise.all(_this.bufferRequests.map(function(bufferRequestInfo) {
|
|
@@ -35223,9 +35080,7 @@
|
|
|
35223
35080
|
};
|
|
35224
35081
|
_inherits(GLTFResource, EngineObject);
|
|
35225
35082
|
var _proto = GLTFResource.prototype;
|
|
35226
|
-
|
|
35227
|
-
* @override
|
|
35228
|
-
*/ _proto._onDestroy = function _onDestroy() {
|
|
35083
|
+
_proto._onDestroy = function _onDestroy() {
|
|
35229
35084
|
EngineObject.prototype._onDestroy.call(this);
|
|
35230
35085
|
this.defaultSceneRoot.destroy();
|
|
35231
35086
|
this.textures = null;
|
|
@@ -35247,9 +35102,7 @@
|
|
|
35247
35102
|
};
|
|
35248
35103
|
_inherits(GLTFLoader, Loader);
|
|
35249
35104
|
var _proto = GLTFLoader.prototype;
|
|
35250
|
-
|
|
35251
|
-
* @override
|
|
35252
|
-
*/ _proto.load = function load(item, resourceManager) {
|
|
35105
|
+
_proto.load = function load(item, resourceManager) {
|
|
35253
35106
|
var url = item.url;
|
|
35254
35107
|
var params = item.params;
|
|
35255
35108
|
var context = new GLTFParserContext(url);
|
|
@@ -37060,9 +36913,7 @@
|
|
|
37060
36913
|
};
|
|
37061
36914
|
_inherits(Texture2DContentRestorer, ContentRestorer);
|
|
37062
36915
|
var _proto = Texture2DContentRestorer.prototype;
|
|
37063
|
-
|
|
37064
|
-
* @override
|
|
37065
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
36916
|
+
_proto.restoreContent = function restoreContent() {
|
|
37066
36917
|
var _this = this;
|
|
37067
36918
|
return request(this.url, this.requestConfig).then(function(image) {
|
|
37068
36919
|
var resource = _this.resource;
|
|
@@ -37079,9 +36930,7 @@
|
|
|
37079
36930
|
};
|
|
37080
36931
|
_inherits(Texture2DLoader, Loader);
|
|
37081
36932
|
var _proto = Texture2DLoader.prototype;
|
|
37082
|
-
|
|
37083
|
-
* @override
|
|
37084
|
-
*/ _proto.load = function load(item, resourceManager) {
|
|
36933
|
+
_proto.load = function load(item, resourceManager) {
|
|
37085
36934
|
var _this = this;
|
|
37086
36935
|
return new AssetPromise(function(resolve, reject) {
|
|
37087
36936
|
var url = item.url;
|
|
@@ -37126,9 +36975,7 @@
|
|
|
37126
36975
|
};
|
|
37127
36976
|
_inherits(TextureCubeContentRestorer, ContentRestorer);
|
|
37128
36977
|
var _proto = TextureCubeContentRestorer.prototype;
|
|
37129
|
-
|
|
37130
|
-
* @override
|
|
37131
|
-
*/ _proto.restoreContent = function restoreContent() {
|
|
36978
|
+
_proto.restoreContent = function restoreContent() {
|
|
37132
36979
|
var _this = this;
|
|
37133
36980
|
return new AssetPromise(function(resolve, reject) {
|
|
37134
36981
|
Promise.all(_this.urls.map(function(url) {
|
|
@@ -37153,9 +37000,7 @@
|
|
|
37153
37000
|
};
|
|
37154
37001
|
_inherits(TextureCubeLoader, Loader);
|
|
37155
37002
|
var _proto = TextureCubeLoader.prototype;
|
|
37156
|
-
|
|
37157
|
-
* @override
|
|
37158
|
-
*/ _proto.load = function load(item, resourceManager) {
|
|
37003
|
+
_proto.load = function load(item, resourceManager) {
|
|
37159
37004
|
var _this = this;
|
|
37160
37005
|
return new AssetPromise(function(resolve, reject) {
|
|
37161
37006
|
var urls = item.urls;
|
|
@@ -37318,16 +37163,12 @@
|
|
|
37318
37163
|
};
|
|
37319
37164
|
_inherits(KHR_draco_mesh_compression1, GLTFExtensionParser);
|
|
37320
37165
|
var _proto = KHR_draco_mesh_compression1.prototype;
|
|
37321
|
-
|
|
37322
|
-
* @override
|
|
37323
|
-
*/ _proto.initialize = function initialize() {
|
|
37166
|
+
_proto.initialize = function initialize() {
|
|
37324
37167
|
if (!KHR_draco_mesh_compression._decoder) {
|
|
37325
37168
|
KHR_draco_mesh_compression._decoder = new DRACODecoder();
|
|
37326
37169
|
}
|
|
37327
37170
|
};
|
|
37328
|
-
|
|
37329
|
-
* @override
|
|
37330
|
-
*/ _proto.createAndParse = function createAndParse(context, schema, glTFPrimitive, glTFMesh) {
|
|
37171
|
+
_proto.createAndParse = function createAndParse(context, schema, glTFPrimitive, glTFMesh) {
|
|
37331
37172
|
var _this = this;
|
|
37332
37173
|
var glTF = context.glTF, buffers = context.buffers, engine = context.glTFResource.engine;
|
|
37333
37174
|
var bufferViews = glTF.bufferViews, accessors = glTF.accessors;
|
|
@@ -37481,9 +37322,7 @@
|
|
|
37481
37322
|
};
|
|
37482
37323
|
_inherits(KHR_lights_punctual, GLTFExtensionParser);
|
|
37483
37324
|
var _proto = KHR_lights_punctual.prototype;
|
|
37484
|
-
|
|
37485
|
-
* @override
|
|
37486
|
-
*/ _proto.additiveParse = function additiveParse(context, entity, extensionSchema) {
|
|
37325
|
+
_proto.additiveParse = function additiveParse(context, entity, extensionSchema) {
|
|
37487
37326
|
var lightsSchema = context.glTF.extensions.KHR_lights_punctual.lights;
|
|
37488
37327
|
var lightSchema = lightsSchema[extensionSchema.light];
|
|
37489
37328
|
var color = lightSchema.color, _lightSchema_intensity = lightSchema.intensity, intensity = _lightSchema_intensity === void 0 ? 1 : _lightSchema_intensity, type = lightSchema.type, range = lightSchema.range, spot = lightSchema.spot;
|
|
@@ -37522,9 +37361,7 @@
|
|
|
37522
37361
|
};
|
|
37523
37362
|
_inherits(KHR_materials_clearcoat, GLTFExtensionParser);
|
|
37524
37363
|
var _proto = KHR_materials_clearcoat.prototype;
|
|
37525
|
-
|
|
37526
|
-
* @override
|
|
37527
|
-
*/ _proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37364
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37528
37365
|
var textures = context.glTFResource.textures;
|
|
37529
37366
|
var _schema_clearcoatFactor = schema.clearcoatFactor, clearcoatFactor = _schema_clearcoatFactor === void 0 ? 0 : _schema_clearcoatFactor, clearcoatTexture = schema.clearcoatTexture, _schema_clearcoatRoughnessFactor = schema.clearcoatRoughnessFactor, clearcoatRoughnessFactor = _schema_clearcoatRoughnessFactor === void 0 ? 0 : _schema_clearcoatRoughnessFactor, clearcoatRoughnessTexture = schema.clearcoatRoughnessTexture, clearcoatNormalTexture = schema.clearcoatNormalTexture;
|
|
37530
37367
|
material.clearCoat = clearcoatFactor;
|
|
@@ -37553,9 +37390,7 @@
|
|
|
37553
37390
|
};
|
|
37554
37391
|
_inherits(KHR_materials_pbrSpecularGlossiness, GLTFExtensionParser);
|
|
37555
37392
|
var _proto = KHR_materials_pbrSpecularGlossiness.prototype;
|
|
37556
|
-
|
|
37557
|
-
* @override
|
|
37558
|
-
*/ _proto.createAndParse = function createAndParse(context, schema, ownerSchema) {
|
|
37393
|
+
_proto.createAndParse = function createAndParse(context, schema, ownerSchema) {
|
|
37559
37394
|
var _context_glTFResource = context.glTFResource, engine = _context_glTFResource.engine, textures = _context_glTFResource.textures;
|
|
37560
37395
|
var material = new PBRSpecularMaterial(engine);
|
|
37561
37396
|
var diffuseFactor = schema.diffuseFactor, diffuseTexture = schema.diffuseTexture, specularFactor = schema.specularFactor, glossinessFactor = schema.glossinessFactor, specularGlossinessTexture = schema.specularGlossinessTexture;
|
|
@@ -37591,9 +37426,7 @@
|
|
|
37591
37426
|
};
|
|
37592
37427
|
_inherits(KHR_materials_unlit, GLTFExtensionParser);
|
|
37593
37428
|
var _proto = KHR_materials_unlit.prototype;
|
|
37594
|
-
|
|
37595
|
-
* @override
|
|
37596
|
-
*/ _proto.createAndParse = function createAndParse(context, _, ownerSchema) {
|
|
37429
|
+
_proto.createAndParse = function createAndParse(context, _, ownerSchema) {
|
|
37597
37430
|
var engine = context.glTFResource.engine;
|
|
37598
37431
|
var material = new UnlitMaterial(engine);
|
|
37599
37432
|
material.name = ownerSchema.name;
|
|
@@ -37621,9 +37454,7 @@
|
|
|
37621
37454
|
};
|
|
37622
37455
|
_inherits(KHR_texture_transform, GLTFExtensionParser);
|
|
37623
37456
|
var _proto = KHR_texture_transform.prototype;
|
|
37624
|
-
|
|
37625
|
-
* @override
|
|
37626
|
-
*/ _proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37457
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
37627
37458
|
var offset = schema.offset, rotation = schema.rotation, scale = schema.scale, texCoord = schema.texCoord;
|
|
37628
37459
|
if (offset) {
|
|
37629
37460
|
material.tilingOffset.z = offset[0];
|
|
@@ -37651,9 +37482,7 @@
|
|
|
37651
37482
|
};
|
|
37652
37483
|
_inherits(GALACEAN_materials_remap, GLTFExtensionParser);
|
|
37653
37484
|
var _proto = GALACEAN_materials_remap.prototype;
|
|
37654
|
-
|
|
37655
|
-
* @override
|
|
37656
|
-
*/ _proto.createAndParse = function createAndParse(context, schema) {
|
|
37485
|
+
_proto.createAndParse = function createAndParse(context, schema) {
|
|
37657
37486
|
var engine = context.glTFResource.engine;
|
|
37658
37487
|
// @ts-ignore
|
|
37659
37488
|
return engine.resourceManager.getResourceByRef(schema);
|
|
@@ -37669,9 +37498,7 @@
|
|
|
37669
37498
|
};
|
|
37670
37499
|
_inherits(GALACEAN_animation_event, GLTFExtensionParser);
|
|
37671
37500
|
var _proto = GALACEAN_animation_event.prototype;
|
|
37672
|
-
|
|
37673
|
-
* @override
|
|
37674
|
-
*/ _proto.additiveParse = function additiveParse(context, animationClip, schema) {
|
|
37501
|
+
_proto.additiveParse = function additiveParse(context, animationClip, schema) {
|
|
37675
37502
|
context.glTFResource.engine;
|
|
37676
37503
|
var events = schema.events;
|
|
37677
37504
|
events.map(function(eventData) {
|
|
@@ -37689,7 +37516,7 @@
|
|
|
37689
37516
|
], GALACEAN_animation_event);
|
|
37690
37517
|
|
|
37691
37518
|
//@ts-ignore
|
|
37692
|
-
var version = "1.0.0-beta.
|
|
37519
|
+
var version = "1.0.0-beta.3";
|
|
37693
37520
|
console.log("Galacean engine version: " + version);
|
|
37694
37521
|
for(var key in CoreObjects){
|
|
37695
37522
|
Loader.registerClass(key, CoreObjects[key]);
|