@galacean/engine-core 1.5.14 → 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/module.js
CHANGED
|
@@ -503,6 +503,7 @@ __decorate([
|
|
|
503
503
|
/** RGB compressed format, 4 bits per pixel. */ TextureFormat[TextureFormat["BC1"] = 10] = "BC1";
|
|
504
504
|
/** RGBA compressed format, 8 bits per pixel. */ TextureFormat[TextureFormat["BC3"] = 11] = "BC3";
|
|
505
505
|
/** RGB(A) compressed format, 128 bits per 4x4 pixel block. */ TextureFormat[TextureFormat["BC7"] = 12] = "BC7";
|
|
506
|
+
/** RGB HDR compressed format, 8 bits per pixel. */ TextureFormat[TextureFormat["BC6H"] = 100] = "BC6H";
|
|
506
507
|
/** RGB compressed format, 4 bits per pixel. */ TextureFormat[TextureFormat["ETC1_RGB"] = 13] = "ETC1_RGB";
|
|
507
508
|
/** RGB compressed format, 4 bits per pixel. */ TextureFormat[TextureFormat["ETC2_RGB"] = 14] = "ETC2_RGB";
|
|
508
509
|
/** RGBA compressed format, 5 bits per pixel, 4 bit in RGB, 1 bit in A. */ TextureFormat[TextureFormat["ETC2_RGBA5"] = 15] = "ETC2_RGBA5";
|
|
@@ -676,6 +677,7 @@ var Logger = {
|
|
|
676
677
|
GLCapabilityType["fragDepth"] = "EXT_frag_depth";
|
|
677
678
|
GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
|
|
678
679
|
GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
|
|
680
|
+
GLCapabilityType["astc_hdr"] = "WEBGL_compressed_texture_astc_hdr";
|
|
679
681
|
GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
|
|
680
682
|
GLCapabilityType["etc_webkit"] = "WEBKIT_WEBGL_compressed_texture_etc";
|
|
681
683
|
GLCapabilityType["etc1"] = "WEBGL_compressed_texture_etc1";
|
|
@@ -792,12 +794,19 @@ var AssetPromise = /*#__PURE__*/ function() {
|
|
|
792
794
|
});
|
|
793
795
|
};
|
|
794
796
|
/**
|
|
795
|
-
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected).
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
* @
|
|
797
|
+
* Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected).
|
|
798
|
+
* The callback result is ignored and the original value/reason is preserved per Promise spec.
|
|
799
|
+
* Returns an AssetPromise to keep chainability with AssetPromise methods.
|
|
800
|
+
* @param onFinally - The callback to execute when the Promise is settled.
|
|
801
|
+
* @returns An AssetPromise for the completion of the callback.
|
|
799
802
|
*/ _proto.finally = function _finally(onFinally) {
|
|
800
|
-
return this.
|
|
803
|
+
return this.then(function(value) {
|
|
804
|
+
onFinally == null ? void 0 : onFinally();
|
|
805
|
+
return value;
|
|
806
|
+
}, function(reason) {
|
|
807
|
+
onFinally == null ? void 0 : onFinally();
|
|
808
|
+
throw reason;
|
|
809
|
+
});
|
|
801
810
|
};
|
|
802
811
|
/**
|
|
803
812
|
* Cancel promise request.
|
|
@@ -5348,7 +5357,6 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5348
5357
|
// Create program and link shader
|
|
5349
5358
|
var program = gl.createProgram();
|
|
5350
5359
|
if (!program) {
|
|
5351
|
-
console.warn("Context lost while create program.");
|
|
5352
5360
|
return null;
|
|
5353
5361
|
}
|
|
5354
5362
|
gl.attachShader(program, vertexShader);
|
|
@@ -5368,7 +5376,6 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5368
5376
|
var gl = this._gl;
|
|
5369
5377
|
var shader = gl.createShader(shaderType);
|
|
5370
5378
|
if (!shader) {
|
|
5371
|
-
console.warn("Context lost while create shader.");
|
|
5372
5379
|
return null;
|
|
5373
5380
|
}
|
|
5374
5381
|
gl.shaderSource(shader, shaderSource);
|
|
@@ -5536,7 +5543,9 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5536
5543
|
_proto._getUniformInfos = function _getUniformInfos() {
|
|
5537
5544
|
var gl = this._gl;
|
|
5538
5545
|
var program = this._glProgram;
|
|
5539
|
-
var
|
|
5546
|
+
var _gl_getProgramParameter;
|
|
5547
|
+
// uniformCount is `null` when context lost.
|
|
5548
|
+
var uniformCount = (_gl_getProgramParameter = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)) != null ? _gl_getProgramParameter : 0;
|
|
5540
5549
|
var uniformInfos = new Array(uniformCount);
|
|
5541
5550
|
for(var i = 0; i < uniformCount; ++i){
|
|
5542
5551
|
var info = gl.getActiveUniform(program, i);
|
|
@@ -5548,7 +5557,9 @@ ShaderTagKey._nameMap = Object.create(null);
|
|
|
5548
5557
|
var gl = this._gl;
|
|
5549
5558
|
var program = this._glProgram;
|
|
5550
5559
|
var attributeInfos = new Array();
|
|
5551
|
-
var
|
|
5560
|
+
var _gl_getProgramParameter;
|
|
5561
|
+
// attributeCount is `null` when context lost.
|
|
5562
|
+
var attributeCount = (_gl_getProgramParameter = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)) != null ? _gl_getProgramParameter : 0;
|
|
5552
5563
|
for(var i = 0; i < attributeCount; ++i){
|
|
5553
5564
|
var info = gl.getActiveAttrib(program, i);
|
|
5554
5565
|
attributeInfos[i] = info;
|
|
@@ -7796,22 +7807,59 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7796
7807
|
target._rotation.copyFrom(this.rotation);
|
|
7797
7808
|
target._scale.copyFrom(this.scale);
|
|
7798
7809
|
};
|
|
7799
|
-
_proto.
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
this.
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
this.
|
|
7813
|
-
|
|
7814
|
-
|
|
7810
|
+
_proto._onWorldMatrixChange = function _onWorldMatrixChange() {
|
|
7811
|
+
this._setDirtyFlagFalse(128);
|
|
7812
|
+
};
|
|
7813
|
+
_proto._isContainDirtyFlags = function _isContainDirtyFlags(targetDirtyFlags) {
|
|
7814
|
+
return (this._dirtyFlag & targetDirtyFlags) === targetDirtyFlags;
|
|
7815
|
+
};
|
|
7816
|
+
_proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
7817
|
+
return (this._dirtyFlag & type) != 0;
|
|
7818
|
+
};
|
|
7819
|
+
_proto._setDirtyFlagTrue = function _setDirtyFlagTrue(type) {
|
|
7820
|
+
this._dirtyFlag |= type;
|
|
7821
|
+
};
|
|
7822
|
+
_proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
7823
|
+
this._dirtyFlag &= ~type;
|
|
7824
|
+
};
|
|
7825
|
+
_proto._worldAssociatedChange = function _worldAssociatedChange(type) {
|
|
7826
|
+
var dispatchFlags = type & ~this._dirtyFlag;
|
|
7827
|
+
this._dirtyFlag |= type;
|
|
7828
|
+
this._entity._updateFlagManager.dispatch(dispatchFlags);
|
|
7829
|
+
};
|
|
7830
|
+
_proto._getParentTransform = function _getParentTransform() {
|
|
7831
|
+
if (!this._isParentDirty) {
|
|
7832
|
+
return this._parentTransformCache;
|
|
7833
|
+
}
|
|
7834
|
+
var parentCache = null;
|
|
7835
|
+
var parent = this._entity.parent;
|
|
7836
|
+
while(parent){
|
|
7837
|
+
var transform = parent.transform;
|
|
7838
|
+
if (transform) {
|
|
7839
|
+
parentCache = transform;
|
|
7840
|
+
break;
|
|
7841
|
+
} else {
|
|
7842
|
+
parent = parent.parent;
|
|
7843
|
+
}
|
|
7844
|
+
}
|
|
7845
|
+
this._parentTransformCache = parentCache;
|
|
7846
|
+
this._isParentDirty = false;
|
|
7847
|
+
return parentCache;
|
|
7848
|
+
};
|
|
7849
|
+
_proto._onPositionChanged = function _onPositionChanged() {
|
|
7850
|
+
this._setDirtyFlagTrue(64);
|
|
7851
|
+
this._updateWorldPositionFlag();
|
|
7852
|
+
};
|
|
7853
|
+
_proto._onWorldPositionChanged = function _onWorldPositionChanged() {
|
|
7854
|
+
var worldPosition = this._worldPosition;
|
|
7855
|
+
var parent = this._getParentTransform();
|
|
7856
|
+
if (parent) {
|
|
7857
|
+
Matrix.invert(parent.worldMatrix, Transform._tempMat41);
|
|
7858
|
+
Vector3.transformCoordinate(worldPosition, Transform._tempMat41, this._position);
|
|
7859
|
+
} else {
|
|
7860
|
+
this._position.copyFrom(worldPosition);
|
|
7861
|
+
}
|
|
7862
|
+
this._setDirtyFlagFalse(4);
|
|
7815
7863
|
};
|
|
7816
7864
|
/**
|
|
7817
7865
|
* Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
|
|
@@ -7913,25 +7961,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7913
7961
|
}
|
|
7914
7962
|
}
|
|
7915
7963
|
};
|
|
7916
|
-
_proto._getParentTransform = function _getParentTransform() {
|
|
7917
|
-
if (!this._isParentDirty) {
|
|
7918
|
-
return this._parentTransformCache;
|
|
7919
|
-
}
|
|
7920
|
-
var parentCache = null;
|
|
7921
|
-
var parent = this._entity.parent;
|
|
7922
|
-
while(parent){
|
|
7923
|
-
var transform = parent.transform;
|
|
7924
|
-
if (transform) {
|
|
7925
|
-
parentCache = transform;
|
|
7926
|
-
break;
|
|
7927
|
-
} else {
|
|
7928
|
-
parent = parent.parent;
|
|
7929
|
-
}
|
|
7930
|
-
}
|
|
7931
|
-
this._parentTransformCache = parentCache;
|
|
7932
|
-
this._isParentDirty = false;
|
|
7933
|
-
return parentCache;
|
|
7934
|
-
};
|
|
7935
7964
|
_proto._getScaleMatrix = function _getScaleMatrix() {
|
|
7936
7965
|
var invRotation = Transform._tempQuat0;
|
|
7937
7966
|
var invRotationMat = Transform._tempMat30;
|
|
@@ -7943,22 +7972,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7943
7972
|
Matrix3x3.multiply(invRotationMat, worldRotScaMat, scaMat);
|
|
7944
7973
|
return scaMat;
|
|
7945
7974
|
};
|
|
7946
|
-
_proto._isContainDirtyFlags = function _isContainDirtyFlags(targetDirtyFlags) {
|
|
7947
|
-
return (this._dirtyFlag & targetDirtyFlags) === targetDirtyFlags;
|
|
7948
|
-
};
|
|
7949
|
-
_proto._isContainDirtyFlag = function _isContainDirtyFlag(type) {
|
|
7950
|
-
return (this._dirtyFlag & type) != 0;
|
|
7951
|
-
};
|
|
7952
|
-
_proto._setDirtyFlagTrue = function _setDirtyFlagTrue(type) {
|
|
7953
|
-
this._dirtyFlag |= type;
|
|
7954
|
-
};
|
|
7955
|
-
_proto._setDirtyFlagFalse = function _setDirtyFlagFalse(type) {
|
|
7956
|
-
this._dirtyFlag &= ~type;
|
|
7957
|
-
};
|
|
7958
|
-
_proto._worldAssociatedChange = function _worldAssociatedChange(type) {
|
|
7959
|
-
this._dirtyFlag |= type;
|
|
7960
|
-
this._entity._updateFlagManager.dispatch(type);
|
|
7961
|
-
};
|
|
7962
7975
|
_proto._rotateByQuat = function _rotateByQuat(rotateQuat, relativeToLocal) {
|
|
7963
7976
|
if (relativeToLocal) {
|
|
7964
7977
|
Quaternion.multiply(this.rotationQuaternion, rotateQuat, this._rotationQuaternion);
|
|
@@ -7983,21 +7996,6 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
7983
7996
|
Quaternion.rotationEuler(x * radFactor, y * radFactor, z * radFactor, rotQuat);
|
|
7984
7997
|
this._rotateByQuat(rotQuat, relativeToLocal);
|
|
7985
7998
|
};
|
|
7986
|
-
_proto._onPositionChanged = function _onPositionChanged() {
|
|
7987
|
-
this._setDirtyFlagTrue(64);
|
|
7988
|
-
this._updateWorldPositionFlag();
|
|
7989
|
-
};
|
|
7990
|
-
_proto._onWorldPositionChanged = function _onWorldPositionChanged() {
|
|
7991
|
-
var worldPosition = this._worldPosition;
|
|
7992
|
-
var parent = this._getParentTransform();
|
|
7993
|
-
if (parent) {
|
|
7994
|
-
Matrix.invert(parent.worldMatrix, Transform._tempMat41);
|
|
7995
|
-
Vector3.transformCoordinate(worldPosition, Transform._tempMat41, this._position);
|
|
7996
|
-
} else {
|
|
7997
|
-
this._position.copyFrom(worldPosition);
|
|
7998
|
-
}
|
|
7999
|
-
this._setDirtyFlagFalse(4);
|
|
8000
|
-
};
|
|
8001
7999
|
_proto._onRotationChanged = function _onRotationChanged() {
|
|
8002
8000
|
this._setDirtyFlagTrue(64 | 2);
|
|
8003
8001
|
this._setDirtyFlagFalse(1);
|
|
@@ -8258,15 +8256,16 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
8258
8256
|
var _this = this, position = _this._position, rotationQuaternion = _this._rotationQuaternion, scale = _this._scale;
|
|
8259
8257
|
// @ts-ignore
|
|
8260
8258
|
position._onValueChanged = rotationQuaternion._onValueChanged = scale._onValueChanged = null;
|
|
8261
|
-
|
|
8259
|
+
value.decompose(position, rotationQuaternion, scale);
|
|
8260
|
+
this._onLocalMatrixChanging == null ? void 0 : this._onLocalMatrixChanging.call(this);
|
|
8261
|
+
this._setDirtyFlagTrue(1);
|
|
8262
|
+
this._setDirtyFlagFalse(64 | 2);
|
|
8262
8263
|
// @ts-ignore
|
|
8263
8264
|
position._onValueChanged = this._onPositionChanged;
|
|
8264
8265
|
// @ts-ignore
|
|
8265
8266
|
rotationQuaternion._onValueChanged = this._onRotationQuaternionChanged;
|
|
8266
8267
|
// @ts-ignore
|
|
8267
8268
|
scale._onValueChanged = this._onScaleChanged;
|
|
8268
|
-
this._setDirtyFlagTrue(1);
|
|
8269
|
-
this._setDirtyFlagFalse(64 | 2);
|
|
8270
8269
|
var localUniformScaling = scale.x === scale.y && scale.y === scale.z;
|
|
8271
8270
|
if (this._localUniformScaling !== localUniformScaling) {
|
|
8272
8271
|
this._localUniformScaling = localUniformScaling;
|
|
@@ -8305,7 +8304,7 @@ function dependentComponents(componentOrComponents, dependentMode) {
|
|
|
8305
8304
|
this._localMatrix.copyFrom(value);
|
|
8306
8305
|
}
|
|
8307
8306
|
this.localMatrix = this._localMatrix;
|
|
8308
|
-
this.
|
|
8307
|
+
this._onWorldMatrixChange();
|
|
8309
8308
|
}
|
|
8310
8309
|
},
|
|
8311
8310
|
{
|
|
@@ -8426,7 +8425,7 @@ __decorate([
|
|
|
8426
8425
|
ignoreClone
|
|
8427
8426
|
], Transform.prototype, "_onScaleChanged", null);
|
|
8428
8427
|
/**
|
|
8429
|
-
*
|
|
8428
|
+
* Dirty flag of transform.
|
|
8430
8429
|
*/ var TransformModifyFlags = /*#__PURE__*/ function(TransformModifyFlags) {
|
|
8431
8430
|
TransformModifyFlags[TransformModifyFlags["LocalEuler"] = 1] = "LocalEuler";
|
|
8432
8431
|
TransformModifyFlags[TransformModifyFlags["LocalQuat"] = 2] = "LocalQuat";
|
|
@@ -10945,43 +10944,130 @@ __decorate([
|
|
|
10945
10944
|
if (outHitResult) {
|
|
10946
10945
|
hitResult = outHitResult;
|
|
10947
10946
|
}
|
|
10948
|
-
var
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
}
|
|
10953
|
-
return shape.collider.entity.layer & layerMask && shape.isSceneQuery;
|
|
10954
|
-
};
|
|
10955
|
-
var outIDX;
|
|
10956
|
-
var outDistance;
|
|
10957
|
-
var outPosition;
|
|
10958
|
-
var outNormal;
|
|
10959
|
-
if (hitResult != undefined) {
|
|
10960
|
-
var result = this._nativePhysicsScene.raycast(ray, distance, onRaycast, function(idx, distance, position, normal) {
|
|
10961
|
-
outIDX = idx;
|
|
10962
|
-
outDistance = distance;
|
|
10963
|
-
outPosition = position;
|
|
10964
|
-
outNormal = normal;
|
|
10965
|
-
});
|
|
10966
|
-
if (result) {
|
|
10967
|
-
var hitShape = Engine._physicalObjectsMap[outIDX];
|
|
10968
|
-
hitResult.entity = hitShape._collider.entity;
|
|
10969
|
-
hitResult.shape = hitShape;
|
|
10970
|
-
hitResult.distance = outDistance;
|
|
10971
|
-
hitResult.point.copyFrom(outPosition);
|
|
10972
|
-
hitResult.normal.copyFrom(outNormal);
|
|
10973
|
-
return true;
|
|
10974
|
-
} else {
|
|
10975
|
-
hitResult.entity = null;
|
|
10976
|
-
hitResult.shape = null;
|
|
10977
|
-
hitResult.distance = 0;
|
|
10978
|
-
hitResult.point.set(0, 0, 0);
|
|
10979
|
-
hitResult.normal.set(0, 0, 0);
|
|
10980
|
-
return false;
|
|
10981
|
-
}
|
|
10982
|
-
} else {
|
|
10983
|
-
return this._nativePhysicsScene.raycast(ray, distance, onRaycast);
|
|
10947
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
10948
|
+
var result = this._nativePhysicsScene.raycast(ray, distance, preFilter, hitResult ? this._createHitCallback(hitResult) : undefined);
|
|
10949
|
+
if (!result && hitResult) {
|
|
10950
|
+
this._clearHitResult(hitResult);
|
|
10984
10951
|
}
|
|
10952
|
+
return result;
|
|
10953
|
+
};
|
|
10954
|
+
/**
|
|
10955
|
+
* Casts a box through the Scene and returns true if there is any hit.
|
|
10956
|
+
* @param center - The center of the box
|
|
10957
|
+
* @param halfExtents - Half the size of the box in each dimension
|
|
10958
|
+
* @param direction - The direction to sweep along
|
|
10959
|
+
* @param orientation - The rotation of the box. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
10960
|
+
* @param distance - The max distance to sweep. @defaultValue `Number.MAX_VALUE`
|
|
10961
|
+
* @param layerMask - Layer mask that is used to selectively ignore Colliders when sweeping. @defaultValue `Layer.Everything`
|
|
10962
|
+
* @param outHitResult - Optional HitResult object to store detailed hit information
|
|
10963
|
+
* @returns Returns true if the box intersects with any collider, otherwise false
|
|
10964
|
+
*/ _proto.boxCast = function boxCast(center, halfExtents, direction, orientation, distance, layerMask, outHitResult) {
|
|
10965
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
10966
|
+
if (distance === void 0) distance = Number.MAX_VALUE;
|
|
10967
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
10968
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
10969
|
+
var result = this._nativePhysicsScene.boxCast(center, orientation, halfExtents, direction, distance, preFilter, outHitResult ? this._createHitCallback(outHitResult) : undefined);
|
|
10970
|
+
if (!result && outHitResult) {
|
|
10971
|
+
this._clearHitResult(outHitResult);
|
|
10972
|
+
}
|
|
10973
|
+
return result;
|
|
10974
|
+
};
|
|
10975
|
+
/**
|
|
10976
|
+
* Casts a sphere through the Scene and returns true if there is any hit.
|
|
10977
|
+
* @param center - The center of the sphere
|
|
10978
|
+
* @param radius - The radius of the sphere
|
|
10979
|
+
* @param direction - The direction to sweep along
|
|
10980
|
+
* @param distance - The max distance to sweep. @defaultValue `Number.MAX_VALUE`
|
|
10981
|
+
* @param layerMask - Layer mask that is used to selectively ignore Colliders when sweeping. @defaultValue `Layer.Everything`
|
|
10982
|
+
* @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
|
|
10983
|
+
* @returns Returns True if the sphere intersects with any collider, otherwise false
|
|
10984
|
+
*/ _proto.sphereCast = function sphereCast(center, radius, direction, distance, layerMask, outHitResult) {
|
|
10985
|
+
if (distance === void 0) distance = Number.MAX_VALUE;
|
|
10986
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
10987
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
10988
|
+
var result = this._nativePhysicsScene.sphereCast(center, radius, direction, distance, preFilter, outHitResult ? this._createHitCallback(outHitResult) : undefined);
|
|
10989
|
+
if (!result && outHitResult) {
|
|
10990
|
+
this._clearHitResult(outHitResult);
|
|
10991
|
+
}
|
|
10992
|
+
return result;
|
|
10993
|
+
};
|
|
10994
|
+
/**
|
|
10995
|
+
* Casts a capsule through the Scene and returns true if there is any hit.
|
|
10996
|
+
* @param center - The center of the capsule
|
|
10997
|
+
* @param radius - The radius of the capsule
|
|
10998
|
+
* @param height - The height of the capsule
|
|
10999
|
+
* @param direction - The direction to sweep along
|
|
11000
|
+
* @param orientation - The rotation of the capsule. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
11001
|
+
* @param distance - The max distance to sweep. @defaultValue `Number.MAX_VALUE`
|
|
11002
|
+
* @param layerMask - Layer mask that is used to selectively ignore Colliders when sweeping. @defaultValue `Layer.Everything`
|
|
11003
|
+
* @param outHitResult - If true is returned, outHitResult will contain more detailed collision information
|
|
11004
|
+
* @returns Returns True if the capsule intersects with any collider, otherwise false
|
|
11005
|
+
*/ _proto.capsuleCast = function capsuleCast(center, radius, height, direction, orientation, distance, layerMask, outHitResult) {
|
|
11006
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
11007
|
+
if (distance === void 0) distance = Number.MAX_VALUE;
|
|
11008
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11009
|
+
var preFilter = this._createPreFilter(layerMask);
|
|
11010
|
+
var result = this._nativePhysicsScene.capsuleCast(center, radius, height, orientation, direction, distance, preFilter, outHitResult ? this._createHitCallback(outHitResult) : undefined);
|
|
11011
|
+
if (!result && outHitResult) {
|
|
11012
|
+
this._clearHitResult(outHitResult);
|
|
11013
|
+
}
|
|
11014
|
+
return result;
|
|
11015
|
+
};
|
|
11016
|
+
/**
|
|
11017
|
+
* Get all colliders that overlap with a box in the scene.
|
|
11018
|
+
* @param center - The center of the box
|
|
11019
|
+
* @param halfExtents - Half the size of the box in each dimension
|
|
11020
|
+
* @param orientation - The rotation of the box. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
11021
|
+
* @param layerMask - Layer mask that is used to selectively filter colliders. @defaultValue `Layer.Everything`
|
|
11022
|
+
* @param shapes - Array to store overlapping collider shapes. @defaultValue `[]`
|
|
11023
|
+
* @returns The collider shapes overlapping with the box
|
|
11024
|
+
*/ _proto.overlapBoxAll = function overlapBoxAll(center, halfExtents, orientation, layerMask, shapes) {
|
|
11025
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
11026
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11027
|
+
if (shapes === void 0) shapes = [];
|
|
11028
|
+
var ids = this._nativePhysicsScene.overlapBoxAll(center, orientation, halfExtents, this._createPreFilter(layerMask));
|
|
11029
|
+
shapes.length = 0;
|
|
11030
|
+
for(var i = 0, n = ids.length; i < n; i++){
|
|
11031
|
+
shapes.push(Engine._physicalObjectsMap[ids[i]]);
|
|
11032
|
+
}
|
|
11033
|
+
return shapes;
|
|
11034
|
+
};
|
|
11035
|
+
/**
|
|
11036
|
+
* Get all colliders that overlap with a sphere in the scene.
|
|
11037
|
+
* @param center - The center of the sphere
|
|
11038
|
+
* @param radius - The radius of the sphere
|
|
11039
|
+
* @param layerMask - Layer mask that is used to selectively filter colliders. @defaultValue `Layer.Everything`
|
|
11040
|
+
* @param shapes - Array to store overlapping collider shapes. @defaultValue `[]`
|
|
11041
|
+
* @returns The collider shapes overlapping with the sphere
|
|
11042
|
+
*/ _proto.overlapSphereAll = function overlapSphereAll(center, radius, layerMask, shapes) {
|
|
11043
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11044
|
+
if (shapes === void 0) shapes = [];
|
|
11045
|
+
var ids = this._nativePhysicsScene.overlapSphereAll(center, radius, this._createPreFilter(layerMask));
|
|
11046
|
+
shapes.length = 0;
|
|
11047
|
+
for(var i = 0; i < ids.length; i++){
|
|
11048
|
+
shapes.push(Engine._physicalObjectsMap[ids[i]]);
|
|
11049
|
+
}
|
|
11050
|
+
return shapes;
|
|
11051
|
+
};
|
|
11052
|
+
/**
|
|
11053
|
+
* Get all colliders that overlap with a capsule in the scene.
|
|
11054
|
+
* @param center - The center of the capsule
|
|
11055
|
+
* @param radius - The radius of the capsule
|
|
11056
|
+
* @param height - The height of the capsule
|
|
11057
|
+
* @param orientation - The rotation of the capsule. @defaultValue `Quaternion(0, 0, 0, 1)`
|
|
11058
|
+
* @param layerMask - Layer mask that is used to selectively filter colliders. @defaultValue `Layer.Everything`
|
|
11059
|
+
* @param shapes - Array to store overlapping collider shapes. @defaultValue `[]`
|
|
11060
|
+
* @returns The collider shapes overlapping with the capsule
|
|
11061
|
+
*/ _proto.overlapCapsuleAll = function overlapCapsuleAll(center, radius, height, orientation, layerMask, shapes) {
|
|
11062
|
+
if (orientation === void 0) orientation = PhysicsScene._identityQuaternion;
|
|
11063
|
+
if (layerMask === void 0) layerMask = Layer.Everything;
|
|
11064
|
+
if (shapes === void 0) shapes = [];
|
|
11065
|
+
var ids = this._nativePhysicsScene.overlapCapsuleAll(center, radius, height, orientation, this._createPreFilter(layerMask));
|
|
11066
|
+
shapes.length = 0;
|
|
11067
|
+
for(var i = 0; i < ids.length; i++){
|
|
11068
|
+
shapes.push(Engine._physicalObjectsMap[ids[i]]);
|
|
11069
|
+
}
|
|
11070
|
+
return shapes;
|
|
10985
11071
|
};
|
|
10986
11072
|
/**
|
|
10987
11073
|
* Call on every frame to update pose of objects.
|
|
@@ -11071,6 +11157,31 @@ __decorate([
|
|
|
11071
11157
|
_proto._setGravity = function _setGravity() {
|
|
11072
11158
|
this._nativePhysicsScene.setGravity(this._gravity);
|
|
11073
11159
|
};
|
|
11160
|
+
_proto._createPreFilter = function _createPreFilter(mask) {
|
|
11161
|
+
return function(obj) {
|
|
11162
|
+
var shape = Engine._physicalObjectsMap[obj];
|
|
11163
|
+
if (!shape) {
|
|
11164
|
+
return false;
|
|
11165
|
+
}
|
|
11166
|
+
return shape.collider.entity.layer & mask && shape.isSceneQuery;
|
|
11167
|
+
};
|
|
11168
|
+
};
|
|
11169
|
+
_proto._createHitCallback = function _createHitCallback(outHitResult) {
|
|
11170
|
+
return function(shapeUniqueID, distance, position, normal) {
|
|
11171
|
+
outHitResult.entity = Engine._physicalObjectsMap[shapeUniqueID].collider.entity;
|
|
11172
|
+
outHitResult.shape = Engine._physicalObjectsMap[shapeUniqueID];
|
|
11173
|
+
outHitResult.distance = distance;
|
|
11174
|
+
outHitResult.point.copyFrom(position);
|
|
11175
|
+
outHitResult.normal.copyFrom(normal);
|
|
11176
|
+
};
|
|
11177
|
+
};
|
|
11178
|
+
_proto._clearHitResult = function _clearHitResult(hitResult) {
|
|
11179
|
+
hitResult.entity = null;
|
|
11180
|
+
hitResult.shape = null;
|
|
11181
|
+
hitResult.distance = 0;
|
|
11182
|
+
hitResult.point.set(0, 0, 0);
|
|
11183
|
+
hitResult.normal.set(0, 0, 0);
|
|
11184
|
+
};
|
|
11074
11185
|
_create_class(PhysicsScene, [
|
|
11075
11186
|
{
|
|
11076
11187
|
key: "gravity",
|
|
@@ -11101,6 +11212,7 @@ __decorate([
|
|
|
11101
11212
|
return PhysicsScene;
|
|
11102
11213
|
}();
|
|
11103
11214
|
PhysicsScene._collision = new Collision();
|
|
11215
|
+
PhysicsScene._identityQuaternion = new Quaternion(0, 0, 0, 1);
|
|
11104
11216
|
|
|
11105
11217
|
/**
|
|
11106
11218
|
* A static collider component that will not move.
|
|
@@ -13161,35 +13273,86 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13161
13273
|
}({});
|
|
13162
13274
|
|
|
13163
13275
|
/**
|
|
13164
|
-
*
|
|
13165
|
-
*/ var
|
|
13166
|
-
|
|
13167
|
-
|
|
13276
|
+
* Refraction mode.
|
|
13277
|
+
*/ var RefractionMode = /*#__PURE__*/ function(RefractionMode) {
|
|
13278
|
+
/** Use the sphere refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Sphere"] = 0] = "Sphere";
|
|
13279
|
+
/** Use the planar refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Planar"] = 1] = "Planar";
|
|
13280
|
+
return RefractionMode;
|
|
13281
|
+
}({});
|
|
13282
|
+
|
|
13283
|
+
/**
|
|
13284
|
+
* PBR (Metallic-Roughness Workflow) Material.
|
|
13285
|
+
*/ var PBRMaterial = /*#__PURE__*/ function(BaseMaterial1) {
|
|
13286
|
+
_inherits(PBRMaterial, BaseMaterial1);
|
|
13287
|
+
function PBRMaterial(engine) {
|
|
13168
13288
|
var _this;
|
|
13169
|
-
_this =
|
|
13289
|
+
_this = BaseMaterial1.call(this, engine, Shader.find("pbr")) || this, _this._anisotropyRotation = 0, _this._iridescenceRange = new Vector2(100, 400), _this._sheenEnabled = false;
|
|
13170
13290
|
var shaderData = _this.shaderData;
|
|
13171
13291
|
shaderData.enableMacro("MATERIAL_NEED_WORLD_POS");
|
|
13172
13292
|
shaderData.enableMacro("MATERIAL_NEED_TILING_OFFSET");
|
|
13173
|
-
shaderData.setColor(
|
|
13174
|
-
shaderData.setColor(
|
|
13175
|
-
shaderData.setVector4(
|
|
13176
|
-
shaderData.setFloat(
|
|
13177
|
-
shaderData.setFloat(
|
|
13178
|
-
shaderData.setFloat(
|
|
13179
|
-
shaderData.setFloat(
|
|
13180
|
-
shaderData.setFloat(
|
|
13293
|
+
shaderData.setColor(PBRMaterial._baseColorProp, new Color(1, 1, 1, 1));
|
|
13294
|
+
shaderData.setColor(PBRMaterial._emissiveColorProp, new Color(0, 0, 0, 1));
|
|
13295
|
+
shaderData.setVector4(PBRMaterial._tilingOffsetProp, new Vector4(1, 1, 0, 0));
|
|
13296
|
+
shaderData.setFloat(PBRMaterial._normalIntensityProp, 1);
|
|
13297
|
+
shaderData.setFloat(PBRMaterial._occlusionTextureIntensityProp, 1);
|
|
13298
|
+
shaderData.setFloat(PBRMaterial._occlusionTextureCoordProp, TextureCoordinate.UV0);
|
|
13299
|
+
shaderData.setFloat(PBRMaterial._clearCoatProp, 0);
|
|
13300
|
+
shaderData.setFloat(PBRMaterial._clearCoatRoughnessProp, 0);
|
|
13301
|
+
shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
13302
|
+
shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
13303
|
+
shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
13304
|
+
shaderData.setVector3(PBRMaterial._anisotropyInfoProp, new Vector3(1, 0, 0));
|
|
13305
|
+
shaderData.setVector4(PBRMaterial._iridescenceInfoProp, new Vector4(0, 1.3, 100, 400));
|
|
13306
|
+
var sheenColor = new Color(0, 0, 0);
|
|
13307
|
+
shaderData.setColor(PBRMaterial._sheenColorProp, sheenColor);
|
|
13308
|
+
_this.refractionMode = RefractionMode.Planar;
|
|
13309
|
+
shaderData.setFloat(PBRMaterial._transmissionProp, 0);
|
|
13310
|
+
shaderData.setFloat(PBRMaterial._thicknessProp, 0);
|
|
13311
|
+
shaderData.setFloat(PBRMaterial._attenuationDistanceProp, Infinity);
|
|
13312
|
+
shaderData.setColor(PBRMaterial._attenuationColorProp, new Color(1, 1, 1));
|
|
13313
|
+
shaderData.setFloat(PBRMaterial._specularIntensityProp, 1);
|
|
13314
|
+
shaderData.setColor(PBRMaterial._specularColorProp, new Color(1, 1, 1));
|
|
13315
|
+
// @ts-ignore
|
|
13316
|
+
_this._iridescenceRange._onValueChanged = _this._onIridescenceRangeChanged.bind(_this);
|
|
13317
|
+
// @ts-ignore
|
|
13318
|
+
sheenColor._onValueChanged = _this._onSheenColorChanged.bind(_this);
|
|
13181
13319
|
return _this;
|
|
13182
13320
|
}
|
|
13183
|
-
|
|
13321
|
+
var _proto = PBRMaterial.prototype;
|
|
13322
|
+
/**
|
|
13323
|
+
* @inheritdoc
|
|
13324
|
+
*/ _proto.clone = function clone() {
|
|
13325
|
+
var dest = new PBRMaterial(this._engine);
|
|
13326
|
+
this._cloneToAndModifyName(dest);
|
|
13327
|
+
return dest;
|
|
13328
|
+
};
|
|
13329
|
+
_proto._onIridescenceRangeChanged = function _onIridescenceRangeChanged() {
|
|
13330
|
+
var iridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceInfoProp);
|
|
13331
|
+
iridescenceInfo.z = this._iridescenceRange.x;
|
|
13332
|
+
iridescenceInfo.w = this._iridescenceRange.y;
|
|
13333
|
+
};
|
|
13334
|
+
_proto._onSheenColorChanged = function _onSheenColorChanged() {
|
|
13335
|
+
var sheenColor = this.sheenColor;
|
|
13336
|
+
var enableSheen = sheenColor.r + sheenColor.g + sheenColor.b > 0;
|
|
13337
|
+
if (enableSheen !== this._sheenEnabled) {
|
|
13338
|
+
this._sheenEnabled = enableSheen;
|
|
13339
|
+
if (enableSheen) {
|
|
13340
|
+
this.shaderData.enableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13341
|
+
} else {
|
|
13342
|
+
this.shaderData.disableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13343
|
+
}
|
|
13344
|
+
}
|
|
13345
|
+
};
|
|
13346
|
+
_create_class(PBRMaterial, [
|
|
13184
13347
|
{
|
|
13185
13348
|
key: "baseColor",
|
|
13186
13349
|
get: /**
|
|
13187
13350
|
* Base color.
|
|
13188
13351
|
*/ function get() {
|
|
13189
|
-
return this.shaderData.getColor(
|
|
13352
|
+
return this.shaderData.getColor(PBRMaterial._baseColorProp);
|
|
13190
13353
|
},
|
|
13191
13354
|
set: function set(value) {
|
|
13192
|
-
var baseColor = this.shaderData.getColor(
|
|
13355
|
+
var baseColor = this.shaderData.getColor(PBRMaterial._baseColorProp);
|
|
13193
13356
|
if (value !== baseColor) {
|
|
13194
13357
|
baseColor.copyFrom(value);
|
|
13195
13358
|
}
|
|
@@ -13200,14 +13363,14 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13200
13363
|
get: /**
|
|
13201
13364
|
* Base texture.
|
|
13202
13365
|
*/ function get() {
|
|
13203
|
-
return this.shaderData.getTexture(
|
|
13366
|
+
return this.shaderData.getTexture(PBRMaterial._baseTextureProp);
|
|
13204
13367
|
},
|
|
13205
13368
|
set: function set(value) {
|
|
13206
|
-
this.shaderData.setTexture(
|
|
13369
|
+
this.shaderData.setTexture(PBRMaterial._baseTextureProp, value);
|
|
13207
13370
|
if (value) {
|
|
13208
|
-
this.shaderData.enableMacro(
|
|
13371
|
+
this.shaderData.enableMacro(PBRMaterial._baseTextureMacro);
|
|
13209
13372
|
} else {
|
|
13210
|
-
this.shaderData.disableMacro(
|
|
13373
|
+
this.shaderData.disableMacro(PBRMaterial._baseTextureMacro);
|
|
13211
13374
|
}
|
|
13212
13375
|
}
|
|
13213
13376
|
},
|
|
@@ -13216,14 +13379,14 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13216
13379
|
get: /**
|
|
13217
13380
|
* Normal texture.
|
|
13218
13381
|
*/ function get() {
|
|
13219
|
-
return this.shaderData.getTexture(
|
|
13382
|
+
return this.shaderData.getTexture(PBRMaterial._normalTextureProp);
|
|
13220
13383
|
},
|
|
13221
13384
|
set: function set(value) {
|
|
13222
|
-
this.shaderData.setTexture(
|
|
13385
|
+
this.shaderData.setTexture(PBRMaterial._normalTextureProp, value);
|
|
13223
13386
|
if (value) {
|
|
13224
|
-
this.shaderData.enableMacro(
|
|
13387
|
+
this.shaderData.enableMacro(PBRMaterial._normalTextureMacro);
|
|
13225
13388
|
} else {
|
|
13226
|
-
this.shaderData.disableMacro(
|
|
13389
|
+
this.shaderData.disableMacro(PBRMaterial._normalTextureMacro);
|
|
13227
13390
|
}
|
|
13228
13391
|
}
|
|
13229
13392
|
},
|
|
@@ -13232,10 +13395,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13232
13395
|
get: /**
|
|
13233
13396
|
* Normal texture intensity.
|
|
13234
13397
|
*/ function get() {
|
|
13235
|
-
return this.shaderData.getFloat(
|
|
13398
|
+
return this.shaderData.getFloat(PBRMaterial._normalIntensityProp);
|
|
13236
13399
|
},
|
|
13237
13400
|
set: function set(value) {
|
|
13238
|
-
this.shaderData.setFloat(
|
|
13401
|
+
this.shaderData.setFloat(PBRMaterial._normalIntensityProp, value);
|
|
13239
13402
|
}
|
|
13240
13403
|
},
|
|
13241
13404
|
{
|
|
@@ -13243,10 +13406,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13243
13406
|
get: /**
|
|
13244
13407
|
* Emissive color.
|
|
13245
13408
|
*/ function get() {
|
|
13246
|
-
return this.shaderData.getColor(
|
|
13409
|
+
return this.shaderData.getColor(PBRMaterial._emissiveColorProp);
|
|
13247
13410
|
},
|
|
13248
13411
|
set: function set(value) {
|
|
13249
|
-
var emissiveColor = this.shaderData.getColor(
|
|
13412
|
+
var emissiveColor = this.shaderData.getColor(PBRMaterial._emissiveColorProp);
|
|
13250
13413
|
if (value !== emissiveColor) {
|
|
13251
13414
|
emissiveColor.copyFrom(value);
|
|
13252
13415
|
}
|
|
@@ -13257,14 +13420,14 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13257
13420
|
get: /**
|
|
13258
13421
|
* Emissive texture.
|
|
13259
13422
|
*/ function get() {
|
|
13260
|
-
return this.shaderData.getTexture(
|
|
13423
|
+
return this.shaderData.getTexture(PBRMaterial._emissiveTextureProp);
|
|
13261
13424
|
},
|
|
13262
13425
|
set: function set(value) {
|
|
13263
|
-
this.shaderData.setTexture(
|
|
13426
|
+
this.shaderData.setTexture(PBRMaterial._emissiveTextureProp, value);
|
|
13264
13427
|
if (value) {
|
|
13265
|
-
this.shaderData.enableMacro(
|
|
13428
|
+
this.shaderData.enableMacro(PBRMaterial._emissiveTextureMacro);
|
|
13266
13429
|
} else {
|
|
13267
|
-
this.shaderData.disableMacro(
|
|
13430
|
+
this.shaderData.disableMacro(PBRMaterial._emissiveTextureMacro);
|
|
13268
13431
|
}
|
|
13269
13432
|
}
|
|
13270
13433
|
},
|
|
@@ -13273,10 +13436,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13273
13436
|
get: /**
|
|
13274
13437
|
* Occlusion texture.
|
|
13275
13438
|
*/ function get() {
|
|
13276
|
-
return this.shaderData.getTexture(
|
|
13439
|
+
return this.shaderData.getTexture(PBRMaterial._occlusionTextureProp);
|
|
13277
13440
|
},
|
|
13278
13441
|
set: function set(value) {
|
|
13279
|
-
this.shaderData.setTexture(
|
|
13442
|
+
this.shaderData.setTexture(PBRMaterial._occlusionTextureProp, value);
|
|
13280
13443
|
if (value) {
|
|
13281
13444
|
this.shaderData.enableMacro("MATERIAL_HAS_OCCLUSION_TEXTURE");
|
|
13282
13445
|
} else {
|
|
@@ -13289,10 +13452,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13289
13452
|
get: /**
|
|
13290
13453
|
* Occlusion texture intensity.
|
|
13291
13454
|
*/ function get() {
|
|
13292
|
-
return this.shaderData.getFloat(
|
|
13455
|
+
return this.shaderData.getFloat(PBRMaterial._occlusionTextureIntensityProp);
|
|
13293
13456
|
},
|
|
13294
13457
|
set: function set(value) {
|
|
13295
|
-
this.shaderData.setFloat(
|
|
13458
|
+
this.shaderData.setFloat(PBRMaterial._occlusionTextureIntensityProp, value);
|
|
13296
13459
|
}
|
|
13297
13460
|
},
|
|
13298
13461
|
{
|
|
@@ -13301,13 +13464,13 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13301
13464
|
* Occlusion texture uv coordinate.
|
|
13302
13465
|
* @remarks Must be UV0 or UV1.
|
|
13303
13466
|
*/ function get() {
|
|
13304
|
-
return this.shaderData.getFloat(
|
|
13467
|
+
return this.shaderData.getFloat(PBRMaterial._occlusionTextureCoordProp);
|
|
13305
13468
|
},
|
|
13306
13469
|
set: function set(value) {
|
|
13307
13470
|
if (value > TextureCoordinate.UV1) {
|
|
13308
13471
|
Logger.warn("Occlusion texture uv coordinate must be UV0 or UV1.");
|
|
13309
13472
|
}
|
|
13310
|
-
this.shaderData.setFloat(
|
|
13473
|
+
this.shaderData.setFloat(PBRMaterial._occlusionTextureCoordProp, value);
|
|
13311
13474
|
}
|
|
13312
13475
|
},
|
|
13313
13476
|
{
|
|
@@ -13315,10 +13478,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13315
13478
|
get: /**
|
|
13316
13479
|
* Tiling and offset of main textures.
|
|
13317
13480
|
*/ function get() {
|
|
13318
|
-
return this.shaderData.getVector4(
|
|
13481
|
+
return this.shaderData.getVector4(PBRMaterial._tilingOffsetProp);
|
|
13319
13482
|
},
|
|
13320
13483
|
set: function set(value) {
|
|
13321
|
-
var tilingOffset = this.shaderData.getVector4(
|
|
13484
|
+
var tilingOffset = this.shaderData.getVector4(PBRMaterial._tilingOffsetProp);
|
|
13322
13485
|
if (value !== tilingOffset) {
|
|
13323
13486
|
tilingOffset.copyFrom(value);
|
|
13324
13487
|
}
|
|
@@ -13329,17 +13492,17 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13329
13492
|
get: /**
|
|
13330
13493
|
* The clearCoat layer intensity, default 0.
|
|
13331
13494
|
*/ function get() {
|
|
13332
|
-
return this.shaderData.getFloat(
|
|
13495
|
+
return this.shaderData.getFloat(PBRMaterial._clearCoatProp);
|
|
13333
13496
|
},
|
|
13334
13497
|
set: function set(value) {
|
|
13335
|
-
if (!!this.shaderData.getFloat(
|
|
13498
|
+
if (!!this.shaderData.getFloat(PBRMaterial._clearCoatProp) !== !!value) {
|
|
13336
13499
|
if (value === 0) {
|
|
13337
13500
|
this.shaderData.disableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
13338
13501
|
} else {
|
|
13339
13502
|
this.shaderData.enableMacro("MATERIAL_ENABLE_CLEAR_COAT");
|
|
13340
13503
|
}
|
|
13341
13504
|
}
|
|
13342
|
-
this.shaderData.setFloat(
|
|
13505
|
+
this.shaderData.setFloat(PBRMaterial._clearCoatProp, value);
|
|
13343
13506
|
}
|
|
13344
13507
|
},
|
|
13345
13508
|
{
|
|
@@ -13347,10 +13510,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13347
13510
|
get: /**
|
|
13348
13511
|
* The clearCoat layer intensity texture.
|
|
13349
13512
|
*/ function get() {
|
|
13350
|
-
return this.shaderData.getTexture(
|
|
13513
|
+
return this.shaderData.getTexture(PBRMaterial._clearCoatTextureProp);
|
|
13351
13514
|
},
|
|
13352
13515
|
set: function set(value) {
|
|
13353
|
-
this.shaderData.setTexture(
|
|
13516
|
+
this.shaderData.setTexture(PBRMaterial._clearCoatTextureProp, value);
|
|
13354
13517
|
if (value) {
|
|
13355
13518
|
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_TEXTURE");
|
|
13356
13519
|
} else {
|
|
@@ -13363,10 +13526,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13363
13526
|
get: /**
|
|
13364
13527
|
* The clearCoat layer roughness, default 0.
|
|
13365
13528
|
*/ function get() {
|
|
13366
|
-
return this.shaderData.getFloat(
|
|
13529
|
+
return this.shaderData.getFloat(PBRMaterial._clearCoatRoughnessProp);
|
|
13367
13530
|
},
|
|
13368
13531
|
set: function set(value) {
|
|
13369
|
-
this.shaderData.setFloat(
|
|
13532
|
+
this.shaderData.setFloat(PBRMaterial._clearCoatRoughnessProp, value);
|
|
13370
13533
|
}
|
|
13371
13534
|
},
|
|
13372
13535
|
{
|
|
@@ -13374,10 +13537,10 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13374
13537
|
get: /**
|
|
13375
13538
|
* The clearCoat layer roughness texture.
|
|
13376
13539
|
*/ function get() {
|
|
13377
|
-
return this.shaderData.getTexture(
|
|
13540
|
+
return this.shaderData.getTexture(PBRMaterial._clearCoatRoughnessTextureProp);
|
|
13378
13541
|
},
|
|
13379
13542
|
set: function set(value) {
|
|
13380
|
-
this.shaderData.setTexture(
|
|
13543
|
+
this.shaderData.setTexture(PBRMaterial._clearCoatRoughnessTextureProp, value);
|
|
13381
13544
|
if (value) {
|
|
13382
13545
|
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_ROUGHNESS_TEXTURE");
|
|
13383
13546
|
} else {
|
|
@@ -13390,90 +13553,17 @@ BlinnPhongMaterial._specularTextureProp = ShaderProperty.getByName("material_Spe
|
|
|
13390
13553
|
get: /**
|
|
13391
13554
|
* The clearCoat normal map texture.
|
|
13392
13555
|
*/ function get() {
|
|
13393
|
-
return this.shaderData.getTexture(
|
|
13556
|
+
return this.shaderData.getTexture(PBRMaterial._clearCoatNormalTextureProp);
|
|
13394
13557
|
},
|
|
13395
13558
|
set: function set(value) {
|
|
13396
|
-
this.shaderData.setTexture(
|
|
13559
|
+
this.shaderData.setTexture(PBRMaterial._clearCoatNormalTextureProp, value);
|
|
13397
13560
|
if (value) {
|
|
13398
13561
|
this.shaderData.enableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
13399
13562
|
} else {
|
|
13400
13563
|
this.shaderData.disableMacro("MATERIAL_HAS_CLEAR_COAT_NORMAL_TEXTURE");
|
|
13401
13564
|
}
|
|
13402
13565
|
}
|
|
13403
|
-
}
|
|
13404
|
-
]);
|
|
13405
|
-
return PBRBaseMaterial;
|
|
13406
|
-
}(BaseMaterial);
|
|
13407
|
-
PBRBaseMaterial._occlusionTextureIntensityProp = ShaderProperty.getByName("material_OcclusionIntensity");
|
|
13408
|
-
PBRBaseMaterial._occlusionTextureCoordProp = ShaderProperty.getByName("material_OcclusionTextureCoord");
|
|
13409
|
-
PBRBaseMaterial._occlusionTextureProp = ShaderProperty.getByName("material_OcclusionTexture");
|
|
13410
|
-
PBRBaseMaterial._clearCoatProp = ShaderProperty.getByName("material_ClearCoat");
|
|
13411
|
-
PBRBaseMaterial._clearCoatTextureProp = ShaderProperty.getByName("material_ClearCoatTexture");
|
|
13412
|
-
PBRBaseMaterial._clearCoatRoughnessProp = ShaderProperty.getByName("material_ClearCoatRoughness");
|
|
13413
|
-
PBRBaseMaterial._clearCoatRoughnessTextureProp = ShaderProperty.getByName("material_ClearCoatRoughnessTexture");
|
|
13414
|
-
PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material_ClearCoatNormalTexture");
|
|
13415
|
-
|
|
13416
|
-
/**
|
|
13417
|
-
* Refraction mode.
|
|
13418
|
-
*/ var RefractionMode = /*#__PURE__*/ function(RefractionMode) {
|
|
13419
|
-
/** Use the sphere refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Sphere"] = 0] = "Sphere";
|
|
13420
|
-
/** Use the planar refraction model when light passes through the surface. */ RefractionMode[RefractionMode["Planar"] = 1] = "Planar";
|
|
13421
|
-
return RefractionMode;
|
|
13422
|
-
}({});
|
|
13423
|
-
|
|
13424
|
-
/**
|
|
13425
|
-
* PBR (Metallic-Roughness Workflow) Material.
|
|
13426
|
-
*/ var PBRMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
13427
|
-
_inherits(PBRMaterial, PBRBaseMaterial);
|
|
13428
|
-
function PBRMaterial(engine) {
|
|
13429
|
-
var _this;
|
|
13430
|
-
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr")) || this, _this._anisotropyRotation = 0, _this._iridescenceRange = new Vector2(100, 400), _this._sheenEnabled = false;
|
|
13431
|
-
var shaderData = _this.shaderData;
|
|
13432
|
-
shaderData.setFloat(PBRMaterial._metallicProp, 1);
|
|
13433
|
-
shaderData.setFloat(PBRMaterial._roughnessProp, 1);
|
|
13434
|
-
shaderData.setFloat(PBRMaterial._iorProp, 1.5);
|
|
13435
|
-
shaderData.setVector3(PBRMaterial._anisotropyInfoProp, new Vector3(1, 0, 0));
|
|
13436
|
-
shaderData.setVector4(PBRMaterial._iridescenceInfoProp, new Vector4(0, 1.3, 100, 400));
|
|
13437
|
-
var sheenColor = new Color(0, 0, 0);
|
|
13438
|
-
shaderData.setColor(PBRMaterial._sheenColorProp, sheenColor);
|
|
13439
|
-
_this.refractionMode = RefractionMode.Planar;
|
|
13440
|
-
shaderData.setFloat(PBRMaterial._transmissionProp, 0);
|
|
13441
|
-
shaderData.setFloat(PBRMaterial._thicknessProp, 0);
|
|
13442
|
-
shaderData.setFloat(PBRMaterial._attenuationDistanceProp, Infinity);
|
|
13443
|
-
var attenuationColor = new Color(1, 1, 1);
|
|
13444
|
-
shaderData.setColor(PBRMaterial._attenuationColorProp, attenuationColor);
|
|
13445
|
-
// @ts-ignore
|
|
13446
|
-
_this._iridescenceRange._onValueChanged = _this._onIridescenceRangeChanged.bind(_this);
|
|
13447
|
-
// @ts-ignore
|
|
13448
|
-
sheenColor._onValueChanged = _this._onSheenColorChanged.bind(_this);
|
|
13449
|
-
return _this;
|
|
13450
|
-
}
|
|
13451
|
-
var _proto = PBRMaterial.prototype;
|
|
13452
|
-
/**
|
|
13453
|
-
* @inheritdoc
|
|
13454
|
-
*/ _proto.clone = function clone() {
|
|
13455
|
-
var dest = new PBRMaterial(this._engine);
|
|
13456
|
-
this._cloneToAndModifyName(dest);
|
|
13457
|
-
return dest;
|
|
13458
|
-
};
|
|
13459
|
-
_proto._onIridescenceRangeChanged = function _onIridescenceRangeChanged() {
|
|
13460
|
-
var iridescenceInfo = this.shaderData.getVector4(PBRMaterial._iridescenceInfoProp);
|
|
13461
|
-
iridescenceInfo.z = this._iridescenceRange.x;
|
|
13462
|
-
iridescenceInfo.w = this._iridescenceRange.y;
|
|
13463
|
-
};
|
|
13464
|
-
_proto._onSheenColorChanged = function _onSheenColorChanged() {
|
|
13465
|
-
var sheenColor = this.sheenColor;
|
|
13466
|
-
var enableSheen = sheenColor.r + sheenColor.g + sheenColor.b > 0;
|
|
13467
|
-
if (enableSheen !== this._sheenEnabled) {
|
|
13468
|
-
this._sheenEnabled = enableSheen;
|
|
13469
|
-
if (enableSheen) {
|
|
13470
|
-
this.shaderData.enableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13471
|
-
} else {
|
|
13472
|
-
this.shaderData.disableMacro("MATERIAL_ENABLE_SHEEN");
|
|
13473
|
-
}
|
|
13474
|
-
}
|
|
13475
|
-
};
|
|
13476
|
-
_create_class(PBRMaterial, [
|
|
13566
|
+
},
|
|
13477
13567
|
{
|
|
13478
13568
|
key: "ior",
|
|
13479
13569
|
get: /**
|
|
@@ -13483,7 +13573,7 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material
|
|
|
13483
13573
|
return this.shaderData.getFloat(PBRMaterial._iorProp);
|
|
13484
13574
|
},
|
|
13485
13575
|
set: function set(v) {
|
|
13486
|
-
this.shaderData.setFloat(PBRMaterial._iorProp, Math.max(v, 0));
|
|
13576
|
+
this.shaderData.setFloat(PBRMaterial._iorProp, Math.min(Math.max(v, 0), 5));
|
|
13487
13577
|
}
|
|
13488
13578
|
},
|
|
13489
13579
|
{
|
|
@@ -13875,103 +13965,106 @@ PBRBaseMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material
|
|
|
13875
13965
|
this.shaderData.disableMacro(PBRMaterial._thicknessTextureMacro);
|
|
13876
13966
|
}
|
|
13877
13967
|
}
|
|
13878
|
-
}
|
|
13879
|
-
|
|
13880
|
-
|
|
13881
|
-
|
|
13882
|
-
|
|
13883
|
-
|
|
13884
|
-
|
|
13885
|
-
|
|
13886
|
-
|
|
13887
|
-
|
|
13888
|
-
PBRMaterial.
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
PBRMaterial._sheenColorProp = ShaderProperty.getByName("material_SheenColor");
|
|
13892
|
-
PBRMaterial._sheenRoughnessProp = ShaderProperty.getByName("material_SheenRoughness");
|
|
13893
|
-
PBRMaterial._sheenTextureProp = ShaderProperty.getByName("material_SheenTexture");
|
|
13894
|
-
PBRMaterial._sheenRoughnessTextureProp = ShaderProperty.getByName("material_SheenRoughnessTexture");
|
|
13895
|
-
PBRMaterial._transmissionMacro = ShaderMacro.getByName("MATERIAL_ENABLE_TRANSMISSION");
|
|
13896
|
-
PBRMaterial._thicknessMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS");
|
|
13897
|
-
PBRMaterial._thicknessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS_TEXTURE");
|
|
13898
|
-
PBRMaterial._transmissionTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_TRANSMISSION_TEXTURE");
|
|
13899
|
-
PBRMaterial._transmissionProp = ShaderProperty.getByName("material_Transmission");
|
|
13900
|
-
PBRMaterial._transmissionTextureProp = ShaderProperty.getByName("material_TransmissionTexture");
|
|
13901
|
-
PBRMaterial._attenuationColorProp = ShaderProperty.getByName("material_AttenuationColor");
|
|
13902
|
-
PBRMaterial._attenuationDistanceProp = ShaderProperty.getByName("material_AttenuationDistance");
|
|
13903
|
-
PBRMaterial._thicknessProp = ShaderProperty.getByName("material_Thickness");
|
|
13904
|
-
PBRMaterial._thicknessTextureProp = ShaderProperty.getByName("material_ThicknessTexture");
|
|
13905
|
-
|
|
13906
|
-
/**
|
|
13907
|
-
* PBR (Specular-Glossiness Workflow) Material.
|
|
13908
|
-
*/ var PBRSpecularMaterial = /*#__PURE__*/ function(PBRBaseMaterial) {
|
|
13909
|
-
_inherits(PBRSpecularMaterial, PBRBaseMaterial);
|
|
13910
|
-
function PBRSpecularMaterial(engine) {
|
|
13911
|
-
var _this;
|
|
13912
|
-
_this = PBRBaseMaterial.call(this, engine, Shader.find("pbr-specular")) || this;
|
|
13913
|
-
_this.shaderData.setColor(PBRSpecularMaterial._specularColorProp, new Color(1, 1, 1, 1));
|
|
13914
|
-
_this.shaderData.setFloat(PBRSpecularMaterial._glossinessProp, 1.0);
|
|
13915
|
-
return _this;
|
|
13916
|
-
}
|
|
13917
|
-
var _proto = PBRSpecularMaterial.prototype;
|
|
13918
|
-
/**
|
|
13919
|
-
* @inheritdoc
|
|
13920
|
-
*/ _proto.clone = function clone() {
|
|
13921
|
-
var dest = new PBRSpecularMaterial(this._engine);
|
|
13922
|
-
this._cloneToAndModifyName(dest);
|
|
13923
|
-
return dest;
|
|
13924
|
-
};
|
|
13925
|
-
_create_class(PBRSpecularMaterial, [
|
|
13968
|
+
},
|
|
13969
|
+
{
|
|
13970
|
+
key: "specularIntensity",
|
|
13971
|
+
get: /**
|
|
13972
|
+
* The intensity of the specular reflection.
|
|
13973
|
+
* @defaultValue `1.0`
|
|
13974
|
+
*/ function get() {
|
|
13975
|
+
return this.shaderData.getFloat(PBRMaterial._specularIntensityProp);
|
|
13976
|
+
},
|
|
13977
|
+
set: function set(value) {
|
|
13978
|
+
this.shaderData.setFloat(PBRMaterial._specularIntensityProp, Math.min(Math.max(value, 0), 2));
|
|
13979
|
+
}
|
|
13980
|
+
},
|
|
13926
13981
|
{
|
|
13927
13982
|
key: "specularColor",
|
|
13928
13983
|
get: /**
|
|
13929
|
-
*
|
|
13984
|
+
* The F0 color of the specular reflection.
|
|
13985
|
+
* @defaultValue `[1,1,1]`
|
|
13930
13986
|
*/ function get() {
|
|
13931
|
-
return this.shaderData.getColor(
|
|
13987
|
+
return this.shaderData.getColor(PBRMaterial._specularColorProp);
|
|
13932
13988
|
},
|
|
13933
13989
|
set: function set(value) {
|
|
13934
|
-
var specularColor = this.shaderData.getColor(
|
|
13990
|
+
var specularColor = this.shaderData.getColor(PBRMaterial._specularColorProp);
|
|
13935
13991
|
if (value !== specularColor) {
|
|
13936
13992
|
specularColor.copyFrom(value);
|
|
13937
13993
|
}
|
|
13938
13994
|
}
|
|
13939
13995
|
},
|
|
13940
13996
|
{
|
|
13941
|
-
key: "
|
|
13997
|
+
key: "specularIntensityTexture",
|
|
13942
13998
|
get: /**
|
|
13943
|
-
*
|
|
13999
|
+
* The intensity of the specular reflection, stored in alpha(A) channel. This will be multiplied by `specularIntensity`.
|
|
13944
14000
|
*/ function get() {
|
|
13945
|
-
return this.shaderData.
|
|
14001
|
+
return this.shaderData.getTexture(PBRMaterial._specularIntensityTextureProp);
|
|
13946
14002
|
},
|
|
13947
14003
|
set: function set(value) {
|
|
13948
|
-
this.shaderData.
|
|
14004
|
+
this.shaderData.setTexture(PBRMaterial._specularIntensityTextureProp, value);
|
|
14005
|
+
if (value) {
|
|
14006
|
+
this.shaderData.enableMacro(PBRMaterial._specularTextureMacro);
|
|
14007
|
+
} else {
|
|
14008
|
+
this.shaderData.disableMacro(PBRMaterial._specularTextureMacro);
|
|
14009
|
+
}
|
|
13949
14010
|
}
|
|
13950
14011
|
},
|
|
13951
14012
|
{
|
|
13952
|
-
key: "
|
|
14013
|
+
key: "specularColorTexture",
|
|
13953
14014
|
get: /**
|
|
13954
|
-
*
|
|
13955
|
-
* @remarks RGB is specular, A is glossiness
|
|
14015
|
+
* The F0 color of the specular reflection, stored in the RGB channels. This will be multiplied by `specularColor`.
|
|
13956
14016
|
*/ function get() {
|
|
13957
|
-
return this.shaderData.getTexture(
|
|
14017
|
+
return this.shaderData.getTexture(PBRMaterial._specularColorTextureProp);
|
|
13958
14018
|
},
|
|
13959
14019
|
set: function set(value) {
|
|
13960
|
-
this.shaderData.setTexture(
|
|
14020
|
+
this.shaderData.setTexture(PBRMaterial._specularColorTextureProp, value);
|
|
13961
14021
|
if (value) {
|
|
13962
|
-
this.shaderData.enableMacro(
|
|
14022
|
+
this.shaderData.enableMacro(PBRMaterial._specularColorTextureMacro);
|
|
13963
14023
|
} else {
|
|
13964
|
-
this.shaderData.disableMacro(
|
|
14024
|
+
this.shaderData.disableMacro(PBRMaterial._specularColorTextureMacro);
|
|
13965
14025
|
}
|
|
13966
14026
|
}
|
|
13967
14027
|
}
|
|
13968
14028
|
]);
|
|
13969
|
-
return
|
|
13970
|
-
}(
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
14029
|
+
return PBRMaterial;
|
|
14030
|
+
}(BaseMaterial);
|
|
14031
|
+
PBRMaterial._occlusionTextureIntensityProp = ShaderProperty.getByName("material_OcclusionIntensity");
|
|
14032
|
+
PBRMaterial._occlusionTextureCoordProp = ShaderProperty.getByName("material_OcclusionTextureCoord");
|
|
14033
|
+
PBRMaterial._occlusionTextureProp = ShaderProperty.getByName("material_OcclusionTexture");
|
|
14034
|
+
PBRMaterial._clearCoatProp = ShaderProperty.getByName("material_ClearCoat");
|
|
14035
|
+
PBRMaterial._clearCoatTextureProp = ShaderProperty.getByName("material_ClearCoatTexture");
|
|
14036
|
+
PBRMaterial._clearCoatRoughnessProp = ShaderProperty.getByName("material_ClearCoatRoughness");
|
|
14037
|
+
PBRMaterial._clearCoatRoughnessTextureProp = ShaderProperty.getByName("material_ClearCoatRoughnessTexture");
|
|
14038
|
+
PBRMaterial._clearCoatNormalTextureProp = ShaderProperty.getByName("material_ClearCoatNormalTexture");
|
|
14039
|
+
PBRMaterial._metallicProp = ShaderProperty.getByName("material_Metal");
|
|
14040
|
+
PBRMaterial._roughnessProp = ShaderProperty.getByName("material_Roughness");
|
|
14041
|
+
PBRMaterial._roughnessMetallicTextureProp = ShaderProperty.getByName("material_RoughnessMetallicTexture");
|
|
14042
|
+
PBRMaterial._iorProp = ShaderProperty.getByName("material_IOR");
|
|
14043
|
+
PBRMaterial._anisotropyInfoProp = ShaderProperty.getByName("material_AnisotropyInfo");
|
|
14044
|
+
PBRMaterial._anisotropyTextureProp = ShaderProperty.getByName("material_AnisotropyTexture");
|
|
14045
|
+
PBRMaterial._iridescenceInfoProp = ShaderProperty.getByName("material_IridescenceInfo");
|
|
14046
|
+
PBRMaterial._iridescenceThicknessTextureProp = ShaderProperty.getByName("material_IridescenceThicknessTexture");
|
|
14047
|
+
PBRMaterial._iridescenceTextureProp = ShaderProperty.getByName("material_IridescenceTexture");
|
|
14048
|
+
PBRMaterial._sheenColorProp = ShaderProperty.getByName("material_SheenColor");
|
|
14049
|
+
PBRMaterial._sheenRoughnessProp = ShaderProperty.getByName("material_SheenRoughness");
|
|
14050
|
+
PBRMaterial._sheenTextureProp = ShaderProperty.getByName("material_SheenTexture");
|
|
14051
|
+
PBRMaterial._sheenRoughnessTextureProp = ShaderProperty.getByName("material_SheenRoughnessTexture");
|
|
14052
|
+
PBRMaterial._transmissionMacro = ShaderMacro.getByName("MATERIAL_ENABLE_TRANSMISSION");
|
|
14053
|
+
PBRMaterial._thicknessMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS");
|
|
14054
|
+
PBRMaterial._thicknessTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_THICKNESS_TEXTURE");
|
|
14055
|
+
PBRMaterial._transmissionTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_TRANSMISSION_TEXTURE");
|
|
14056
|
+
PBRMaterial._transmissionProp = ShaderProperty.getByName("material_Transmission");
|
|
14057
|
+
PBRMaterial._transmissionTextureProp = ShaderProperty.getByName("material_TransmissionTexture");
|
|
14058
|
+
PBRMaterial._attenuationColorProp = ShaderProperty.getByName("material_AttenuationColor");
|
|
14059
|
+
PBRMaterial._attenuationDistanceProp = ShaderProperty.getByName("material_AttenuationDistance");
|
|
14060
|
+
PBRMaterial._thicknessProp = ShaderProperty.getByName("material_Thickness");
|
|
14061
|
+
PBRMaterial._thicknessTextureProp = ShaderProperty.getByName("material_ThicknessTexture");
|
|
14062
|
+
PBRMaterial._specularTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_TEXTURE");
|
|
14063
|
+
PBRMaterial._specularColorTextureMacro = ShaderMacro.getByName("MATERIAL_HAS_SPECULAR_COLOR_TEXTURE");
|
|
14064
|
+
PBRMaterial._specularIntensityProp = ShaderProperty.getByName("material_SpecularIntensity");
|
|
14065
|
+
PBRMaterial._specularColorProp = ShaderProperty.getByName("material_SpecularColor");
|
|
14066
|
+
PBRMaterial._specularIntensityTextureProp = ShaderProperty.getByName("material_SpecularIntensityTexture");
|
|
14067
|
+
PBRMaterial._specularColorTextureProp = ShaderProperty.getByName("material_SpecularColorTexture");
|
|
13975
14068
|
|
|
13976
14069
|
/**
|
|
13977
14070
|
* Unlit Material.
|
|
@@ -25773,7 +25866,7 @@ ShaderPool.init();
|
|
|
25773
25866
|
_inherits(Engine, EventDispatcher);
|
|
25774
25867
|
function Engine(canvas, hardwareRenderer, configuration) {
|
|
25775
25868
|
var _this;
|
|
25776
|
-
_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.
|
|
25869
|
+
_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() {
|
|
25777
25870
|
if (_this._vSyncCount) {
|
|
25778
25871
|
var _this_xrManager;
|
|
25779
25872
|
var raf = ((_this_xrManager = _this.xrManager) == null ? void 0 : _this_xrManager._getRequestAnimationFrame()) || requestAnimationFrame;
|
|
@@ -25908,7 +26001,7 @@ ShaderPool.init();
|
|
|
25908
26001
|
scene4._componentsManager.callScriptOnLateUpdate(deltaTime);
|
|
25909
26002
|
}
|
|
25910
26003
|
// Render scene and fire `onBeginRender` and `onEndRender`
|
|
25911
|
-
if (!this.
|
|
26004
|
+
if (!this._hardwareRenderer.isContextLost()) {
|
|
25912
26005
|
this._render(scenes);
|
|
25913
26006
|
}
|
|
25914
26007
|
if (this._waitingDestroy) {
|
|
@@ -26131,7 +26224,6 @@ ShaderPool.init();
|
|
|
26131
26224
|
});
|
|
26132
26225
|
};
|
|
26133
26226
|
_proto._onDeviceLost = function _onDeviceLost() {
|
|
26134
|
-
this._isDeviceLost = true;
|
|
26135
26227
|
// Lose graphic resources
|
|
26136
26228
|
this.resourceManager._lostGraphicResources();
|
|
26137
26229
|
console.log("Device lost.");
|
|
@@ -26152,7 +26244,6 @@ ShaderPool.init();
|
|
|
26152
26244
|
resourceManager._restoreResourcesContent().then(function() {
|
|
26153
26245
|
console.log("Graphic resource content restored.\n\n" + "Device restored.");
|
|
26154
26246
|
_this.dispatch("devicerestored", _this);
|
|
26155
|
-
_this._isDeviceLost = false;
|
|
26156
26247
|
}).catch(function(error) {
|
|
26157
26248
|
console.error(error);
|
|
26158
26249
|
});
|
|
@@ -36675,6 +36766,7 @@ __decorate([
|
|
|
36675
36766
|
Polyfill._registerMatchAll();
|
|
36676
36767
|
Polyfill._registerAudioContext();
|
|
36677
36768
|
Polyfill._registerTextMetrics();
|
|
36769
|
+
Polyfill._registerPromiseFinally();
|
|
36678
36770
|
};
|
|
36679
36771
|
Polyfill._registerMatchAll = function _registerMatchAll() {
|
|
36680
36772
|
if (!String.prototype.matchAll) {
|
|
@@ -36772,10 +36864,28 @@ __decorate([
|
|
|
36772
36864
|
});
|
|
36773
36865
|
}
|
|
36774
36866
|
};
|
|
36867
|
+
Polyfill._registerPromiseFinally = function _registerPromiseFinally() {
|
|
36868
|
+
// iOS Safari 10.0-10.2 and older versions do not support Promise.prototype.finally
|
|
36869
|
+
// Examples: iPhone 6s and below devices without system upgrade
|
|
36870
|
+
if (!Promise.prototype.finally) {
|
|
36871
|
+
Logger.info("Polyfill Promise.prototype.finally");
|
|
36872
|
+
Promise.prototype.finally = function(onFinally) {
|
|
36873
|
+
return this.then(function(value) {
|
|
36874
|
+
return Promise.resolve(onFinally == null ? void 0 : onFinally()).then(function() {
|
|
36875
|
+
return value;
|
|
36876
|
+
});
|
|
36877
|
+
}, function(reason) {
|
|
36878
|
+
return Promise.resolve(onFinally == null ? void 0 : onFinally()).then(function() {
|
|
36879
|
+
throw reason;
|
|
36880
|
+
});
|
|
36881
|
+
});
|
|
36882
|
+
};
|
|
36883
|
+
}
|
|
36884
|
+
};
|
|
36775
36885
|
return Polyfill;
|
|
36776
36886
|
}();
|
|
36777
36887
|
|
|
36778
36888
|
Polyfill.registerPolyfill();
|
|
36779
36889
|
|
|
36780
|
-
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode,
|
|
36890
|
+
export { AmbientLight, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BatchUtils, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlendState, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, DataType, DependentMode, DepthState, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshRenderer, MeshShape, MeshTopology, ModelMesh, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, RasterState, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderState, RenderStateElementKey as RenderStateDataKey, RenderTarget, RenderTargetBlendState, Renderer, RendererUpdateFlags, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLib, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderPlatformTarget, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, StencilState, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
|
|
36781
36891
|
//# sourceMappingURL=module.js.map
|