@galacean/engine-physics-lite 0.9.0 → 0.9.2
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.map +1 -1
- package/dist/miniprogram.js +84 -34
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/miniprogram.js
CHANGED
|
@@ -12996,6 +12996,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
12996
12996
|
var SkinnedMeshRenderer = function SkinnedMeshRenderer(entity) {
|
|
12997
12997
|
var _this;
|
|
12998
12998
|
_this = MeshRenderer.call(this, entity) || this;
|
|
12999
|
+
_this._supportSkinning = false;
|
|
12999
13000
|
_this._hasInitSkin = false;
|
|
13000
13001
|
_this._jointDataCreateCache = new miniprogram$7.Vector2(-1, -1);
|
|
13001
13002
|
_this._localBounds = new miniprogram$7.BoundingBox();
|
|
@@ -13005,7 +13006,7 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
13005
13006
|
// Limit size to 256 to avoid some problem:
|
|
13006
13007
|
// 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!
|
|
13007
13008
|
// 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.
|
|
13008
|
-
maxVertexUniformVectors = Math.min(maxVertexUniformVectors,
|
|
13009
|
+
maxVertexUniformVectors = Math.min(maxVertexUniformVectors, rhi._options._maxAllowSkinUniformVectorCount);
|
|
13009
13010
|
_this._maxVertexUniformVectors = maxVertexUniformVectors;
|
|
13010
13011
|
_this._onLocalBoundsChanged = _this._onLocalBoundsChanged.bind(_assert_this_initialized(_this));
|
|
13011
13012
|
var localBounds = _this._localBounds;
|
|
@@ -13024,9 +13025,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
13024
13025
|
this._initSkin();
|
|
13025
13026
|
this._hasInitSkin = true;
|
|
13026
13027
|
}
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
var ibms = skin.inverseBindMatrices;
|
|
13028
|
+
if (this._supportSkinning) {
|
|
13029
|
+
var ibms = this._skin.inverseBindMatrices;
|
|
13030
13030
|
var worldToLocal = this._rootBone.getInvModelMatrix();
|
|
13031
13031
|
var _this = this, joints = _this._jointEntities, jointMatrices = _this._jointMatrices;
|
|
13032
13032
|
for(var i = joints.length - 1; i >= 0; i--){
|
|
@@ -13045,8 +13045,6 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
13045
13045
|
* @override
|
|
13046
13046
|
*/ _proto._updateShaderData = function _updateShaderData(context) {
|
|
13047
13047
|
var entity = this.entity;
|
|
13048
|
-
var worldMatrix = this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13049
|
-
this._updateTransformShaderData(context, worldMatrix);
|
|
13050
13048
|
var shaderData = this.shaderData;
|
|
13051
13049
|
var mesh = this.mesh;
|
|
13052
13050
|
var blendShapeManager = mesh._blendShapeManager;
|
|
@@ -13073,12 +13071,18 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
13073
13071
|
shaderData.disableMacro("O3_JOINTS_NUM");
|
|
13074
13072
|
shaderData.enableMacro("O3_USE_JOINT_TEXTURE");
|
|
13075
13073
|
shaderData.setTexture(SkinnedMeshRenderer._jointSamplerProperty, this._jointTexture);
|
|
13074
|
+
this._supportSkinning = true;
|
|
13076
13075
|
} else {
|
|
13077
|
-
|
|
13076
|
+
var _this__jointTexture1;
|
|
13077
|
+
this._supportSkinning = false;
|
|
13078
|
+
(_this__jointTexture1 = this._jointTexture) == null ? void 0 : _this__jointTexture1.destroy();
|
|
13079
|
+
shaderData.disableMacro("O3_HAS_SKIN");
|
|
13080
|
+
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);
|
|
13078
13081
|
}
|
|
13079
13082
|
} else {
|
|
13080
|
-
var
|
|
13081
|
-
|
|
13083
|
+
var _this__jointTexture2;
|
|
13084
|
+
this._supportSkinning = true;
|
|
13085
|
+
(_this__jointTexture2 = this._jointTexture) == null ? void 0 : _this__jointTexture2.destroy();
|
|
13082
13086
|
shaderData.disableMacro("O3_USE_JOINT_TEXTURE");
|
|
13083
13087
|
shaderData.enableMacro("O3_JOINTS_NUM", remainUniformJointCount.toString());
|
|
13084
13088
|
shaderData.setFloatArray(SkinnedMeshRenderer._jointMatrixProperty, this._jointMatrices);
|
|
@@ -13089,6 +13093,8 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
13089
13093
|
this._jointTexture.setPixelBuffer(this._jointMatrices);
|
|
13090
13094
|
}
|
|
13091
13095
|
}
|
|
13096
|
+
var worldMatrix = this._supportSkinning && this._rootBone ? this._rootBone.transform.worldMatrix : entity.transform.worldMatrix;
|
|
13097
|
+
this._updateTransformShaderData(context, worldMatrix);
|
|
13092
13098
|
var layer = entity.layer;
|
|
13093
13099
|
this._rendererLayer.set(layer & 65535, layer >>> 16 & 65535, 0, 0);
|
|
13094
13100
|
};
|
|
@@ -13283,6 +13289,9 @@ var rePropName = RegExp("[^.[\\]]+" + "|" + // Or match property names within br
|
|
|
13283
13289
|
(function() {
|
|
13284
13290
|
SkinnedMeshRenderer._jointMatrixProperty = Shader.getPropertyByName("u_jointMatrix");
|
|
13285
13291
|
})();
|
|
13292
|
+
__decorate$1([
|
|
13293
|
+
ignoreClone
|
|
13294
|
+
], SkinnedMeshRenderer.prototype, "_supportSkinning", void 0);
|
|
13286
13295
|
__decorate$1([
|
|
13287
13296
|
ignoreClone
|
|
13288
13297
|
], SkinnedMeshRenderer.prototype, "_hasInitSkin", void 0);
|
|
@@ -26236,21 +26245,31 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
|
|
|
26236
26245
|
var vertexCount;
|
|
26237
26246
|
var bufferBindIndex = 0;
|
|
26238
26247
|
var positions;
|
|
26239
|
-
|
|
26248
|
+
var boneIndices;
|
|
26249
|
+
var boneWeights;
|
|
26250
|
+
if (keepMeshData) {
|
|
26251
|
+
positions = new Array(vertexCount);
|
|
26252
|
+
boneIndices = new Array(vertexCount);
|
|
26253
|
+
boneWeights = new Array(vertexCount);
|
|
26254
|
+
}
|
|
26240
26255
|
for(var attribute in attributes){
|
|
26241
26256
|
var accessor = accessors[attributes[attribute]];
|
|
26242
26257
|
var accessorBuffer = GLTFUtil.getAccessorBuffer(context, gltf, accessor);
|
|
26243
|
-
var
|
|
26244
|
-
var
|
|
26258
|
+
var dataElementSize = GLTFUtil.getAccessorTypeSize(accessor.type);
|
|
26259
|
+
var accessorCount = accessor.count;
|
|
26245
26260
|
var vertices = accessorBuffer.data;
|
|
26246
26261
|
var vertexElement = void 0;
|
|
26247
26262
|
var meshId = mesh.instanceId;
|
|
26248
26263
|
var vertexBindingInfos = accessorBuffer.vertexBindingInfos;
|
|
26249
|
-
var
|
|
26264
|
+
var elementNormalized = accessor.normalized;
|
|
26265
|
+
var elementFormat = GLTFUtil.getElementFormat(accessor.componentType, dataElementSize, elementNormalized);
|
|
26266
|
+
var scaleFactor = void 0;
|
|
26267
|
+
elementNormalized && (scaleFactor = GLTFUtil.getNormalizedComponentScale(accessor.componentType));
|
|
26268
|
+
var elementOffset = void 0;
|
|
26250
26269
|
if (accessorBuffer.interleaved) {
|
|
26251
26270
|
var byteOffset = accessor.byteOffset || 0;
|
|
26252
26271
|
var stride = accessorBuffer.stride;
|
|
26253
|
-
|
|
26272
|
+
elementOffset = byteOffset % stride;
|
|
26254
26273
|
if (vertexBindingInfos[meshId] === undefined) {
|
|
26255
26274
|
vertexElement = new miniprogram$5.VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
26256
26275
|
var vertexBuffer = accessorBuffer.vertexBuffer;
|
|
@@ -26265,7 +26284,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
|
|
|
26265
26284
|
vertexElement = new miniprogram$5.VertexElement(attribute, elementOffset, elementFormat, vertexBindingInfos[meshId]);
|
|
26266
26285
|
}
|
|
26267
26286
|
} else {
|
|
26268
|
-
|
|
26287
|
+
elementOffset = 0;
|
|
26288
|
+
vertexElement = new miniprogram$5.VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
|
|
26269
26289
|
var vertexBuffer1 = new miniprogram$5.Buffer(engine, miniprogram$5.BufferBindFlag.VertexBuffer, vertices.byteLength, miniprogram$5.BufferUsage.Static);
|
|
26270
26290
|
vertexBuffer1.setData(vertices);
|
|
26271
26291
|
mesh.setVertexBufferBinding(vertexBuffer1, accessorBuffer.stride, bufferBindIndex);
|
|
@@ -26273,35 +26293,60 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
|
|
|
26273
26293
|
}
|
|
26274
26294
|
vertexElements.push(vertexElement);
|
|
26275
26295
|
if (attribute === "POSITION") {
|
|
26276
|
-
vertexCount =
|
|
26296
|
+
vertexCount = accessorCount;
|
|
26277
26297
|
var _mesh_bounds = mesh.bounds, min = _mesh_bounds.min, max = _mesh_bounds.max;
|
|
26278
26298
|
if (accessor.min && accessor.max) {
|
|
26279
26299
|
min.copyFromArray(accessor.min);
|
|
26280
26300
|
max.copyFromArray(accessor.max);
|
|
26281
26301
|
if (keepMeshData) {
|
|
26282
|
-
var
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26302
|
+
var baseOffset = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
26303
|
+
var stride1 = vertices.length / accessorCount;
|
|
26304
|
+
for(var j = 0; j < accessorCount; j++){
|
|
26305
|
+
var offset = baseOffset + j * stride1;
|
|
26306
|
+
var position = new miniprogram$1$2.Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
|
|
26307
|
+
elementNormalized && position.scale(scaleFactor);
|
|
26308
|
+
positions[j] = position;
|
|
26286
26309
|
}
|
|
26287
26310
|
}
|
|
26288
26311
|
} else {
|
|
26289
|
-
var
|
|
26312
|
+
var position1 = MeshParser._tempVector3;
|
|
26290
26313
|
min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
26291
26314
|
max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
26292
|
-
var
|
|
26293
|
-
|
|
26294
|
-
|
|
26295
|
-
|
|
26296
|
-
|
|
26297
|
-
miniprogram$1$2.Vector3.
|
|
26298
|
-
|
|
26315
|
+
var baseOffset1 = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
26316
|
+
var stride2 = vertices.length / accessorCount;
|
|
26317
|
+
for(var j1 = 0; j1 < accessorCount; j1++){
|
|
26318
|
+
var offset1 = baseOffset1 + j1 * stride2;
|
|
26319
|
+
position1.copyFromArray(vertices, offset1);
|
|
26320
|
+
miniprogram$1$2.Vector3.min(min, position1, min);
|
|
26321
|
+
miniprogram$1$2.Vector3.max(max, position1, max);
|
|
26322
|
+
if (keepMeshData) {
|
|
26323
|
+
var clonePosition = position1.clone();
|
|
26324
|
+
elementNormalized && clonePosition.scale(scaleFactor);
|
|
26325
|
+
positions[j1] = clonePosition;
|
|
26326
|
+
}
|
|
26299
26327
|
}
|
|
26300
26328
|
}
|
|
26301
|
-
if (
|
|
26302
|
-
|
|
26303
|
-
|
|
26304
|
-
|
|
26329
|
+
if (elementNormalized) {
|
|
26330
|
+
min.scale(scaleFactor);
|
|
26331
|
+
max.scale(scaleFactor);
|
|
26332
|
+
}
|
|
26333
|
+
} else if (attribute === "JOINTS_0" && keepMeshData) {
|
|
26334
|
+
var baseOffset2 = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
26335
|
+
var stride3 = vertices.length / accessorCount;
|
|
26336
|
+
for(var j2 = 0; j2 < accessorCount; j2++){
|
|
26337
|
+
var offset2 = baseOffset2 + j2 * stride3;
|
|
26338
|
+
var boneIndex = new miniprogram$1$2.Vector4(vertices[offset2], vertices[offset2 + 1], vertices[offset2 + 2], vertices[offset2 + 3]);
|
|
26339
|
+
elementNormalized && boneIndex.scale(scaleFactor);
|
|
26340
|
+
boneIndices[j2] = boneIndex;
|
|
26341
|
+
}
|
|
26342
|
+
} else if (attribute === "WEIGHTS_0" && keepMeshData) {
|
|
26343
|
+
var baseOffset3 = elementOffset / vertices.BYTES_PER_ELEMENT;
|
|
26344
|
+
var stride4 = vertices.length / accessorCount;
|
|
26345
|
+
for(var j3 = 0; j3 < accessorCount; j3++){
|
|
26346
|
+
var offset3 = baseOffset3 + j3 * stride4;
|
|
26347
|
+
var boneWeight = new miniprogram$1$2.Vector4(vertices[offset3], vertices[offset3 + 1], vertices[offset3 + 2], vertices[offset3 + 3]);
|
|
26348
|
+
elementNormalized && boneWeight.scale(scaleFactor);
|
|
26349
|
+
boneWeights[j3] = boneWeight;
|
|
26305
26350
|
}
|
|
26306
26351
|
}
|
|
26307
26352
|
}
|
|
@@ -26320,6 +26365,10 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
|
|
|
26320
26365
|
mesh.uploadData(!keepMeshData);
|
|
26321
26366
|
//@ts-ignore
|
|
26322
26367
|
mesh._positions = positions;
|
|
26368
|
+
//@ts-ignore
|
|
26369
|
+
mesh._boneIndices = boneIndices;
|
|
26370
|
+
//@ts-ignore
|
|
26371
|
+
mesh._boneWeights = boneWeights;
|
|
26323
26372
|
return Promise.resolve(mesh);
|
|
26324
26373
|
};
|
|
26325
26374
|
_proto._createBlendShape = function _createBlendShape(mesh, glTFMesh, glTFTargets, getBlendShapeData) {
|
|
@@ -35306,7 +35355,8 @@ exports.WebGLMode = void 0;
|
|
|
35306
35355
|
webGLMode: 0,
|
|
35307
35356
|
alpha: false,
|
|
35308
35357
|
stencil: true,
|
|
35309
|
-
_forceFlush: false
|
|
35358
|
+
_forceFlush: false,
|
|
35359
|
+
_maxAllowSkinUniformVectorCount: 256
|
|
35310
35360
|
}, initializeOptions);
|
|
35311
35361
|
if (miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPhone || miniprogram$1$1.SystemInfo.platform === miniprogram$1$1.Platform.IPad) {
|
|
35312
35362
|
var version = miniprogram$1$1.SystemInfo.operatingSystem.match(/(\d+).?(\d+)?.?(\d+)?/);
|
|
@@ -35611,7 +35661,7 @@ function _interopNamespace(e) {
|
|
|
35611
35661
|
}
|
|
35612
35662
|
var CoreObjects__namespace = /*#__PURE__*/ _interopNamespace(CoreObjects);
|
|
35613
35663
|
//@ts-ignore
|
|
35614
|
-
var version = "0.9.
|
|
35664
|
+
var version = "0.9.2";
|
|
35615
35665
|
console.log("Galacean engine version: " + version);
|
|
35616
35666
|
for(var key in CoreObjects__namespace){
|
|
35617
35667
|
CoreObjects.Loader.registerClass(key, CoreObjects__namespace[key]);
|