@galacean/engine-core 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +34 -10
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +34 -10
- package/dist/module.js +34 -10
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/mesh/MeshRenderer.d.ts +8 -2
- package/types/mesh/SkinnedMeshRenderer.d.ts +1 -0
package/dist/miniprogram.js
CHANGED
|
@@ -12900,6 +12900,7 @@ var VertexChangedFlags;
|
|
|
12900
12900
|
function MeshRenderer(entity) {
|
|
12901
12901
|
var _this;
|
|
12902
12902
|
_this = Renderer.call(this, entity) || this;
|
|
12903
|
+
_this._enableVertexColor = false;
|
|
12903
12904
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
12904
12905
|
return _this;
|
|
12905
12906
|
}
|
|
@@ -12961,7 +12962,7 @@ var VertexChangedFlags;
|
|
|
12961
12962
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
12962
12963
|
break;
|
|
12963
12964
|
case "COLOR_0":
|
|
12964
|
-
shaderData.enableMacro(MeshRenderer._vertexColorMacro);
|
|
12965
|
+
this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
|
|
12965
12966
|
break;
|
|
12966
12967
|
}
|
|
12967
12968
|
}
|
|
@@ -13016,6 +13017,20 @@ var VertexChangedFlags;
|
|
|
13016
13017
|
this._setMesh(value);
|
|
13017
13018
|
}
|
|
13018
13019
|
}
|
|
13020
|
+
},
|
|
13021
|
+
{
|
|
13022
|
+
key: "enableVertexColor",
|
|
13023
|
+
get: /**
|
|
13024
|
+
* Whether enable vertex color.
|
|
13025
|
+
*/ function get() {
|
|
13026
|
+
return this._enableVertexColor;
|
|
13027
|
+
},
|
|
13028
|
+
set: function set(value) {
|
|
13029
|
+
if (value !== this._enableVertexColor) {
|
|
13030
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13031
|
+
this._enableVertexColor = value;
|
|
13032
|
+
}
|
|
13033
|
+
}
|
|
13019
13034
|
}
|
|
13020
13035
|
]);
|
|
13021
13036
|
return MeshRenderer;
|
|
@@ -13126,6 +13141,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13126
13141
|
function SkinnedMeshRenderer(entity) {
|
|
13127
13142
|
var _this;
|
|
13128
13143
|
_this = MeshRenderer.call(this, entity) || this;
|
|
13144
|
+
_this._supportSkinning = false;
|
|
13129
13145
|
_this._hasInitSkin = false;
|
|
13130
13146
|
_this._jointDataCreateCache = new miniprogram.Vector2(-1, -1);
|
|
13131
13147
|
_this._localBounds = new miniprogram.BoundingBox();
|
|
@@ -13135,7 +13151,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13135
13151
|
// Limit size to 256 to avoid some problem:
|
|
13136
13152
|
// For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
|
|
13137
13153
|
// For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
|
|
13138
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
13154
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
13139
13155
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13140
13156
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13141
13157
|
var localBounds = _this._localBounds;
|
|
@@ -13153,9 +13169,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13153
13169
|
this._initSkin();
|
|
13154
13170
|
this._hasInitSkin = true;
|
|
13155
13171
|
}
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
var ibms = skin.inverseBindMatrices;
|
|
13172
|
+
if (this._supportSkinning) {
|
|
13173
|
+
var ibms = this._skin.inverseBindMatrices;
|
|
13159
13174
|
var worldToLocal = this._rootBone.getInvModelMatrix();
|
|
13160
13175
|
var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
|
|
13161
13176
|
for(var i = joints.length - 1; i >= 0; i--){
|
|
@@ -13174,8 +13189,6 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13174
13189
|
* @override
|
|
13175
13190
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13176
13191
|
var entity = this.entity;
|
|
13177
|
-
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13178
|
-
this._updateTransformShaderData(context, worldMatrix);
|
|
13179
13192
|
var shaderData = this.shaderData;
|
|
13180
13193
|
var mesh = this.mesh;
|
|
13181
13194
|
var blendShapeManager = mesh._blendShapeManager;
|
|
@@ -13202,12 +13215,18 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13202
13215
|
shaderData.disableMacro("O3_JOINTS_NUM");
|
|
13203
13216
|
shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
|
|
13204
13217
|
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
13218
|
+
this._supportSkinning = true;
|
|
13205
13219
|
} else {
|
|
13206
|
-
|
|
13220
|
+
var _this__jointTexture1;
|
|
13221
|
+
this._supportSkinning = false;
|
|
13222
|
+
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
13223
|
+
shaderData.disableMacro("O3_HAS_SKIN");
|
|
13224
|
+
Logger.warn("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
|
|
13207
13225
|
}
|
|
13208
13226
|
} else {
|
|
13209
|
-
var
|
|
13210
|
-
|
|
13227
|
+
var _this__jointTexture2;
|
|
13228
|
+
this._supportSkinning = true;
|
|
13229
|
+
(_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
|
|
13211
13230
|
shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
|
|
13212
13231
|
shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
|
|
13213
13232
|
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
|
|
@@ -13218,6 +13237,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13218
13237
|
this._jointTexture.setPixelBuffer(this._jointMatrices);
|
|
13219
13238
|
}
|
|
13220
13239
|
}
|
|
13240
|
+
var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13241
|
+
this._updateTransformShaderData(context, worldMatrix);
|
|
13221
13242
|
var layer = entity.layer;
|
|
13222
13243
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
13223
13244
|
};
|
|
@@ -13412,6 +13433,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13412
13433
|
(function() {
|
|
13413
13434
|
SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
|
|
13414
13435
|
})();
|
|
13436
|
+
__decorate([
|
|
13437
|
+
ignoreClone
|
|
13438
|
+
], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
|
|
13415
13439
|
__decorate([
|
|
13416
13440
|
ignoreClone
|
|
13417
13441
|
], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
|
package/dist/module.js
CHANGED
|
@@ -12895,6 +12895,7 @@ var VertexChangedFlags;
|
|
|
12895
12895
|
function MeshRenderer(entity) {
|
|
12896
12896
|
var _this;
|
|
12897
12897
|
_this = Renderer.call(this, entity) || this;
|
|
12898
|
+
_this._enableVertexColor = false;
|
|
12898
12899
|
_this._onMeshChanged = _this._onMeshChanged.bind(_assert_this_initialized(_this));
|
|
12899
12900
|
return _this;
|
|
12900
12901
|
}
|
|
@@ -12956,7 +12957,7 @@ var VertexChangedFlags;
|
|
|
12956
12957
|
shaderData.enableMacro(MeshRenderer._tangentMacro);
|
|
12957
12958
|
break;
|
|
12958
12959
|
case "COLOR_0":
|
|
12959
|
-
shaderData.enableMacro(MeshRenderer._vertexColorMacro);
|
|
12960
|
+
this.enableVertexColor && shaderData.enableMacro(MeshRenderer._vertexColorMacro);
|
|
12960
12961
|
break;
|
|
12961
12962
|
}
|
|
12962
12963
|
}
|
|
@@ -13011,6 +13012,20 @@ var VertexChangedFlags;
|
|
|
13011
13012
|
this._setMesh(value);
|
|
13012
13013
|
}
|
|
13013
13014
|
}
|
|
13015
|
+
},
|
|
13016
|
+
{
|
|
13017
|
+
key: "enableVertexColor",
|
|
13018
|
+
get: /**
|
|
13019
|
+
* Whether enable vertex color.
|
|
13020
|
+
*/ function get() {
|
|
13021
|
+
return this._enableVertexColor;
|
|
13022
|
+
},
|
|
13023
|
+
set: function set(value) {
|
|
13024
|
+
if (value !== this._enableVertexColor) {
|
|
13025
|
+
this._dirtyUpdateFlag |= 0x2;
|
|
13026
|
+
this._enableVertexColor = value;
|
|
13027
|
+
}
|
|
13028
|
+
}
|
|
13014
13029
|
}
|
|
13015
13030
|
]);
|
|
13016
13031
|
return MeshRenderer;
|
|
@@ -13121,6 +13136,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13121
13136
|
function SkinnedMeshRenderer(entity) {
|
|
13122
13137
|
var _this;
|
|
13123
13138
|
_this = MeshRenderer.call(this, entity) || this;
|
|
13139
|
+
_this._supportSkinning = false;
|
|
13124
13140
|
_this._hasInitSkin = false;
|
|
13125
13141
|
_this._jointDataCreateCache = new Vector2(-1, -1);
|
|
13126
13142
|
_this._localBounds = new BoundingBox();
|
|
@@ -13130,7 +13146,7 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13130
13146
|
// Limit size to 256 to avoid some problem:
|
|
13131
13147
|
// For renderer is "Apple GPU", when uniform is large than 256 the skeleton matrix array access in shader very slow in Safari or WKWebview. This may be a apple bug, Chrome and Firefox is OK!
|
|
13132
13148
|
// For renderer is "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3011 vs_5_0 ps_5_0, D3011)", compile shader si very slow because of max uniform is 4096.
|
|
13133
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
13149
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
13134
13150
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13135
13151
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13136
13152
|
var localBounds = _this._localBounds;
|
|
@@ -13148,9 +13164,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13148
13164
|
this._initSkin();
|
|
13149
13165
|
this._hasInitSkin = true;
|
|
13150
13166
|
}
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
var ibms = skin.inverseBindMatrices;
|
|
13167
|
+
if (this._supportSkinning) {
|
|
13168
|
+
var ibms = this._skin.inverseBindMatrices;
|
|
13154
13169
|
var worldToLocal = this._rootBone.getInvModelMatrix();
|
|
13155
13170
|
var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
|
|
13156
13171
|
for(var i = joints.length - 1; i >= 0; i--){
|
|
@@ -13169,8 +13184,6 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13169
13184
|
* @override
|
|
13170
13185
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13171
13186
|
var entity = this.entity;
|
|
13172
|
-
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13173
|
-
this._updateTransformShaderData(context, worldMatrix);
|
|
13174
13187
|
var shaderData = this.shaderData;
|
|
13175
13188
|
var mesh = this.mesh;
|
|
13176
13189
|
var blendShapeManager = mesh._blendShapeManager;
|
|
@@ -13197,12 +13210,18 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13197
13210
|
shaderData.disableMacro("O3_JOINTS_NUM");
|
|
13198
13211
|
shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
|
|
13199
13212
|
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
13213
|
+
this._supportSkinning = true;
|
|
13200
13214
|
} else {
|
|
13201
|
-
|
|
13215
|
+
var _this__jointTexture1;
|
|
13216
|
+
this._supportSkinning = false;
|
|
13217
|
+
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
13218
|
+
shaderData.disableMacro("O3_HAS_SKIN");
|
|
13219
|
+
Logger.warn("component's joints count(" + jointCount + ") greater than device's MAX_VERTEX_UNIFORM_VECTORS number " + this._maxVertexUniformVectors + ", and don't support jointTexture in this device. suggest joint count less than " + remainUniformJointCount + ".", this);
|
|
13202
13220
|
}
|
|
13203
13221
|
} else {
|
|
13204
|
-
var
|
|
13205
|
-
|
|
13222
|
+
var _this__jointTexture2;
|
|
13223
|
+
this._supportSkinning = true;
|
|
13224
|
+
(_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
|
|
13206
13225
|
shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
|
|
13207
13226
|
shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
|
|
13208
13227
|
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
|
|
@@ -13213,6 +13232,8 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13213
13232
|
this._jointTexture.setPixelBuffer(this._jointMatrices);
|
|
13214
13233
|
}
|
|
13215
13234
|
}
|
|
13235
|
+
var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13236
|
+
this._updateTransformShaderData(context, worldMatrix);
|
|
13216
13237
|
var layer = entity.layer;
|
|
13217
13238
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
13218
13239
|
};
|
|
@@ -13407,6 +13428,9 @@ var rePropName = RegExp(// Match anything that isn't a dot or bracket.
|
|
|
13407
13428
|
(function() {
|
|
13408
13429
|
SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
|
|
13409
13430
|
})();
|
|
13431
|
+
__decorate([
|
|
13432
|
+
ignoreClone
|
|
13433
|
+
], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
|
|
13410
13434
|
__decorate([
|
|
13411
13435
|
ignoreClone
|
|
13412
13436
|
], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
|