@galacean/engine-core 1.5.13 → 1.6.0-alpha.0
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/main.js +425 -316
- package/dist/main.js.map +1 -1
- package/dist/module.js +425 -315
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Engine.d.ts +0 -1
- package/types/Transform.d.ts +46 -10
- package/types/asset/AssetPromise.d.ts +6 -5
- package/types/base/Constant.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/material/PBRMaterial.d.ts +116 -3
- package/types/material/index.d.ts +0 -2
- package/types/physics/PhysicsScene.d.ts +72 -1
- package/types/texture/enums/TextureFormat.d.ts +2 -0
- package/types/material/PBRBaseMaterial.d.ts +0 -101
- package/types/material/PBRSpecularMaterial.d.ts +0 -38
package/dist/main.js
CHANGED
|
@@ -507,6 +507,7 @@ __decorate([
|
|
|
507
507
|
/** RGB compressed format, 4 bits per pixel. */ TextureFormat[TextureFormat["BC1"] = 10] = "BC1";
|
|
508
508
|
/** RGBA compressed format, 8 bits per pixel. */ TextureFormat[TextureFormat["BC3"] = 11] = "BC3";
|
|
509
509
|
/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ TextureFormat[TextureFormat["BC7"] = 12] = "BC7";
|
|
510
|
+
/** RGB HDR compressed format, 8 bits per pixel. */ TextureFormat[TextureFormat["BC6H"] = 100] = "BC6H";
|
|
510
511
|
/** RGB compressed format, 4 bits per pixel. */ TextureFormat[TextureFormat["ETC1_RGB"] = 13] = "ETC1_RGB";
|
|
511
512
|
/** RGB compressed format, 4 bits per pixel. */ TextureFormat[TextureFormat["ETC2_RGB"] = 14] = "ETC2_RGB";
|
|
512
513
|
/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ TextureFormat[TextureFormat["ETC2_RGBA5"] = 15] = "ETC2_RGBA5";
|
|
@@ -680,6 +681,7 @@ var Logger = {
|
|
|
680
681
|
GLCapabilityType["fragDepth"] = "EXT_frag_depth";
|
|
681
682
|
GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
|
|
682
683
|
GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
|
|
684
|
+
GLCapabilityType["astc_hdr"] = "WEBGL_compressed_texture_astc_hdr";
|
|
683
685
|
GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
|
|
684
686
|
GLCapabilityType["etc_webkit"] = "WEBKIT_WEBGL_compressed_texture_etc";
|
|
685
687
|
GLCapabilityType["etc1"] = "WEBGL_compressed_texture_etc1";
|
|
@@ -796,12 +798,19 @@ var AssetPromise = /*#__PURE__*/ function() {
|
|
|
796
798
|
});
|
|
797
799
|
};
|
|
798
800
|
/**
|
|
799
|
-
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected).
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
* @
|
|
801
|
+
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected).
|
|
802
|
+
* The callback result is ignored and the original value/reason is preserved per Promise spec.
|
|
803
|
+
* Returns an AssetPromise to keep chainability with AssetPromise methods.
|
|
804
|
+
* @param onFinally - The callback to execute when the Promise is settled.
|
|
805
|
+
* @returns An AssetPromise for the completion of the callback.
|
|
803
806
|
*/ _proto.finally = function _finally(onFinally) {
|
|
804
|
-
return this.
|
|
807
|
+
return this.then(function(value) {
|
|
808
|
+
onFinally == null ? void 0 : onFinally();
|
|
809
|
+
return value;
|
|
810
|
+
}, function(reason) {
|
|
811
|
+
onFinally == null ? void 0 : onFinally();
|
|
812
|
+
throw reason;
|
|
813
|
+
});
|
|
805
814
|
};
|
|
806
815
|
/**
|
|
807
816
|
* Cancel promise request.
|
|
@@ -5352,7 +5361,6 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5352
5361
|
// Create program and link shader
|
|
5353
5362
|
var program = gl.createProgram();
|
|
5354
5363
|
if (!program) {
|
|
5355
|
-
console.warn("Context lost while create program.");
|
|
5356
5364
|
return null;
|
|
5357
5365
|
}
|
|
5358
5366
|
gl.attachShader(program, vertexShader);
|
|
@@ -5372,7 +5380,6 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5372
5380
|
var gl = this._gl;
|
|
5373
5381
|
var shader = gl.createShader(shaderType);
|
|
5374
5382
|
if (!shader) {
|
|
5375
|
-
console.warn("Context lost while create shader.");
|
|
5376
5383
|
return null;
|
|
5377
5384
|
}
|
|
5378
5385
|
gl.shaderSource(shader, shaderSource);
|
|
@@ -5540,7 +5547,9 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5540
5547
|
_proto._getUniformInfos = function _getUniformInfos() {
|
|
5541
5548
|
var gl = this._gl;
|
|
5542
5549
|
var program = this._glProgram;
|
|
5543
|
-
var
|
|
5550
|
+
var _gl_getProgramParameter;
|
|
5551
|
+
// uniformCount is `null` when context lost.
|
|
5552
|
+
var uniformCount = (_gl_getProgramParameter = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)) != null ? _gl_getProgramParameter : 0;
|
|
5544
5553
|
var uniformInfos = new Array(uniformCount);
|
|
5545
5554
|
for(var i = 0; i < uniformCount; ++i){
|
|
5546
5555
|
var info = gl.getActiveUniform(program, i);
|
|
@@ -5552,7 +5561,9 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5552
5561
|
var gl = this._gl;
|
|
5553
5562
|
var program = this._glProgram;
|
|
5554
5563
|
var attributeInfos = new Array();
|
|
5555
|
-
var
|
|
5564
|
+
var _gl_getProgramParameter;
|
|
5565
|
+
// attributeCount is `null` when context lost.
|
|
5566
|
+
var attributeCount = (_gl_getProgramParameter = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)) != null ? _gl_getProgramParameter : 0;
|
|
5556
5567
|
for(var i = 0; i < attributeCount; ++i){
|
|
5557
5568
|
var info = gl.getActiveAttrib(program, i);
|
|
5558
5569
|
attributeInfos[i] = info;
|
|
@@ -7800,22 +7811,59 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7800
7811
|
target._rotation.copyFrom(this.rotation);
|
|
7801
7812
|
target._scale.copyFrom(this.scale);
|
|
7802
7813
|
};
|
|
7803
|
-
_proto.
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
this.
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
this.
|
|
7817
|
-
|
|
7818
|
-
|
|
7814
|
+
_proto._onWorldMatrixChange = function _onWorldMatrixChange() {
|
|
7815
|
+
this._setDirtyFlagFalse(128);
|
|
7816
|
+
};
|
|
7817
|
+
_proto._isContainDirtyFlags = function _isContainDirtyFlags(targetDirtyFlags) {
|
|
7818
|
+
return (this._dirtyFlag & targetDirtyFlags) === targetDirtyFlags;
|
|
7819
|
+
};
|
|
7820
|
+
_proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
7821
|
+
return (this._dirtyFlag & type) != 0;
|
|
7822
|
+
};
|
|
7823
|
+
_proto._setDirtyFlagTrue = function _setDirtyFlagTrue(type) {
|
|
7824
|
+
this._dirtyFlag |= type;
|
|
7825
|
+
};
|
|
7826
|
+
_proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
7827
|
+
this._dirtyFlag &= ~type;
|
|
7828
|
+
};
|
|
7829
|
+
_proto._worldAssociatedChange = function _worldAssociatedChange(type) {
|
|
7830
|
+
var dispatchFlags = type & ~this._dirtyFlag;
|
|
7831
|
+
this._dirtyFlag |= type;
|
|
7832
|
+
this._entity._updateFlagManager.dispatch(dispatchFlags);
|
|
7833
|
+
};
|
|
7834
|
+
_proto._getParentTransform = function _getParentTransform() {
|
|
7835
|
+
if (!this._isParentDirty) {
|
|
7836
|
+
return this._parentTransformCache;
|
|
7837
|
+
}
|
|
7838
|
+
var parentCache = null;
|
|
7839
|
+
var parent = this._entity.parent;
|
|
7840
|
+
while(parent){
|
|
7841
|
+
var transform = parent.transform;
|
|
7842
|
+
if (transform) {
|
|
7843
|
+
parentCache = transform;
|
|
7844
|
+
break;
|
|
7845
|
+
} else {
|
|
7846
|
+
parent = parent.parent;
|
|
7847
|
+
}
|
|
7848
|
+
}
|
|
7849
|
+
this._parentTransformCache = parentCache;
|
|
7850
|
+
this._isParentDirty = false;
|
|
7851
|
+
return parentCache;
|
|
7852
|
+
};
|
|
7853
|
+
_proto._onPositionChanged = function _onPositionChanged() {
|
|
7854
|
+
this._setDirtyFlagTrue(64);
|
|
7855
|
+
this._updateWorldPositionFlag();
|
|
7856
|
+
};
|
|
7857
|
+
_proto._onWorldPositionChanged = function _onWorldPositionChanged() {
|
|
7858
|
+
var worldPosition = this._worldPosition;
|
|
7859
|
+
var parent = this._getParentTransform();
|
|
7860
|
+
if (parent) {
|
|
7861
|
+
engineMath.Matrix.invert(parent.worldMatrix, Transform._tempMat41);
|
|
7862
|
+
engineMath.Vector3.transformCoordinate(worldPosition, Transform._tempMat41, this._position);
|
|
7863
|
+
} else {
|
|
7864
|
+
this._position.copyFrom(worldPosition);
|
|
7865
|
+
}
|
|
7866
|
+
this._setDirtyFlagFalse(4);
|
|
7819
7867
|
};
|
|
7820
7868
|
/**
|
|
7821
7869
|
* Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
|
|
@@ -7917,25 +7965,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7917
7965
|
}
|
|
7918
7966
|
}
|
|
7919
7967
|
};
|
|
7920
|
-
_proto._getParentTransform = function _getParentTransform() {
|
|
7921
|
-
if (!this._isParentDirty) {
|
|
7922
|
-
return this._parentTransformCache;
|
|
7923
|
-
}
|
|
7924
|
-
var parentCache = null;
|
|
7925
|
-
var parent = this._entity.parent;
|
|
7926
|
-
while(parent){
|
|
7927
|
-
var transform = parent.transform;
|
|
7928
|
-
if (transform) {
|
|
7929
|
-
parentCache = transform;
|
|
7930
|
-
break;
|
|
7931
|
-
} else {
|
|
7932
|
-
parent = parent.parent;
|
|
7933
|
-
}
|
|
7934
|
-
}
|
|
7935
|
-
this._parentTransformCache = parentCache;
|
|
7936
|
-
this._isParentDirty = false;
|
|
7937
|
-
return parentCache;
|
|
7938
|
-
};
|
|
7939
7968
|
_proto._getScaleMatrix = function _getScaleMatrix() {
|
|
7940
7969
|
var invRotation = Transform._tempQuat0;
|
|
7941
7970
|
var invRotationMat = Transform._tempMat30;
|
|
@@ -7947,22 +7976,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7947
7976
|
engineMath.Matrix3x3.multiply(invRotationMat, worldRotScaMat, scaMat);
|
|
7948
7977
|
return scaMat;
|
|
7949
7978
|
};
|
|
7950
|
-
_proto._isContainDirtyFlags = function _isContainDirtyFlags(targetDirtyFlags) {
|
|
7951
|
-
return (this._dirtyFlag & targetDirtyFlags) === targetDirtyFlags;
|
|
7952
|
-
};
|
|
7953
|
-
_proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
7954
|
-
return (this._dirtyFlag & type) != 0;
|
|
7955
|
-
};
|
|
7956
|
-
_proto._setDirtyFlagTrue = function _setDirtyFlagTrue(type) {
|
|
7957
|
-
this._dirtyFlag |= type;
|
|
7958
|
-
};
|
|
7959
|
-
_proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
7960
|
-
this._dirtyFlag &= ~type;
|
|
7961
|
-
};
|
|
7962
|
-
_proto._worldAssociatedChange = function _worldAssociatedChange(type) {
|
|
7963
|
-
this._dirtyFlag |= type;
|
|
7964
|
-
this._entity._updateFlagManager.dispatch(type);
|
|
7965
|
-
};
|
|
7966
7979
|
_proto._rotateByQuat = function _rotateByQuat(rotateQuat, relativeToLocal) {
|
|
7967
7980
|
if (relativeToLocal) {
|
|
7968
7981
|
engineMath.Quaternion.multiply(this.rotationQuaternion, rotateQuat, this._rotationQuaternion);
|
|
@@ -7987,21 +8000,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7987
8000
|
engineMath.Quaternion.rotationEuler(x * radFactor, y * radFactor, z * radFactor, rotQuat);
|
|
7988
8001
|
this._rotateByQuat(rotQuat, relativeToLocal);
|
|
7989
8002
|
};
|
|
7990
|
-
_proto._onPositionChanged = function _onPositionChanged() {
|
|
7991
|
-
this._setDirtyFlagTrue(64);
|
|
7992
|
-
this._updateWorldPositionFlag();
|
|
7993
|
-
};
|
|
7994
|
-
_proto._onWorldPositionChanged = function _onWorldPositionChanged() {
|
|
7995
|
-
var worldPosition = this._worldPosition;
|
|
7996
|
-
var parent = this._getParentTransform();
|
|
7997
|
-
if (parent) {
|
|
7998
|
-
engineMath.Matrix.invert(parent.worldMatrix, Transform._tempMat41);
|
|
7999
|
-
engineMath.Vector3.transformCoordinate(worldPosition, Transform._tempMat41, this._position);
|
|
8000
|
-
} else {
|
|
8001
|
-
this._position.copyFrom(worldPosition);
|
|
8002
|
-
}
|
|
8003
|
-
this._setDirtyFlagFalse(4);
|
|
8004
|
-
};
|
|
8005
8003
|
_proto._onRotationChanged = function _onRotationChanged() {
|
|
8006
8004
|
this._setDirtyFlagTrue(64 | 2);
|
|
8007
8005
|
this._setDirtyFlagFalse(1);
|
|
@@ -8262,15 +8260,16 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
8262
8260
|
var _this = this, position = _this._position, rotationQuaternion = _this._rotationQuaternion, scale = _this._scale;
|
|
8263
8261
|
// @ts-ignore
|
|
8264
8262
|
position._onValueChanged = rotationQuaternion._onValueChanged = scale._onValueChanged = null;
|
|
8265
|
-
|
|
8263
|
+
value.decompose(position, rotationQuaternion, scale);
|
|
8264
|
+
this._onLocalMatrixChanging == null ? void 0 : this._onLocalMatrixChanging.call(this);
|
|
8265
|
+
this._setDirtyFlagTrue(1);
|
|
8266
|
+
this._setDirtyFlagFalse(64 | 2);
|
|
8266
8267
|
// @ts-ignore
|
|
8267
8268
|
position._onValueChanged = this._onPositionChanged;
|
|
8268
8269
|
// @ts-ignore
|
|
8269
8270
|
rotationQuaternion._onValueChanged = this._onRotationQuaternionChanged;
|
|
8270
8271
|
// @ts-ignore
|
|
8271
8272
|
scale._onValueChanged = this._onScaleChanged;
|
|
8272
|
-
this._setDirtyFlagTrue(1);
|
|
8273
|
-
this._setDirtyFlagFalse(64 | 2);
|
|
8274
8273
|
var localUniformScaling = scale.x === scale.y && scale.y === scale.z;
|
|
8275
8274
|
if (this._localUniformScaling !== localUniformScaling) {
|
|
8276
8275
|
this._localUniformScaling = localUniformScaling;
|
|
@@ -8309,7 +8308,7 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
8309
8308
|
this._localMatrix.copyFrom(value);
|
|
8310
8309
|
}
|
|
8311
8310
|
this.localMatrix = this._localMatrix;
|
|
8312
|
-
this.
|
|
8311
|
+
this._onWorldMatrixChange();
|
|
8313
8312
|
}
|
|
8314
8313
|
},
|
|
8315
8314
|
{
|
|
@@ -8430,7 +8429,7 @@ __decorate([
|
|
|
8430
8429
|
ignoreClone
|
|
8431
8430
|
], Transform.prototype, "_onScaleChanged", null);
|
|
8432
8431
|
/**
|
|
8433
|
-
*
|
|
8432
|
+
* Dirty flag of transform.
|
|
8434
8433
|
*/ var TransformModifyFlags = /*#__PURE__*/ function(TransformModifyFlags) {
|
|
8435
8434
|
TransformModifyFlags[TransformModifyFlags["LocalEuler"] = 1] = "LocalEuler";
|
|
8436
8435
|
TransformModifyFlags[TransformModifyFlags["LocalQuat"] = 2] = "LocalQuat";
|
|
@@ -10949,43 +10948,130 @@ __decorate([
|
|
|
10949
10948
|
if (outHitResult) {
|
|
10950
10949
|
hitResult = outHitResult;
|
|
10951
10950
|
}
|
|
10952
|
-
var
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
}
|
|
10957
|
-
return shape.collider.entity.layer & layerMask && shape.isSceneQuery;
|
|
10958
|
-
};
|
|
10959
|
-
var outIDX;
|
|
10960
|
-
var outDistance;
|
|
10961
|
-
var outPosition;
|
|
10962
|
-
var outNormal;
|
|
10963
|
-
if (hitResult != undefined) {
|
|
10964
|
-
var result = this._nativePhysicsScene.raycast(ray, distance, onRaycast, function(idx, distance, position, normal) {
|
|
10965
|
-
outIDX = idx;
|
|
10966
|
-
outDistance = distance;
|
|
10967
|
-
outPosition = position;
|
|
10968
|
-
outNormal = normal;
|
|
10969
|
-
});
|
|
10970
|
-
if (result) {
|
|
10971
|
-
var hitShape = Engine._physicalObjectsMap[outIDX];
|
|
10972
|
-
hitResult.entity = hitShape._collider.entity;
|
|
10973
|
-
hitResult.shape = hitShape;
|
|
10974
|
-
hitResult.distance = outDistance;
|
|
10975
|
-
hitResult.point.copyFrom(outPosition);
|
|
10976
|
-
hitResult.normal.copyFrom(outNormal);
|
|
10977
|
-
return true;
|
|
10978
|
-
} else {
|
|
10979
|
-
hitResult.entity = null;
|
|
10980
|
-
hitResult.shape = null;
|
|
10981
|
-
hitResult.distance = 0;
|
|
10982
|
-
hitResult.point.set(0, 0, 0);
|
|
10983
|
-
hitResult.normal.set(0, 0, 0);
|
|
10984
|
-
return false;
|
|
10985
|
-
}
|
|
10986
|
-
} else {
|
|
10987
|
-
return this._nativePhysicsScene.raycast(ray, distance, onRaycast);
|
|
10951
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
10952
|
+
var result = this._nativePhysicsScene.raycast(ray, distance, preFilter, hitResult ? this._createHitCallback(hitResult) : undefined);
|
|
10953
|
+
if (!result && hitResult) {
|
|
10954
|
+
this._clearHitResult(hitResult);
|
|
10988
10955
|
}
|
|
10956
|
+
return result;
|
|
10957
|
+
};
|
|
10958
|
+
/**
|
|
10959
|
+
* Casts a box through the Scene and returns true if there is any hit.
|
|
10960
|
+
* @param center - The center of the box
|
|
10961
|
+
* @param halfExtents - Half the size of the box in each dimension
|
|
10962
|
+
* @param direction - The direction to sweep along
|
|
10963
|
+
* @param orientation - The rotation of the box. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
10964
|
+
* @param distance - The max distance to sweep. @defaultValue `Number.MAX_VALUE`
|
|
10965
|
+
* @param layerMask - Layer mask that is used to selectively ignore Colliders when sweeping. @defaultValue `Layer.Everything`
|
|
10966
|
+
* @param outHitResult - Optional HitResult object to store detailed hit information
|
|
10967
|
+
* @returns Returns true if the box intersects with any collider, otherwise false
|
|
10968
|
+
*/ _proto.boxCast = function boxCast(center, halfExtents, direction, orientation, distance, layerMask, outHitResult) {
|
|
10969
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
10970
|
+
if (distance === void 0) distance = Number.MAX_VALUE;
|
|
10971
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
10972
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
10973
|
+
var result = this._nativePhysicsScene.boxCast(center, orientation, halfExtents, direction, distance, preFilter, outHitResult ? this._createHitCallback(outHitResult) : undefined);
|
|
10974
|
+
if (!result && outHitResult) {
|
|
10975
|
+
this._clearHitResult(outHitResult);
|
|
10976
|
+
}
|
|
10977
|
+
return result;
|
|
10978
|
+
};
|
|
10979
|
+
/**
|
|
10980
|
+
* Casts a sphere through the Scene and returns true if there is any hit.
|
|
10981
|
+
* @param center - The center of the sphere
|
|
10982
|
+
* @param radius - The radius of the sphere
|
|
10983
|
+
* @param direction - The direction to sweep along
|
|
10984
|
+
* @param distance - The max distance to sweep. @defaultValue `Number.MAX_VALUE`
|
|
10985
|
+
* @param layerMask - Layer mask that is used to selectively ignore Colliders when sweeping. @defaultValue `Layer.Everything`
|
|
10986
|
+
* @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
|
|
10987
|
+
* @returns Returns True if the sphere intersects with any collider, otherwise false
|
|
10988
|
+
*/ _proto.sphereCast = function sphereCast(center, radius, direction, distance, layerMask, outHitResult) {
|
|
10989
|
+
if (distance === void 0) distance = Number.MAX_VALUE;
|
|
10990
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
10991
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
10992
|
+
var result = this._nativePhysicsScene.sphereCast(center, radius, direction, distance, preFilter, outHitResult ? this._createHitCallback(outHitResult) : undefined);
|
|
10993
|
+
if (!result && outHitResult) {
|
|
10994
|
+
this._clearHitResult(outHitResult);
|
|
10995
|
+
}
|
|
10996
|
+
return result;
|
|
10997
|
+
};
|
|
10998
|
+
/**
|
|
10999
|
+
* Casts a capsule through the Scene and returns true if there is any hit.
|
|
11000
|
+
* @param center - The center of the capsule
|
|
11001
|
+
* @param radius - The radius of the capsule
|
|
11002
|
+
* @param height - The height of the capsule
|
|
11003
|
+
* @param direction - The direction to sweep along
|
|
11004
|
+
* @param orientation - The rotation of the capsule. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
11005
|
+
* @param distance - The max distance to sweep. @defaultValue `Number.MAX_VALUE`
|
|
11006
|
+
* @param layerMask - Layer mask that is used to selectively ignore Colliders when sweeping. @defaultValue `Layer.Everything`
|
|
11007
|
+
* @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
|
|
11008
|
+
* @returns Returns True if the capsule intersects with any collider, otherwise false
|
|
11009
|
+
*/ _proto.capsuleCast = function capsuleCast(center, radius, height, direction, orientation, distance, layerMask, outHitResult) {
|
|
11010
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
11011
|
+
if (distance === void 0) distance = Number.MAX_VALUE;
|
|
11012
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11013
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
11014
|
+
var result = this._nativePhysicsScene.capsuleCast(center, radius, height, orientation, direction, distance, preFilter, outHitResult ? this._createHitCallback(outHitResult) : undefined);
|
|
11015
|
+
if (!result && outHitResult) {
|
|
11016
|
+
this._clearHitResult(outHitResult);
|
|
11017
|
+
}
|
|
11018
|
+
return result;
|
|
11019
|
+
};
|
|
11020
|
+
/**
|
|
11021
|
+
* Get all colliders that overlap with a box in the scene.
|
|
11022
|
+
* @param center - The center of the box
|
|
11023
|
+
* @param halfExtents - Half the size of the box in each dimension
|
|
11024
|
+
* @param orientation - The rotation of the box. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
11025
|
+
* @param layerMask - Layer mask that is used to selectively filter colliders. @defaultValue `Layer.Everything`
|
|
11026
|
+
* @param shapes - Array to store overlapping collider shapes. @defaultValue `[]`
|
|
11027
|
+
* @returns The collider shapes overlapping with the box
|
|
11028
|
+
*/ _proto.overlapBoxAll = function overlapBoxAll(center, halfExtents, orientation, layerMask, shapes) {
|
|
11029
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
11030
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11031
|
+
if (shapes === void 0) shapes = [];
|
|
11032
|
+
var ids = this._nativePhysicsScene.overlapBoxAll(center, orientation, halfExtents, this._createPreFilter(layerMask));
|
|
11033
|
+
shapes.length = 0;
|
|
11034
|
+
for(var i = 0, n = ids.length; i < n; i++){
|
|
11035
|
+
shapes.push(Engine._physicalObjectsMap[ids[i]]);
|
|
11036
|
+
}
|
|
11037
|
+
return shapes;
|
|
11038
|
+
};
|
|
11039
|
+
/**
|
|
11040
|
+
* Get all colliders that overlap with a sphere in the scene.
|
|
11041
|
+
* @param center - The center of the sphere
|
|
11042
|
+
* @param radius - The radius of the sphere
|
|
11043
|
+
* @param layerMask - Layer mask that is used to selectively filter colliders. @defaultValue `Layer.Everything`
|
|
11044
|
+
* @param shapes - Array to store overlapping collider shapes. @defaultValue `[]`
|
|
11045
|
+
* @returns The collider shapes overlapping with the sphere
|
|
11046
|
+
*/ _proto.overlapSphereAll = function overlapSphereAll(center, radius, layerMask, shapes) {
|
|
11047
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11048
|
+
if (shapes === void 0) shapes = [];
|
|
11049
|
+
var ids = this._nativePhysicsScene.overlapSphereAll(center, radius, this._createPreFilter(layerMask));
|
|
11050
|
+
shapes.length = 0;
|
|
11051
|
+
for(var i = 0; i < ids.length; i++){
|
|
11052
|
+
shapes.push(Engine._physicalObjectsMap[ids[i]]);
|
|
11053
|
+
}
|
|
11054
|
+
return shapes;
|
|
11055
|
+
};
|
|
11056
|
+
/**
|
|
11057
|
+
* Get all colliders that overlap with a capsule in the scene.
|
|
11058
|
+
* @param center - The center of the capsule
|
|
11059
|
+
* @param radius - The radius of the capsule
|
|
11060
|
+
* @param height - The height of the capsule
|
|
11061
|
+
* @param orientation - The rotation of the capsule. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
11062
|
+
* @param layerMask - Layer mask that is used to selectively filter colliders. @defaultValue `Layer.Everything`
|
|
11063
|
+
* @param shapes - Array to store overlapping collider shapes. @defaultValue `[]`
|
|
11064
|
+
* @returns The collider shapes overlapping with the capsule
|
|
11065
|
+
*/ _proto.overlapCapsuleAll = function overlapCapsuleAll(center, radius, height, orientation, layerMask, shapes) {
|
|
11066
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
11067
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11068
|
+
if (shapes === void 0) shapes = [];
|
|
11069
|
+
var ids = this._nativePhysicsScene.overlapCapsuleAll(center, radius, height, orientation, this._createPreFilter(layerMask));
|
|
11070
|
+
shapes.length = 0;
|
|
11071
|
+
for(var i = 0; i < ids.length; i++){
|
|
11072
|
+
shapes.push(Engine._physicalObjectsMap[ids[i]]);
|
|
11073
|
+
}
|
|
11074
|
+
return shapes;
|
|
10989
11075
|
};
|
|
10990
11076
|
/**
|
|
10991
11077
|
* Call on every frame to update pose of objects.
|
|
@@ -11075,6 +11161,31 @@ __decorate([
|
|
|
11075
11161
|
_proto._setGravity = function _setGravity() {
|
|
11076
11162
|
this._nativePhysicsScene.setGravity(this._gravity);
|
|
11077
11163
|
};
|
|
11164
|
+
_proto._createPreFilter = function _createPreFilter(mask) {
|
|
11165
|
+
return function(obj) {
|
|
11166
|
+
var shape = Engine._physicalObjectsMap[obj];
|
|
11167
|
+
if (!shape) {
|
|
11168
|
+
return false;
|
|
11169
|
+
}
|
|
11170
|
+
return shape.collider.entity.layer & mask && shape.isSceneQuery;
|
|
11171
|
+
};
|
|
11172
|
+
};
|
|
11173
|
+
_proto._createHitCallback = function _createHitCallback(outHitResult) {
|
|
11174
|
+
return function(shapeUniqueID, distance, position, normal) {
|
|
11175
|
+
outHitResult.entity = Engine._physicalObjectsMap[shapeUniqueID].collider.entity;
|
|
11176
|
+
outHitResult.shape = Engine._physicalObjectsMap[shapeUniqueID];
|
|
11177
|
+
outHitResult.distance = distance;
|
|
11178
|
+
outHitResult.point.copyFrom(position);
|
|
11179
|
+
outHitResult.normal.copyFrom(normal);
|
|
11180
|
+
};
|
|
11181
|
+
};
|
|
11182
|
+
_proto._clearHitResult = function _clearHitResult(hitResult) {
|
|
11183
|
+
hitResult.entity = null;
|
|
11184
|
+
hitResult.shape = null;
|
|
11185
|
+
hitResult.distance = 0;
|
|
11186
|
+
hitResult.point.set(0, 0, 0);
|
|
11187
|
+
hitResult.normal.set(0, 0, 0);
|
|
11188
|
+
};
|
|
11078
11189
|
_create_class(PhysicsScene, [
|
|
11079
11190
|
{
|
|
11080
11191
|
key: "gravity",
|
|
@@ -11105,6 +11216,7 @@ __decorate([
|
|
|
11105
11216
|
return PhysicsScene;
|
|
11106
11217
|
}();
|
|
11107
11218
|
PhysicsScene._collision = new Collision();
|
|
11219
|
+
PhysicsScene._identityQuaternion = new engineMath.Quaternion(0, 0, 0, 1);
|
|
11108
11220
|
|
|
11109
11221
|
/**
|
|
11110
11222
|
* A static collider component that will not move.
|
|
@@ -13165,35 +13277,86 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13165
13277
|
}({});
|
|
13166
13278
|
|
|
13167
13279
|
/**
|
|
13168
|
-
*
|
|
13169
|
-
*/ var
|
|
13170
|
-
|
|
13171
|
-
|
|
13280
|
+
* Refraction mode.
|
|
13281
|
+
*/ var RefractionMode = /*#__PURE__*/ function(RefractionMode) {
|
|
13282
|
+
/** Use the sphere refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Sphere"] = 0] = "Sphere";
|
|
13283
|
+
/** Use the planar refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Planar"] = 1] = "Planar";
|
|
13284
|
+
return RefractionMode;
|
|
13285
|
+
}({});
|
|
13286
|
+
|
|
13287
|
+
/**
|
|
13288
|
+
* PBR (Metallic-Roughness Workflow) Material.
|
|
13289
|
+
*/ var PBRMaterial = /*#__PURE__*/ function(BaseMaterial1) {
|
|
13290
|
+
_inherits(PBRMaterial, BaseMaterial1);
|
|
13291
|
+
function PBRMaterial(engine) {
|
|
13172
13292
|
var _this;
|
|
13173
|
-
_this =
|
|
13293
|
+
_this = BaseMaterial1.call(this, engine, Shader.find("pbr")) || this, _this._anisotropyRotation = 0, _this._iridescenceRange = new engineMath.Vector2(100, 400), _this._sheenEnabled = false;
|
|
13174
13294
|
var shaderData = _this.shaderData;
|
|
13175
13295
|
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
13176
13296
|
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
13177
|
-
shaderData.setColor(
|
|
13178
|
-
shaderData.setColor(
|
|
13179
|
-
shaderData.setVector4(
|
|
13180
|
-
shaderData.setFloat(
|
|
13181
|
-
shaderData.setFloat(
|
|
13182
|
-
shaderData.setFloat(
|
|
13183
|
-
shaderData.setFloat(
|
|
13184
|
-
shaderData.setFloat(
|
|
13297
|
+
shaderData.setColor(PBRMaterial._baseColorProp, new engineMath.Color(1, 1, 1, 1));
|
|
13298
|
+
shaderData.setColor(PBRMaterial._emissiveColorProp, new engineMath.Color(0, 0, 0, 1));
|
|
13299
|
+
shaderData.setVector4(PBRMaterial._tilingOffsetProp, new engineMath.Vector4(1, 1, 0, 0));
|
|
13300
|
+
shaderData.setFloat(PBRMaterial._normalIntensityProp, 1);
|
|
13301
|
+
shaderData.setFloat(PBRMaterial._occlusionTextureIntensityProp, 1);
|
|
13302
|
+
shaderData.setFloat(PBRMaterial._occlusionTextureCoordProp, TextureCoordinate.UV0);
|
|
13303
|
+
shaderData.setFloat(PBRMaterial._clearCoatProp, 0);
|
|
13304
|
+
shaderData.setFloat(PBRMaterial._clearCoatRoughnessProp, 0);
|
|
13305
|
+
shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
13306
|
+
shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
13307
|
+
shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
13308
|
+
shaderData.setVector3(PBRMaterial._anisotropyInfoProp, new engineMath.Vector3(1, 0, 0));
|
|
13309
|
+
shaderData.setVector4(PBRMaterial._iridescenceInfoProp, new engineMath.Vector4(0, 1.3, 100, 400));
|
|
13310
|
+
var sheenColor = new engineMath.Color(0, 0, 0);
|
|
13311
|
+
shaderData.setColor(PBRMaterial._sheenColorProp, sheenColor);
|
|
13312
|
+
_this.refractionMode = RefractionMode.Planar;
|
|
13313
|
+
shaderData.setFloat(PBRMaterial._transmissionProp, 0);
|
|
13314
|
+
shaderData.setFloat(PBRMaterial._thicknessProp, 0);
|
|
13315
|
+
shaderData.setFloat(PBRMaterial._attenuationDistanceProp, Infinity);
|
|
13316
|
+
shaderData.setColor(PBRMaterial._attenuationColorProp, new engineMath.Color(1, 1, 1));
|
|
13317
|
+
shaderData.setFloat(PBRMaterial._specularIntensityProp, 1);
|
|
13318
|
+
shaderData.setColor(PBRMaterial._specularColorProp, new engineMath.Color(1, 1, 1));
|
|
13319
|
+
// @ts-ignore
|
|
13320
|
+
_this._iridescenceRange._onValueChanged = _this._onIridescenceRangeChanged.bind(_this);
|
|
13321
|
+
// @ts-ignore
|
|
13322
|
+
sheenColor._onValueChanged = _this._onSheenColorChanged.bind(_this);
|
|
13185
13323
|
return _this;
|
|
13186
13324
|
}
|
|
13187
|
-
|
|
13325
|
+
var _proto = PBRMaterial.prototype;
|
|
13326
|
+
/**
|
|
13327
|
+
* @inheritdoc
|
|
13328
|
+
*/ _proto.clone = function clone() {
|
|
13329
|
+
var dest = new PBRMaterial(this._engine);
|
|
13330
|
+
this._cloneToAndModifyName(dest);
|
|
13331
|
+
return dest;
|
|
13332
|
+
};
|
|
13333
|
+
_proto._onIridescenceRangeChanged = function _onIridescenceRangeChanged() {
|
|
13334
|
+
var iridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceInfoProp);
|
|
13335
|
+
iridescenceInfo.z = this._iridescenceRange.x;
|
|
13336
|
+
iridescenceInfo.w = this._iridescenceRange.y;
|
|
13337
|
+
};
|
|
13338
|
+
_proto._onSheenColorChanged = function _onSheenColorChanged() {
|
|
13339
|
+
var sheenColor = this.sheenColor;
|
|
13340
|
+
var enableSheen = sheenColor.r + sheenColor.g + sheenColor.b > 0;
|
|
13341
|
+
if (enableSheen !== this._sheenEnabled) {
|
|
13342
|
+
this._sheenEnabled = enableSheen;
|
|
13343
|
+
if (enableSheen) {
|
|
13344
|
+
this.shaderData.enableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13345
|
+
} else {
|
|
13346
|
+
this.shaderData.disableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13347
|
+
}
|
|
13348
|
+
}
|
|
13349
|
+
};
|
|
13350
|
+
_create_class(PBRMaterial, [
|
|
13188
13351
|
{
|
|
13189
13352
|
key: "baseColor",
|
|
13190
13353
|
get: /**
|
|
13191
13354
|
* Base color.
|
|
13192
13355
|
*/ function get() {
|
|
13193
|
-
return this.shaderData.getColor(
|
|
13356
|
+
return this.shaderData.getColor(PBRMaterial._baseColorProp);
|
|
13194
13357
|
},
|
|
13195
13358
|
set: function set(value) {
|
|
13196
|
-
var baseColor = this.shaderData.getColor(
|
|
13359
|
+
var baseColor = this.shaderData.getColor(PBRMaterial._baseColorProp);
|
|
13197
13360
|
if (value !== baseColor) {
|
|
13198
13361
|
baseColor.copyFrom(value);
|
|
13199
13362
|
}
|
|
@@ -13204,14 +13367,14 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13204
13367
|
get: /**
|
|
13205
13368
|
* Base texture.
|
|
13206
13369
|
*/ function get() {
|
|
13207
|
-
return this.shaderData.getTexture(
|
|
13370
|
+
return this.shaderData.getTexture(PBRMaterial._baseTextureProp);
|
|
13208
13371
|
},
|
|
13209
13372
|
set: function set(value) {
|
|
13210
|
-
this.shaderData.setTexture(
|
|
13373
|
+
this.shaderData.setTexture(PBRMaterial._baseTextureProp, value);
|
|
13211
13374
|
if (value) {
|
|
13212
|
-
this.shaderData.enableMacro(
|
|
13375
|
+
this.shaderData.enableMacro(PBRMaterial._baseTextureMacro);
|
|
13213
13376
|
} else {
|
|
13214
|
-
this.shaderData.disableMacro(
|
|
13377
|
+
this.shaderData.disableMacro(PBRMaterial._baseTextureMacro);
|
|
13215
13378
|
}
|
|
13216
13379
|
}
|
|
13217
13380
|
},
|
|
@@ -13220,14 +13383,14 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13220
13383
|
get: /**
|
|
13221
13384
|
* Normal texture.
|
|
13222
13385
|
*/ function get() {
|
|
13223
|
-
return this.shaderData.getTexture(
|
|
13386
|
+
return this.shaderData.getTexture(PBRMaterial._normalTextureProp);
|
|
13224
13387
|
},
|
|
13225
13388
|
set: function set(value) {
|
|
13226
|
-
this.shaderData.setTexture(
|
|
13389
|
+
this.shaderData.setTexture(PBRMaterial._normalTextureProp, value);
|
|
13227
13390
|
if (value) {
|
|
13228
|
-
this.shaderData.enableMacro(
|
|
13391
|
+
this.shaderData.enableMacro(PBRMaterial._normalTextureMacro);
|
|
13229
13392
|
} else {
|
|
13230
|
-
this.shaderData.disableMacro(
|
|
13393
|
+
this.shaderData.disableMacro(PBRMaterial._normalTextureMacro);
|
|
13231
13394
|
}
|
|
13232
13395
|
}
|
|
13233
13396
|
},
|
|
@@ -13236,10 +13399,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13236
13399
|
get: /**
|
|
13237
13400
|
* Normal texture intensity.
|
|
13238
13401
|
*/ function get() {
|
|
13239
|
-
return this.shaderData.getFloat(
|
|
13402
|
+
return this.shaderData.getFloat(PBRMaterial._normalIntensityProp);
|
|
13240
13403
|
},
|
|
13241
13404
|
set: function set(value) {
|
|
13242
|
-
this.shaderData.setFloat(
|
|
13405
|
+
this.shaderData.setFloat(PBRMaterial._normalIntensityProp, value);
|
|
13243
13406
|
}
|
|
13244
13407
|
},
|
|
13245
13408
|
{
|
|
@@ -13247,10 +13410,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13247
13410
|
get: /**
|
|
13248
13411
|
* Emissive color.
|
|
13249
13412
|
*/ function get() {
|
|
13250
|
-
return this.shaderData.getColor(
|
|
13413
|
+
return this.shaderData.getColor(PBRMaterial._emissiveColorProp);
|
|
13251
13414
|
},
|
|
13252
13415
|
set: function set(value) {
|
|
13253
|
-
var emissiveColor = this.shaderData.getColor(
|
|
13416
|
+
var emissiveColor = this.shaderData.getColor(PBRMaterial._emissiveColorProp);
|
|
13254
13417
|
if (value !== emissiveColor) {
|
|
13255
13418
|
emissiveColor.copyFrom(value);
|
|
13256
13419
|
}
|
|
@@ -13261,14 +13424,14 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13261
13424
|
get: /**
|
|
13262
13425
|
* Emissive texture.
|
|
13263
13426
|
*/ function get() {
|
|
13264
|
-
return this.shaderData.getTexture(
|
|
13427
|
+
return this.shaderData.getTexture(PBRMaterial._emissiveTextureProp);
|
|
13265
13428
|
},
|
|
13266
13429
|
set: function set(value) {
|
|
13267
|
-
this.shaderData.setTexture(
|
|
13430
|
+
this.shaderData.setTexture(PBRMaterial._emissiveTextureProp, value);
|
|
13268
13431
|
if (value) {
|
|
13269
|
-
this.shaderData.enableMacro(
|
|
13432
|
+
this.shaderData.enableMacro(PBRMaterial._emissiveTextureMacro);
|
|
13270
13433
|
} else {
|
|
13271
|
-
this.shaderData.disableMacro(
|
|
13434
|
+
this.shaderData.disableMacro(PBRMaterial._emissiveTextureMacro);
|
|
13272
13435
|
}
|
|
13273
13436
|
}
|
|
13274
13437
|
},
|
|
@@ -13277,10 +13440,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13277
13440
|
get: /**
|
|
13278
13441
|
* Occlusion texture.
|
|
13279
13442
|
*/ function get() {
|
|
13280
|
-
return this.shaderData.getTexture(
|
|
13443
|
+
return this.shaderData.getTexture(PBRMaterial._occlusionTextureProp);
|
|
13281
13444
|
},
|
|
13282
13445
|
set: function set(value) {
|
|
13283
|
-
this.shaderData.setTexture(
|
|
13446
|
+
this.shaderData.setTexture(PBRMaterial._occlusionTextureProp, value);
|
|
13284
13447
|
if (value) {
|
|
13285
13448
|
this.shaderData.enableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
13286
13449
|
} else {
|
|
@@ -13293,10 +13456,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13293
13456
|
get: /**
|
|
13294
13457
|
* Occlusion texture intensity.
|
|
13295
13458
|
*/ function get() {
|
|
13296
|
-
return this.shaderData.getFloat(
|
|
13459
|
+
return this.shaderData.getFloat(PBRMaterial._occlusionTextureIntensityProp);
|
|
13297
13460
|
},
|
|
13298
13461
|
set: function set(value) {
|
|
13299
|
-
this.shaderData.setFloat(
|
|
13462
|
+
this.shaderData.setFloat(PBRMaterial._occlusionTextureIntensityProp, value);
|
|
13300
13463
|
}
|
|
13301
13464
|
},
|
|
13302
13465
|
{
|
|
@@ -13305,13 +13468,13 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13305
13468
|
* Occlusion texture uv coordinate.
|
|
13306
13469
|
* @remarks Must be UV0 or UV1.
|
|
13307
13470
|
*/ function get() {
|
|
13308
|
-
return this.shaderData.getFloat(
|
|
13471
|
+
return this.shaderData.getFloat(PBRMaterial._occlusionTextureCoordProp);
|
|
13309
13472
|
},
|
|
13310
13473
|
set: function set(value) {
|
|
13311
13474
|
if (value > TextureCoordinate.UV1) {
|
|
13312
13475
|
Logger.warn("Occlusion texture uv coordinate must be UV0 or UV1.");
|
|
13313
13476
|
}
|
|
13314
|
-
this.shaderData.setFloat(
|
|
13477
|
+
this.shaderData.setFloat(PBRMaterial._occlusionTextureCoordProp, value);
|
|
13315
13478
|
}
|
|
13316
13479
|
},
|
|
13317
13480
|
{
|
|
@@ -13319,10 +13482,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13319
13482
|
get: /**
|
|
13320
13483
|
* Tiling and offset of main textures.
|
|
13321
13484
|
*/ function get() {
|
|
13322
|
-
return this.shaderData.getVector4(
|
|
13485
|
+
return this.shaderData.getVector4(PBRMaterial._tilingOffsetProp);
|
|
13323
13486
|
},
|
|
13324
13487
|
set: function set(value) {
|
|
13325
|
-
var tilingOffset = this.shaderData.getVector4(
|
|
13488
|
+
var tilingOffset = this.shaderData.getVector4(PBRMaterial._tilingOffsetProp);
|
|
13326
13489
|
if (value !== tilingOffset) {
|
|
13327
13490
|
tilingOffset.copyFrom(value);
|
|
13328
13491
|
}
|
|
@@ -13333,17 +13496,17 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13333
13496
|
get: /**
|
|
13334
13497
|
* The clearCoat layer intensity, default 0.
|
|
13335
13498
|
*/ function get() {
|
|
13336
|
-
return this.shaderData.getFloat(
|
|
13499
|
+
return this.shaderData.getFloat(PBRMaterial._clearCoatProp);
|
|
13337
13500
|
},
|
|
13338
13501
|
set: function set(value) {
|
|
13339
|
-
if (!!this.shaderData.getFloat(
|
|
13502
|
+
if (!!this.shaderData.getFloat(PBRMaterial._clearCoatProp) !== !!value) {
|
|
13340
13503
|
if (value === 0) {
|
|
13341
13504
|
this.shaderData.disableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
13342
13505
|
} else {
|
|
13343
13506
|
this.shaderData.enableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
13344
13507
|
}
|
|
13345
13508
|
}
|
|
13346
|
-
this.shaderData.setFloat(
|
|
13509
|
+
this.shaderData.setFloat(PBRMaterial._clearCoatProp, value);
|
|
13347
13510
|
}
|
|
13348
13511
|
},
|
|
13349
13512
|
{
|
|
@@ -13351,10 +13514,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13351
13514
|
get: /**
|
|
13352
13515
|
* The clearCoat layer intensity texture.
|
|
13353
13516
|
*/ function get() {
|
|
13354
|
-
return this.shaderData.getTexture(
|
|
13517
|
+
return this.shaderData.getTexture(PBRMaterial._clearCoatTextureProp);
|
|
13355
13518
|
},
|
|
13356
13519
|
set: function set(value) {
|
|
13357
|
-
this.shaderData.setTexture(
|
|
13520
|
+
this.shaderData.setTexture(PBRMaterial._clearCoatTextureProp, value);
|
|
13358
13521
|
if (value) {
|
|
13359
13522
|
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
13360
13523
|
} else {
|
|
@@ -13367,10 +13530,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13367
13530
|
get: /**
|
|
13368
13531
|
* The clearCoat layer roughness, default 0.
|
|
13369
13532
|
*/ function get() {
|
|
13370
|
-
return this.shaderData.getFloat(
|
|
13533
|
+
return this.shaderData.getFloat(PBRMaterial._clearCoatRoughnessProp);
|
|
13371
13534
|
},
|
|
13372
13535
|
set: function set(value) {
|
|
13373
|
-
this.shaderData.setFloat(
|
|
13536
|
+
this.shaderData.setFloat(PBRMaterial._clearCoatRoughnessProp, value);
|
|
13374
13537
|
}
|
|
13375
13538
|
},
|
|
13376
13539
|
{
|
|
@@ -13378,10 +13541,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13378
13541
|
get: /**
|
|
13379
13542
|
* The clearCoat layer roughness texture.
|
|
13380
13543
|
*/ function get() {
|
|
13381
|
-
return this.shaderData.getTexture(
|
|
13544
|
+
return this.shaderData.getTexture(PBRMaterial._clearCoatRoughnessTextureProp);
|
|
13382
13545
|
},
|
|
13383
13546
|
set: function set(value) {
|
|
13384
|
-
this.shaderData.setTexture(
|
|
13547
|
+
this.shaderData.setTexture(PBRMaterial._clearCoatRoughnessTextureProp, value);
|
|
13385
13548
|
if (value) {
|
|
13386
13549
|
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
13387
13550
|
} else {
|
|
@@ -13394,90 +13557,17 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13394
13557
|
get: /**
|
|
13395
13558
|
* The clearCoat normal map texture.
|
|
13396
13559
|
*/ function get() {
|
|
13397
|
-
return this.shaderData.getTexture(
|
|
13560
|
+
return this.shaderData.getTexture(PBRMaterial._clearCoatNormalTextureProp);
|
|
13398
13561
|
},
|
|
13399
13562
|
set: function set(value) {
|
|
13400
|
-
this.shaderData.setTexture(
|
|
13563
|
+
this.shaderData.setTexture(PBRMaterial._clearCoatNormalTextureProp, value);
|
|
13401
13564
|
if (value) {
|
|
13402
13565
|
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
13403
13566
|
} else {
|
|
13404
13567
|
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
13405
13568
|
}
|
|
13406
13569
|
}
|
|
13407
|
-
}
|
|
13408
|
-
]);
|
|
13409
|
-
return PBRBaseMaterial;
|
|
13410
|
-
}(BaseMaterial);
|
|
13411
|
-
PBRBaseMaterial._occlusionTextureIntensityProp = ShaderProperty.getByName("material_OcclusionIntensity");
|
|
13412
|
-
PBRBaseMaterial._occlusionTextureCoordProp = ShaderProperty.getByName("material_OcclusionTextureCoord");
|
|
13413
|
-
PBRBaseMaterial._occlusionTextureProp = ShaderProperty.getByName("material_OcclusionTexture");
|
|
13414
|
-
PBRBaseMaterial._clearCoatProp = ShaderProperty.getByName("material_ClearCoat");
|
|
13415
|
-
PBRBaseMaterial._clearCoatTextureProp = ShaderProperty.getByName("material_ClearCoatTexture");
|
|
13416
|
-
PBRBaseMaterial._clearCoatRoughnessProp = ShaderProperty.getByName("material_ClearCoatRoughness");
|
|
13417
|
-
PBRBaseMaterial._clearCoatRoughnessTextureProp = ShaderProperty.getByName("material_ClearCoatRoughnessTexture");
|
|
13418
|
-
PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material_ClearCoatNormalTexture");
|
|
13419
|
-
|
|
13420
|
-
/**
|
|
13421
|
-
* Refraction mode.
|
|
13422
|
-
*/ var RefractionMode = /*#__PURE__*/ function(RefractionMode) {
|
|
13423
|
-
/** Use the sphere refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Sphere"] = 0] = "Sphere";
|
|
13424
|
-
/** Use the planar refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Planar"] = 1] = "Planar";
|
|
13425
|
-
return RefractionMode;
|
|
13426
|
-
}({});
|
|
13427
|
-
|
|
13428
|
-
/**
|
|
13429
|
-
* PBR (Metallic-Roughness Workflow) Material.
|
|
13430
|
-
*/ var PBRMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
13431
|
-
_inherits(PBRMaterial, PBRBaseMaterial);
|
|
13432
|
-
function PBRMaterial(engine) {
|
|
13433
|
-
var _this;
|
|
13434
|
-
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this, _this._anisotropyRotation = 0, _this._iridescenceRange = new engineMath.Vector2(100, 400), _this._sheenEnabled = false;
|
|
13435
|
-
var shaderData = _this.shaderData;
|
|
13436
|
-
shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
13437
|
-
shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
13438
|
-
shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
13439
|
-
shaderData.setVector3(PBRMaterial._anisotropyInfoProp, new engineMath.Vector3(1, 0, 0));
|
|
13440
|
-
shaderData.setVector4(PBRMaterial._iridescenceInfoProp, new engineMath.Vector4(0, 1.3, 100, 400));
|
|
13441
|
-
var sheenColor = new engineMath.Color(0, 0, 0);
|
|
13442
|
-
shaderData.setColor(PBRMaterial._sheenColorProp, sheenColor);
|
|
13443
|
-
_this.refractionMode = RefractionMode.Planar;
|
|
13444
|
-
shaderData.setFloat(PBRMaterial._transmissionProp, 0);
|
|
13445
|
-
shaderData.setFloat(PBRMaterial._thicknessProp, 0);
|
|
13446
|
-
shaderData.setFloat(PBRMaterial._attenuationDistanceProp, Infinity);
|
|
13447
|
-
var attenuationColor = new engineMath.Color(1, 1, 1);
|
|
13448
|
-
shaderData.setColor(PBRMaterial._attenuationColorProp, attenuationColor);
|
|
13449
|
-
// @ts-ignore
|
|
13450
|
-
_this._iridescenceRange._onValueChanged = _this._onIridescenceRangeChanged.bind(_this);
|
|
13451
|
-
// @ts-ignore
|
|
13452
|
-
sheenColor._onValueChanged = _this._onSheenColorChanged.bind(_this);
|
|
13453
|
-
return _this;
|
|
13454
|
-
}
|
|
13455
|
-
var _proto = PBRMaterial.prototype;
|
|
13456
|
-
/**
|
|
13457
|
-
* @inheritdoc
|
|
13458
|
-
*/ _proto.clone = function clone() {
|
|
13459
|
-
var dest = new PBRMaterial(this._engine);
|
|
13460
|
-
this._cloneToAndModifyName(dest);
|
|
13461
|
-
return dest;
|
|
13462
|
-
};
|
|
13463
|
-
_proto._onIridescenceRangeChanged = function _onIridescenceRangeChanged() {
|
|
13464
|
-
var iridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceInfoProp);
|
|
13465
|
-
iridescenceInfo.z = this._iridescenceRange.x;
|
|
13466
|
-
iridescenceInfo.w = this._iridescenceRange.y;
|
|
13467
|
-
};
|
|
13468
|
-
_proto._onSheenColorChanged = function _onSheenColorChanged() {
|
|
13469
|
-
var sheenColor = this.sheenColor;
|
|
13470
|
-
var enableSheen = sheenColor.r + sheenColor.g + sheenColor.b > 0;
|
|
13471
|
-
if (enableSheen !== this._sheenEnabled) {
|
|
13472
|
-
this._sheenEnabled = enableSheen;
|
|
13473
|
-
if (enableSheen) {
|
|
13474
|
-
this.shaderData.enableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13475
|
-
} else {
|
|
13476
|
-
this.shaderData.disableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13477
|
-
}
|
|
13478
|
-
}
|
|
13479
|
-
};
|
|
13480
|
-
_create_class(PBRMaterial, [
|
|
13570
|
+
},
|
|
13481
13571
|
{
|
|
13482
13572
|
key: "ior",
|
|
13483
13573
|
get: /**
|
|
@@ -13487,7 +13577,7 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material
|
|
|
13487
13577
|
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
13488
13578
|
},
|
|
13489
13579
|
set: function set(v) {
|
|
13490
|
-
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
13580
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.min(Math.max(v, 0), 5));
|
|
13491
13581
|
}
|
|
13492
13582
|
},
|
|
13493
13583
|
{
|
|
@@ -13879,103 +13969,106 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material
|
|
|
13879
13969
|
this.shaderData.disableMacro(PBRMaterial._thicknessTextureMacro);
|
|
13880
13970
|
}
|
|
13881
13971
|
}
|
|
13882
|
-
}
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
PBRMaterial.
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
PBRMaterial._sheenColorProp = ShaderProperty.getByName("material_SheenColor");
|
|
13896
|
-
PBRMaterial._sheenRoughnessProp = ShaderProperty.getByName("material_SheenRoughness");
|
|
13897
|
-
PBRMaterial._sheenTextureProp = ShaderProperty.getByName("material_SheenTexture");
|
|
13898
|
-
PBRMaterial._sheenRoughnessTextureProp = ShaderProperty.getByName("material_SheenRoughnessTexture");
|
|
13899
|
-
PBRMaterial._transmissionMacro = ShaderMacro.getByName("MATERIAL_ENABLE_TRANSMISSION");
|
|
13900
|
-
PBRMaterial._thicknessMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS");
|
|
13901
|
-
PBRMaterial._thicknessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS_TEXTURE");
|
|
13902
|
-
PBRMaterial._transmissionTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_TRANSMISSION_TEXTURE");
|
|
13903
|
-
PBRMaterial._transmissionProp = ShaderProperty.getByName("material_Transmission");
|
|
13904
|
-
PBRMaterial._transmissionTextureProp = ShaderProperty.getByName("material_TransmissionTexture");
|
|
13905
|
-
PBRMaterial._attenuationColorProp = ShaderProperty.getByName("material_AttenuationColor");
|
|
13906
|
-
PBRMaterial._attenuationDistanceProp = ShaderProperty.getByName("material_AttenuationDistance");
|
|
13907
|
-
PBRMaterial._thicknessProp = ShaderProperty.getByName("material_Thickness");
|
|
13908
|
-
PBRMaterial._thicknessTextureProp = ShaderProperty.getByName("material_ThicknessTexture");
|
|
13909
|
-
|
|
13910
|
-
/**
|
|
13911
|
-
* PBR (Specular-Glossiness Workflow) Material.
|
|
13912
|
-
*/ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
13913
|
-
_inherits(PBRSpecularMaterial, PBRBaseMaterial);
|
|
13914
|
-
function PBRSpecularMaterial(engine) {
|
|
13915
|
-
var _this;
|
|
13916
|
-
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr-specular")) || this;
|
|
13917
|
-
_this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new engineMath.Color(1, 1, 1, 1));
|
|
13918
|
-
_this.shaderData.setFloat(PBRSpecularMaterial._glossinessProp, 1.0);
|
|
13919
|
-
return _this;
|
|
13920
|
-
}
|
|
13921
|
-
var _proto = PBRSpecularMaterial.prototype;
|
|
13922
|
-
/**
|
|
13923
|
-
* @inheritdoc
|
|
13924
|
-
*/ _proto.clone = function clone() {
|
|
13925
|
-
var dest = new PBRSpecularMaterial(this._engine);
|
|
13926
|
-
this._cloneToAndModifyName(dest);
|
|
13927
|
-
return dest;
|
|
13928
|
-
};
|
|
13929
|
-
_create_class(PBRSpecularMaterial, [
|
|
13972
|
+
},
|
|
13973
|
+
{
|
|
13974
|
+
key: "specularIntensity",
|
|
13975
|
+
get: /**
|
|
13976
|
+
* The intensity of the specular reflection.
|
|
13977
|
+
* @defaultValue `1.0`
|
|
13978
|
+
*/ function get() {
|
|
13979
|
+
return this.shaderData.getFloat(PBRMaterial._specularIntensityProp);
|
|
13980
|
+
},
|
|
13981
|
+
set: function set(value) {
|
|
13982
|
+
this.shaderData.setFloat(PBRMaterial._specularIntensityProp, Math.min(Math.max(value, 0), 2));
|
|
13983
|
+
}
|
|
13984
|
+
},
|
|
13930
13985
|
{
|
|
13931
13986
|
key: "specularColor",
|
|
13932
13987
|
get: /**
|
|
13933
|
-
*
|
|
13988
|
+
* The F0 color of the specular reflection.
|
|
13989
|
+
* @defaultValue `[1,1,1]`
|
|
13934
13990
|
*/ function get() {
|
|
13935
|
-
return this.shaderData.getColor(
|
|
13991
|
+
return this.shaderData.getColor(PBRMaterial._specularColorProp);
|
|
13936
13992
|
},
|
|
13937
13993
|
set: function set(value) {
|
|
13938
|
-
var specularColor = this.shaderData.getColor(
|
|
13994
|
+
var specularColor = this.shaderData.getColor(PBRMaterial._specularColorProp);
|
|
13939
13995
|
if (value !== specularColor) {
|
|
13940
13996
|
specularColor.copyFrom(value);
|
|
13941
13997
|
}
|
|
13942
13998
|
}
|
|
13943
13999
|
},
|
|
13944
14000
|
{
|
|
13945
|
-
key: "
|
|
14001
|
+
key: "specularIntensityTexture",
|
|
13946
14002
|
get: /**
|
|
13947
|
-
*
|
|
14003
|
+
* The intensity of the specular reflection, stored in alpha(A) channel. This will be multiplied by `specularIntensity`.
|
|
13948
14004
|
*/ function get() {
|
|
13949
|
-
return this.shaderData.
|
|
14005
|
+
return this.shaderData.getTexture(PBRMaterial._specularIntensityTextureProp);
|
|
13950
14006
|
},
|
|
13951
14007
|
set: function set(value) {
|
|
13952
|
-
this.shaderData.
|
|
14008
|
+
this.shaderData.setTexture(PBRMaterial._specularIntensityTextureProp, value);
|
|
14009
|
+
if (value) {
|
|
14010
|
+
this.shaderData.enableMacro(PBRMaterial._specularTextureMacro);
|
|
14011
|
+
} else {
|
|
14012
|
+
this.shaderData.disableMacro(PBRMaterial._specularTextureMacro);
|
|
14013
|
+
}
|
|
13953
14014
|
}
|
|
13954
14015
|
},
|
|
13955
14016
|
{
|
|
13956
|
-
key: "
|
|
14017
|
+
key: "specularColorTexture",
|
|
13957
14018
|
get: /**
|
|
13958
|
-
*
|
|
13959
|
-
* @remarks RGB is specular, A is glossiness
|
|
14019
|
+
* The F0 color of the specular reflection, stored in the RGB channels. This will be multiplied by `specularColor`.
|
|
13960
14020
|
*/ function get() {
|
|
13961
|
-
return this.shaderData.getTexture(
|
|
14021
|
+
return this.shaderData.getTexture(PBRMaterial._specularColorTextureProp);
|
|
13962
14022
|
},
|
|
13963
14023
|
set: function set(value) {
|
|
13964
|
-
this.shaderData.setTexture(
|
|
14024
|
+
this.shaderData.setTexture(PBRMaterial._specularColorTextureProp, value);
|
|
13965
14025
|
if (value) {
|
|
13966
|
-
this.shaderData.enableMacro(
|
|
14026
|
+
this.shaderData.enableMacro(PBRMaterial._specularColorTextureMacro);
|
|
13967
14027
|
} else {
|
|
13968
|
-
this.shaderData.disableMacro(
|
|
14028
|
+
this.shaderData.disableMacro(PBRMaterial._specularColorTextureMacro);
|
|
13969
14029
|
}
|
|
13970
14030
|
}
|
|
13971
14031
|
}
|
|
13972
14032
|
]);
|
|
13973
|
-
return
|
|
13974
|
-
}(
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
14033
|
+
return PBRMaterial;
|
|
14034
|
+
}(BaseMaterial);
|
|
14035
|
+
PBRMaterial._occlusionTextureIntensityProp = ShaderProperty.getByName("material_OcclusionIntensity");
|
|
14036
|
+
PBRMaterial._occlusionTextureCoordProp = ShaderProperty.getByName("material_OcclusionTextureCoord");
|
|
14037
|
+
PBRMaterial._occlusionTextureProp = ShaderProperty.getByName("material_OcclusionTexture");
|
|
14038
|
+
PBRMaterial._clearCoatProp = ShaderProperty.getByName("material_ClearCoat");
|
|
14039
|
+
PBRMaterial._clearCoatTextureProp = ShaderProperty.getByName("material_ClearCoatTexture");
|
|
14040
|
+
PBRMaterial._clearCoatRoughnessProp = ShaderProperty.getByName("material_ClearCoatRoughness");
|
|
14041
|
+
PBRMaterial._clearCoatRoughnessTextureProp = ShaderProperty.getByName("material_ClearCoatRoughnessTexture");
|
|
14042
|
+
PBRMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material_ClearCoatNormalTexture");
|
|
14043
|
+
PBRMaterial._metallicProp = ShaderProperty.getByName("material_Metal");
|
|
14044
|
+
PBRMaterial._roughnessProp = ShaderProperty.getByName("material_Roughness");
|
|
14045
|
+
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
14046
|
+
PBRMaterial._iorProp = ShaderProperty.getByName("material_IOR");
|
|
14047
|
+
PBRMaterial._anisotropyInfoProp = ShaderProperty.getByName("material_AnisotropyInfo");
|
|
14048
|
+
PBRMaterial._anisotropyTextureProp = ShaderProperty.getByName("material_AnisotropyTexture");
|
|
14049
|
+
PBRMaterial._iridescenceInfoProp = ShaderProperty.getByName("material_IridescenceInfo");
|
|
14050
|
+
PBRMaterial._iridescenceThicknessTextureProp = ShaderProperty.getByName("material_IridescenceThicknessTexture");
|
|
14051
|
+
PBRMaterial._iridescenceTextureProp = ShaderProperty.getByName("material_IridescenceTexture");
|
|
14052
|
+
PBRMaterial._sheenColorProp = ShaderProperty.getByName("material_SheenColor");
|
|
14053
|
+
PBRMaterial._sheenRoughnessProp = ShaderProperty.getByName("material_SheenRoughness");
|
|
14054
|
+
PBRMaterial._sheenTextureProp = ShaderProperty.getByName("material_SheenTexture");
|
|
14055
|
+
PBRMaterial._sheenRoughnessTextureProp = ShaderProperty.getByName("material_SheenRoughnessTexture");
|
|
14056
|
+
PBRMaterial._transmissionMacro = ShaderMacro.getByName("MATERIAL_ENABLE_TRANSMISSION");
|
|
14057
|
+
PBRMaterial._thicknessMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS");
|
|
14058
|
+
PBRMaterial._thicknessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS_TEXTURE");
|
|
14059
|
+
PBRMaterial._transmissionTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_TRANSMISSION_TEXTURE");
|
|
14060
|
+
PBRMaterial._transmissionProp = ShaderProperty.getByName("material_Transmission");
|
|
14061
|
+
PBRMaterial._transmissionTextureProp = ShaderProperty.getByName("material_TransmissionTexture");
|
|
14062
|
+
PBRMaterial._attenuationColorProp = ShaderProperty.getByName("material_AttenuationColor");
|
|
14063
|
+
PBRMaterial._attenuationDistanceProp = ShaderProperty.getByName("material_AttenuationDistance");
|
|
14064
|
+
PBRMaterial._thicknessProp = ShaderProperty.getByName("material_Thickness");
|
|
14065
|
+
PBRMaterial._thicknessTextureProp = ShaderProperty.getByName("material_ThicknessTexture");
|
|
14066
|
+
PBRMaterial._specularTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_TEXTURE");
|
|
14067
|
+
PBRMaterial._specularColorTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_COLOR_TEXTURE");
|
|
14068
|
+
PBRMaterial._specularIntensityProp = ShaderProperty.getByName("material_SpecularIntensity");
|
|
14069
|
+
PBRMaterial._specularColorProp = ShaderProperty.getByName("material_SpecularColor");
|
|
14070
|
+
PBRMaterial._specularIntensityTextureProp = ShaderProperty.getByName("material_SpecularIntensityTexture");
|
|
14071
|
+
PBRMaterial._specularColorTextureProp = ShaderProperty.getByName("material_SpecularColorTexture");
|
|
13979
14072
|
|
|
13980
14073
|
/**
|
|
13981
14074
|
* Unlit Material.
|
|
@@ -25777,7 +25870,7 @@ ShaderPool.init();
|
|
|
25777
25870
|
_inherits(Engine, EventDispatcher);
|
|
25778
25871
|
function Engine(canvas, hardwareRenderer, configuration) {
|
|
25779
25872
|
var _this;
|
|
25780
|
-
_this = EventDispatcher.call(this) || this, /** @internal */ _this._physicsInitialized = false, /* @internal */ _this._lastRenderState = new RenderState(), /* @internal */ _this._renderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._subRenderElementPool = new ClearableObjectPool(SubRenderElement), /* @internal */ _this._textSubRenderElementPool = new ClearableObjectPool(SubRenderElement), /* @internal */ _this._charRenderInfoPool = new ReturnableObjectPool(CharRenderInfo, 50), /* @internal */ _this._renderContext = new RenderContext(), /* @internal */ _this._renderCount = 0, /* @internal */ _this._shaderProgramPools = [], /** @internal */ _this._fontMap = {}, /** @internal */ _this._macroCollection = new ShaderMacroCollection(), /** @internal */ _this._postProcessPassNeedRefresh = false, _this._settings = {}, _this._resourceManager = new ResourceManager(_this), _this._sceneManager = new SceneManager(_this), _this._vSyncCount = 1, _this._targetFrameRate = 60, _this._time = new Time(), _this._isPaused = true, _this._vSyncCounter = 1, _this._targetFrameInterval = 1000 / 60, _this._destroyed = false, _this._frameInProcess = false, _this._waitingDestroy = false, _this.
|
|
25873
|
+
_this = EventDispatcher.call(this) || this, /** @internal */ _this._physicsInitialized = false, /* @internal */ _this._lastRenderState = new RenderState(), /* @internal */ _this._renderElementPool = new ClearableObjectPool(RenderElement), /* @internal */ _this._subRenderElementPool = new ClearableObjectPool(SubRenderElement), /* @internal */ _this._textSubRenderElementPool = new ClearableObjectPool(SubRenderElement), /* @internal */ _this._charRenderInfoPool = new ReturnableObjectPool(CharRenderInfo, 50), /* @internal */ _this._renderContext = new RenderContext(), /* @internal */ _this._renderCount = 0, /* @internal */ _this._shaderProgramPools = [], /** @internal */ _this._fontMap = {}, /** @internal */ _this._macroCollection = new ShaderMacroCollection(), /** @internal */ _this._postProcessPassNeedRefresh = false, _this._settings = {}, _this._resourceManager = new ResourceManager(_this), _this._sceneManager = new SceneManager(_this), _this._vSyncCount = 1, _this._targetFrameRate = 60, _this._time = new Time(), _this._isPaused = true, _this._vSyncCounter = 1, _this._targetFrameInterval = 1000 / 60, _this._destroyed = false, _this._frameInProcess = false, _this._waitingDestroy = false, _this._waitingGC = false, _this._postProcessPasses = new Array(), _this._activePostProcessPasses = new Array(), _this._animate = function() {
|
|
25781
25874
|
if (_this._vSyncCount) {
|
|
25782
25875
|
var _this_xrManager;
|
|
25783
25876
|
var raf = ((_this_xrManager = _this.xrManager) == null ? void 0 : _this_xrManager._getRequestAnimationFrame()) || requestAnimationFrame;
|
|
@@ -25912,7 +26005,7 @@ ShaderPool.init();
|
|
|
25912
26005
|
scene4._componentsManager.callScriptOnLateUpdate(deltaTime);
|
|
25913
26006
|
}
|
|
25914
26007
|
// Render scene and fire `onBeginRender` and `onEndRender`
|
|
25915
|
-
if (!this.
|
|
26008
|
+
if (!this._hardwareRenderer.isContextLost()) {
|
|
25916
26009
|
this._render(scenes);
|
|
25917
26010
|
}
|
|
25918
26011
|
if (this._waitingDestroy) {
|
|
@@ -26135,7 +26228,6 @@ ShaderPool.init();
|
|
|
26135
26228
|
});
|
|
26136
26229
|
};
|
|
26137
26230
|
_proto._onDeviceLost = function _onDeviceLost() {
|
|
26138
|
-
this._isDeviceLost = true;
|
|
26139
26231
|
// Lose graphic resources
|
|
26140
26232
|
this.resourceManager._lostGraphicResources();
|
|
26141
26233
|
console.log("Device lost.");
|
|
@@ -26156,7 +26248,6 @@ ShaderPool.init();
|
|
|
26156
26248
|
resourceManager._restoreResourcesContent().then(function() {
|
|
26157
26249
|
console.log("Graphic resource content restored.\n\n" + "Device restored.");
|
|
26158
26250
|
_this.dispatch("devicerestored", _this);
|
|
26159
|
-
_this._isDeviceLost = false;
|
|
26160
26251
|
}).catch(function(error) {
|
|
26161
26252
|
console.error(error);
|
|
26162
26253
|
});
|
|
@@ -36679,6 +36770,7 @@ __decorate([
|
|
|
36679
36770
|
Polyfill._registerMatchAll();
|
|
36680
36771
|
Polyfill._registerAudioContext();
|
|
36681
36772
|
Polyfill._registerTextMetrics();
|
|
36773
|
+
Polyfill._registerPromiseFinally();
|
|
36682
36774
|
};
|
|
36683
36775
|
Polyfill._registerMatchAll = function _registerMatchAll() {
|
|
36684
36776
|
if (!String.prototype.matchAll) {
|
|
@@ -36776,6 +36868,24 @@ __decorate([
|
|
|
36776
36868
|
});
|
|
36777
36869
|
}
|
|
36778
36870
|
};
|
|
36871
|
+
Polyfill._registerPromiseFinally = function _registerPromiseFinally() {
|
|
36872
|
+
// iOS Safari 10.0-10.2 and older versions do not support Promise.prototype.finally
|
|
36873
|
+
// Examples: iPhone 6s and below devices without system upgrade
|
|
36874
|
+
if (!Promise.prototype.finally) {
|
|
36875
|
+
Logger.info("Polyfill Promise.prototype.finally");
|
|
36876
|
+
Promise.prototype.finally = function(onFinally) {
|
|
36877
|
+
return this.then(function(value) {
|
|
36878
|
+
return Promise.resolve(onFinally == null ? void 0 : onFinally()).then(function() {
|
|
36879
|
+
return value;
|
|
36880
|
+
});
|
|
36881
|
+
}, function(reason) {
|
|
36882
|
+
return Promise.resolve(onFinally == null ? void 0 : onFinally()).then(function() {
|
|
36883
|
+
throw reason;
|
|
36884
|
+
});
|
|
36885
|
+
});
|
|
36886
|
+
};
|
|
36887
|
+
}
|
|
36888
|
+
};
|
|
36779
36889
|
return Polyfill;
|
|
36780
36890
|
}();
|
|
36781
36891
|
|
|
@@ -36905,9 +37015,7 @@ exports.MeshShape = MeshShape;
|
|
|
36905
37015
|
exports.MeshTopology = MeshTopology;
|
|
36906
37016
|
exports.ModelMesh = ModelMesh;
|
|
36907
37017
|
exports.OverflowMode = OverflowMode;
|
|
36908
|
-
exports.PBRBaseMaterial = PBRBaseMaterial;
|
|
36909
37018
|
exports.PBRMaterial = PBRMaterial;
|
|
36910
|
-
exports.PBRSpecularMaterial = PBRSpecularMaterial;
|
|
36911
37019
|
exports.ParticleCompositeCurve = ParticleCompositeCurve;
|
|
36912
37020
|
exports.ParticleCompositeGradient = ParticleCompositeGradient;
|
|
36913
37021
|
exports.ParticleCurve = ParticleCurve;
|
|
@@ -37042,6 +37150,7 @@ exports.TonemappingMode = TonemappingMode;
|
|
|
37042
37150
|
exports.TrailMaterial = TrailMaterial;
|
|
37043
37151
|
exports.TrailRenderer = TrailRenderer;
|
|
37044
37152
|
exports.Transform = Transform;
|
|
37153
|
+
exports.TransformModifyFlags = TransformModifyFlags;
|
|
37045
37154
|
exports.UnlitMaterial = UnlitMaterial;
|
|
37046
37155
|
exports.Utils = Utils;
|
|
37047
37156
|
exports.VelocityOverLifetimeModule = VelocityOverLifetimeModule;
|