@galacean/engine 0.0.0-experimental-shaderlab.0 → 0.0.0-experimental-renderSort.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/browser.js +429 -127
- package/dist/browser.min.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
package/dist/browser.js
CHANGED
|
@@ -6907,13 +6907,15 @@
|
|
|
6907
6907
|
];
|
|
6908
6908
|
})();
|
|
6909
6909
|
(function() {
|
|
6910
|
-
|
|
6910
|
+
// _heightMultiplier used to measure the height of text, but in miniprogram performance is different from h5.
|
|
6911
|
+
// so can set _heightMultiplier to adapt miniprogram, the larger the value, the worse the performance.
|
|
6912
|
+
/** @internal */ TextUtils._heightMultiplier = 2;
|
|
6911
6913
|
})();
|
|
6912
6914
|
(function() {
|
|
6913
|
-
TextUtils.
|
|
6915
|
+
/** These characters are all tall to help calculate the height required for text. */ TextUtils._measureString = "|\xc9q\xc5";
|
|
6914
6916
|
})();
|
|
6915
6917
|
(function() {
|
|
6916
|
-
TextUtils.
|
|
6918
|
+
TextUtils._measureBaseline = "M";
|
|
6917
6919
|
})();
|
|
6918
6920
|
(function() {
|
|
6919
6921
|
TextUtils._baselineMultiplier = 1.4;
|
|
@@ -6995,7 +6997,8 @@
|
|
|
6995
6997
|
_proto._createFontAtlas = function _createFontAtlas() {
|
|
6996
6998
|
var _this = this, engine = _this._engine;
|
|
6997
6999
|
var fontAtlas = new FontAtlas(engine);
|
|
6998
|
-
var texture = new Texture2D(engine, 256, 256);
|
|
7000
|
+
var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
|
|
7001
|
+
texture.filterMode = exports.TextureFilterMode.Bilinear;
|
|
6999
7002
|
fontAtlas.texture = texture;
|
|
7000
7003
|
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
7001
7004
|
this._fontAtlases.push(fontAtlas);
|
|
@@ -10824,7 +10827,6 @@
|
|
|
10824
10827
|
_this = ShaderPart1.call(this) || this;
|
|
10825
10828
|
/** @internal */ _this._shaderPassId = 0;
|
|
10826
10829
|
/** @internal */ _this._renderStateDataMap = {};
|
|
10827
|
-
/** @internal */ _this._shaderProgramPools = [];
|
|
10828
10830
|
_this._shaderPassId = ShaderPass._shaderPassCounter++;
|
|
10829
10831
|
if (typeof fragmentSourceOrTags === "string") {
|
|
10830
10832
|
_this._name = nameOrVertexSource;
|
|
@@ -10878,15 +10880,6 @@
|
|
|
10878
10880
|
shaderProgramPool.cache(shaderProgram);
|
|
10879
10881
|
return shaderProgram;
|
|
10880
10882
|
};
|
|
10881
|
-
/**
|
|
10882
|
-
* @internal
|
|
10883
|
-
*/ _proto._destroy = function _destroy() {
|
|
10884
|
-
var shaderProgramPools = this._shaderProgramPools;
|
|
10885
|
-
for(var i = 0, n = shaderProgramPools.length; i < n; i++){
|
|
10886
|
-
shaderProgramPools[i]._destroy();
|
|
10887
|
-
}
|
|
10888
|
-
shaderProgramPools.length = 0;
|
|
10889
|
-
};
|
|
10890
10883
|
return ShaderPass;
|
|
10891
10884
|
}(ShaderPart);
|
|
10892
10885
|
(function() {
|
|
@@ -11509,8 +11502,6 @@
|
|
|
11509
11502
|
*/ var Shader = /*#__PURE__*/ function() {
|
|
11510
11503
|
var Shader = function Shader(name1, subShaders) {
|
|
11511
11504
|
this.name = name1;
|
|
11512
|
-
this._refCount = 0;
|
|
11513
|
-
this._destroyed = false;
|
|
11514
11505
|
this.name = name1;
|
|
11515
11506
|
this._subShaders = subShaders;
|
|
11516
11507
|
};
|
|
@@ -11530,46 +11521,20 @@
|
|
|
11530
11521
|
for(var i = 0, n = macros.length; i < n; i++){
|
|
11531
11522
|
compileMacros.enable(ShaderMacro.getByName(macros[i]));
|
|
11532
11523
|
}
|
|
11533
|
-
var isValid = false;
|
|
11534
11524
|
var subShaders = this._subShaders;
|
|
11535
11525
|
for(var i1 = 0, n1 = subShaders.length; i1 < n1; i1++){
|
|
11526
|
+
var isValid = void 0;
|
|
11536
11527
|
var passes = subShaders[i1].passes;
|
|
11537
11528
|
for(var j = 0, m = passes.length; j < m; j++){
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
};
|
|
11544
|
-
/**
|
|
11545
|
-
* Destroy the shader.
|
|
11546
|
-
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
11547
|
-
* @returns Whether the release was successful.
|
|
11548
|
-
*/ _proto.destroy = function destroy(force) {
|
|
11549
|
-
if (force === void 0) force = false;
|
|
11550
|
-
if (!force && this._refCount !== 0) {
|
|
11551
|
-
return false;
|
|
11552
|
-
}
|
|
11553
|
-
var subShaders = this._subShaders;
|
|
11554
|
-
for(var i = 0, n = subShaders.length; i < n; i++){
|
|
11555
|
-
var passes = subShaders[i].passes;
|
|
11556
|
-
for(var j = 0, m = passes.length; j < m; j++){
|
|
11557
|
-
passes[j]._destroy();
|
|
11529
|
+
if (isValid === undefined) {
|
|
11530
|
+
isValid = passes[j]._getShaderProgram(engine, compileMacros).isValid;
|
|
11531
|
+
} else {
|
|
11532
|
+
isValid && (isValid = passes[j]._getShaderProgram(engine, compileMacros).isValid);
|
|
11533
|
+
}
|
|
11558
11534
|
}
|
|
11535
|
+
if (isValid) return true;
|
|
11559
11536
|
}
|
|
11560
|
-
|
|
11561
|
-
this._destroyed = true;
|
|
11562
|
-
return true;
|
|
11563
|
-
};
|
|
11564
|
-
/**
|
|
11565
|
-
* @internal
|
|
11566
|
-
*/ _proto._getReferCount = function _getReferCount() {
|
|
11567
|
-
return this._refCount;
|
|
11568
|
-
};
|
|
11569
|
-
/**
|
|
11570
|
-
* @internal
|
|
11571
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
11572
|
-
this._refCount += value;
|
|
11537
|
+
return false;
|
|
11573
11538
|
};
|
|
11574
11539
|
Shader.create = function create(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShaders, fragmentSource) {
|
|
11575
11540
|
var shader;
|
|
@@ -11756,14 +11721,6 @@
|
|
|
11756
11721
|
*/ function get() {
|
|
11757
11722
|
return this._subShaders;
|
|
11758
11723
|
}
|
|
11759
|
-
},
|
|
11760
|
-
{
|
|
11761
|
-
key: "destroyed",
|
|
11762
|
-
get: /**
|
|
11763
|
-
* Whether it has been destroyed.
|
|
11764
|
-
*/ function get() {
|
|
11765
|
-
return this._destroyed;
|
|
11766
|
-
}
|
|
11767
11724
|
}
|
|
11768
11725
|
]);
|
|
11769
11726
|
return Shader;
|
|
@@ -12879,6 +12836,9 @@
|
|
|
12879
12836
|
__decorate$1([
|
|
12880
12837
|
assignmentClone
|
|
12881
12838
|
], SpriteMask.prototype, "influenceLayers", void 0);
|
|
12839
|
+
__decorate$1([
|
|
12840
|
+
ignoreClone
|
|
12841
|
+
], SpriteMask.prototype, "_verticesData", void 0);
|
|
12882
12842
|
__decorate$1([
|
|
12883
12843
|
ignoreClone
|
|
12884
12844
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
@@ -13993,7 +13953,7 @@
|
|
|
13993
13953
|
if (!material) {
|
|
13994
13954
|
continue;
|
|
13995
13955
|
}
|
|
13996
|
-
if (material.destroyed
|
|
13956
|
+
if (material.destroyed) {
|
|
13997
13957
|
material = this.engine._meshMagentaMaterial;
|
|
13998
13958
|
}
|
|
13999
13959
|
var renderData = meshRenderDataPool.getFromPool();
|
|
@@ -15644,6 +15604,10 @@
|
|
|
15644
15604
|
var sphereInfo = primitiveInfo;
|
|
15645
15605
|
PrimitiveMesh._setSphereData(this.resource, sphereInfo.radius, sphereInfo.segments, sphereInfo.noLongerAccessible, true, sphereInfo.vertexBuffer);
|
|
15646
15606
|
break;
|
|
15607
|
+
case 7:
|
|
15608
|
+
var CCSphereInfo = primitiveInfo;
|
|
15609
|
+
PrimitiveMesh._setSubdivisionSurfaceSphereData(this.resource, CCSphereInfo.radius, CCSphereInfo.step, CCSphereInfo.noLongerAccessible, true, CCSphereInfo.vertexBuffer);
|
|
15610
|
+
break;
|
|
15647
15611
|
case 1:
|
|
15648
15612
|
var cuboidInfo = primitiveInfo;
|
|
15649
15613
|
PrimitiveMesh._setCuboidData(this.resource, cuboidInfo.width, cuboidInfo.height, cuboidInfo.depth, cuboidInfo.noLongerAccessible, true, cuboidInfo.vertexBuffer);
|
|
@@ -15681,6 +15645,7 @@
|
|
|
15681
15645
|
PrimitiveType[PrimitiveType["Torus"] = 4] = "Torus";
|
|
15682
15646
|
PrimitiveType[PrimitiveType["Cone"] = 5] = "Cone";
|
|
15683
15647
|
PrimitiveType[PrimitiveType["Capsule"] = 6] = "Capsule";
|
|
15648
|
+
PrimitiveType[PrimitiveType["CCSphere"] = 7] = "CCSphere";
|
|
15684
15649
|
})(PrimitiveType || (PrimitiveType = {}));
|
|
15685
15650
|
/**
|
|
15686
15651
|
* @internal
|
|
@@ -15702,6 +15667,19 @@
|
|
|
15702
15667
|
_inherits$2(SphereRestoreInfo, PrimitiveRestoreInfo);
|
|
15703
15668
|
return SphereRestoreInfo;
|
|
15704
15669
|
}(PrimitiveRestoreInfo);
|
|
15670
|
+
/**
|
|
15671
|
+
* @internal
|
|
15672
|
+
*/ var SubdivisionSurfaceSphereRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
|
|
15673
|
+
var SubdivisionSurfaceSphereRestoreInfo = function SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible) {
|
|
15674
|
+
var _this;
|
|
15675
|
+
_this = PrimitiveRestoreInfo.call(this, 7, vertexBuffer, noLongerAccessible) || this;
|
|
15676
|
+
_this.radius = radius;
|
|
15677
|
+
_this.step = step;
|
|
15678
|
+
return _this;
|
|
15679
|
+
};
|
|
15680
|
+
_inherits$2(SubdivisionSurfaceSphereRestoreInfo, PrimitiveRestoreInfo);
|
|
15681
|
+
return SubdivisionSurfaceSphereRestoreInfo;
|
|
15682
|
+
}(PrimitiveRestoreInfo);
|
|
15705
15683
|
/**
|
|
15706
15684
|
* @internal
|
|
15707
15685
|
*/ var CuboidRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
|
|
@@ -15815,6 +15793,24 @@
|
|
|
15815
15793
|
return sphereMesh;
|
|
15816
15794
|
};
|
|
15817
15795
|
/**
|
|
15796
|
+
* Create a sphere mesh by implementing Catmull-Clark Surface Subdivision Algorithm.
|
|
15797
|
+
* Max step is limited to 6.
|
|
15798
|
+
* @param engine - Engine
|
|
15799
|
+
* @param radius - Sphere radius
|
|
15800
|
+
* @param step - Number of subdiv steps
|
|
15801
|
+
* @param noLongerAccessible - No longer access the vertices of the mesh after creation
|
|
15802
|
+
* @returns Sphere model mesh
|
|
15803
|
+
*/ PrimitiveMesh.createSubdivisionSurfaceSphere = function createSubdivisionSurfaceSphere(engine, radius, step, noLongerAccessible) {
|
|
15804
|
+
if (radius === void 0) radius = 0.5;
|
|
15805
|
+
if (step === void 0) step = 3;
|
|
15806
|
+
if (noLongerAccessible === void 0) noLongerAccessible = true;
|
|
15807
|
+
var sphereMesh = new ModelMesh(engine);
|
|
15808
|
+
PrimitiveMesh._setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, false);
|
|
15809
|
+
var vertexBuffer = sphereMesh.vertexBufferBindings[0].buffer;
|
|
15810
|
+
engine.resourceManager.addContentRestorer(new PrimitiveMeshRestorer(sphereMesh, new SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible)));
|
|
15811
|
+
return sphereMesh;
|
|
15812
|
+
};
|
|
15813
|
+
/**
|
|
15818
15814
|
* Create a cuboid mesh.
|
|
15819
15815
|
* @param engine - Engine
|
|
15820
15816
|
* @param width - Cuboid width
|
|
@@ -15944,6 +15940,90 @@
|
|
|
15944
15940
|
};
|
|
15945
15941
|
/**
|
|
15946
15942
|
* @internal
|
|
15943
|
+
*/ PrimitiveMesh._setSubdivisionSurfaceSphereData = function _setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
|
|
15944
|
+
// Max step is limited to 6. Because 7 step will generate a single mesh with over 98306 vertices
|
|
15945
|
+
step = MathUtil$1.clamp(Math.floor(step), 1, 6);
|
|
15946
|
+
var positions = new Float32Array(3 * (6 * Math.pow(4, step) + 2));
|
|
15947
|
+
var cells = new Float32Array(24 * Math.pow(4, step));
|
|
15948
|
+
PrimitiveMesh._subdiveCatmullClark(step, positions, cells);
|
|
15949
|
+
var positionCount = positions.length / 3;
|
|
15950
|
+
var cellsCount = cells.length / 4;
|
|
15951
|
+
var poleOffset = positionCount + Math.pow(2, step + 1) - 1;
|
|
15952
|
+
// 16 extra vertices for pole uv
|
|
15953
|
+
// 2 vertices at each pole are idle
|
|
15954
|
+
var vertexCount = poleOffset + 16;
|
|
15955
|
+
var vertices = new Float32Array(vertexCount * 8);
|
|
15956
|
+
var indices = PrimitiveMesh._generateIndices(sphereMesh.engine, positionCount, cellsCount * 6);
|
|
15957
|
+
var seamCount = 0;
|
|
15958
|
+
var seamVertices = {};
|
|
15959
|
+
// Get normals, uvs, and scale to radius
|
|
15960
|
+
for(var i = 0; i < positionCount; i++){
|
|
15961
|
+
var offset = 3 * i;
|
|
15962
|
+
var x = positions[offset];
|
|
15963
|
+
var y = positions[offset + 1];
|
|
15964
|
+
var z = positions[offset + 2];
|
|
15965
|
+
var reciprocalLength = 1 / Math.sqrt(x * x + y * y + z * z);
|
|
15966
|
+
x *= reciprocalLength;
|
|
15967
|
+
y *= reciprocalLength;
|
|
15968
|
+
z *= reciprocalLength;
|
|
15969
|
+
offset = 8 * i;
|
|
15970
|
+
vertices[offset] = x * radius;
|
|
15971
|
+
vertices[offset + 1] = y * radius;
|
|
15972
|
+
vertices[offset + 2] = z * radius;
|
|
15973
|
+
vertices[offset + 3] = x;
|
|
15974
|
+
vertices[offset + 4] = y;
|
|
15975
|
+
vertices[offset + 5] = z;
|
|
15976
|
+
vertices[offset + 6] = (Math.PI - Math.atan2(z, x)) / (2 * Math.PI);
|
|
15977
|
+
vertices[offset + 7] = Math.acos(y) / Math.PI;
|
|
15978
|
+
if (vertices[offset + 6] === 0) {
|
|
15979
|
+
// Generate seam vertex
|
|
15980
|
+
var seamOffset = 8 * (positionCount + seamCount++);
|
|
15981
|
+
vertices.set(vertices.subarray(offset, offset + 8), seamOffset);
|
|
15982
|
+
vertices[seamOffset + 6] = 1.0;
|
|
15983
|
+
// Cache seam vertex
|
|
15984
|
+
seamVertices[offset / 8] = seamOffset / 8;
|
|
15985
|
+
}
|
|
15986
|
+
}
|
|
15987
|
+
// Get indices
|
|
15988
|
+
var offset1 = 0;
|
|
15989
|
+
this._spherePoleIdx = 0;
|
|
15990
|
+
for(var i1 = 0; i1 < cellsCount; i1++){
|
|
15991
|
+
var idx = 4 * i1;
|
|
15992
|
+
var indexA = cells[idx];
|
|
15993
|
+
var indexB = cells[idx + 1];
|
|
15994
|
+
var indexC = cells[idx + 2];
|
|
15995
|
+
var indexD = cells[idx + 3];
|
|
15996
|
+
// Handle seam by replacing vertex index to seam vertex index if necessary
|
|
15997
|
+
var floatIndexA = 8 * indexA;
|
|
15998
|
+
var floatIndexB = 8 * indexB;
|
|
15999
|
+
var floatIndexC = 8 * indexC;
|
|
16000
|
+
var floatIndexD = 8 * indexD;
|
|
16001
|
+
// If center Z is negative
|
|
16002
|
+
if (vertices[floatIndexA + 2] + vertices[floatIndexB + 2] + vertices[floatIndexC + 2] < 0) {
|
|
16003
|
+
vertices[floatIndexA + 6] === 0 && (indexA = seamVertices[indexA]);
|
|
16004
|
+
vertices[floatIndexB + 6] === 0 && (indexB = seamVertices[indexB]);
|
|
16005
|
+
vertices[floatIndexC + 6] === 0 && (indexC = seamVertices[indexC]);
|
|
16006
|
+
vertices[floatIndexD + 6] === 0 && (indexD = seamVertices[indexD]);
|
|
16007
|
+
}
|
|
16008
|
+
indices[offset1] = indexA;
|
|
16009
|
+
indices[offset1 + 1] = indexB;
|
|
16010
|
+
indices[offset1 + 2] = indexC;
|
|
16011
|
+
this._generateAndReplacePoleUV(indices, vertices, offset1, poleOffset);
|
|
16012
|
+
indices[offset1 + 3] = indexA;
|
|
16013
|
+
indices[offset1 + 4] = indexC;
|
|
16014
|
+
indices[offset1 + 5] = indexD;
|
|
16015
|
+
this._generateAndReplacePoleUV(indices, vertices, offset1 + 3, poleOffset);
|
|
16016
|
+
offset1 += 6;
|
|
16017
|
+
}
|
|
16018
|
+
if (!isRestoreMode) {
|
|
16019
|
+
var bounds = sphereMesh.bounds;
|
|
16020
|
+
bounds.min.set(-radius, -radius, -radius);
|
|
16021
|
+
bounds.max.set(radius, radius, radius);
|
|
16022
|
+
}
|
|
16023
|
+
PrimitiveMesh._initialize(sphereMesh, vertices, indices, noLongerAccessible, isRestoreMode, restoreVertexBuffer);
|
|
16024
|
+
};
|
|
16025
|
+
/**
|
|
16026
|
+
* @internal
|
|
15947
16027
|
*/ PrimitiveMesh._setSphereData = function _setSphereData(sphereMesh, radius, segments, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
|
|
15948
16028
|
segments = Math.max(2, Math.floor(segments));
|
|
15949
16029
|
var count = segments + 1;
|
|
@@ -16004,6 +16084,135 @@
|
|
|
16004
16084
|
};
|
|
16005
16085
|
/**
|
|
16006
16086
|
* @internal
|
|
16087
|
+
*/ PrimitiveMesh._subdiveCatmullClark = function _subdiveCatmullClark(step, positions, cells) {
|
|
16088
|
+
var edges = new Map();
|
|
16089
|
+
var faces = new Array();
|
|
16090
|
+
positions.set(PrimitiveMesh._sphereSeedPositions);
|
|
16091
|
+
cells.set(PrimitiveMesh._sphereSeedCells);
|
|
16092
|
+
for(var i = 0; i < step; i++){
|
|
16093
|
+
var cellCount = 6 * Math.pow(4, i);
|
|
16094
|
+
var positionCount = 4 * cellCount + 2;
|
|
16095
|
+
edges.clear();
|
|
16096
|
+
faces.length = 0;
|
|
16097
|
+
// Get cell face's facePoint
|
|
16098
|
+
for(var j = 0; j < cellCount; j++){
|
|
16099
|
+
var face = faces[j] = {
|
|
16100
|
+
facePoint: new Vector3(),
|
|
16101
|
+
adjacentEdges: new Array(4)
|
|
16102
|
+
};
|
|
16103
|
+
// Get cell's edgePoint
|
|
16104
|
+
for(var k = 0; k < 4; k++){
|
|
16105
|
+
var offset = 3 * cells[4 * j + k];
|
|
16106
|
+
face.facePoint.x += 0.25 * positions[offset];
|
|
16107
|
+
face.facePoint.y += 0.25 * positions[offset + 1];
|
|
16108
|
+
face.facePoint.z += 0.25 * positions[offset + 2];
|
|
16109
|
+
}
|
|
16110
|
+
// Get cell edges
|
|
16111
|
+
for(var k1 = 0; k1 < 4; k1++){
|
|
16112
|
+
var vertexIdxA = cells[4 * j + k1];
|
|
16113
|
+
var vertexIdxB = cells[4 * j + (k1 + 1) % 4];
|
|
16114
|
+
var edgeIdxKey = Math.min(vertexIdxA, vertexIdxB) * positionCount + Math.max(vertexIdxA, vertexIdxB);
|
|
16115
|
+
if (!edges.has(edgeIdxKey)) {
|
|
16116
|
+
var edge = {
|
|
16117
|
+
edgePoint: new Vector3(),
|
|
16118
|
+
edgePointIndex: undefined
|
|
16119
|
+
};
|
|
16120
|
+
var offsetA = 3 * vertexIdxA;
|
|
16121
|
+
var offsetB = 3 * vertexIdxB;
|
|
16122
|
+
edge.edgePoint.set(0.25 * (positions[offsetA] + positions[offsetB]), 0.25 * (positions[offsetA + 1] + positions[offsetB + 1]), 0.25 * (positions[offsetA + 2] + positions[offsetB + 2]));
|
|
16123
|
+
edges.set(edgeIdxKey, edge);
|
|
16124
|
+
}
|
|
16125
|
+
var edge1 = edges.get(edgeIdxKey);
|
|
16126
|
+
face.adjacentEdges[k1] = edge1;
|
|
16127
|
+
var edgePoint = edge1.edgePoint;
|
|
16128
|
+
var facePoint = face.facePoint;
|
|
16129
|
+
edgePoint.x += 0.25 * facePoint.x;
|
|
16130
|
+
edgePoint.y += 0.25 * facePoint.y;
|
|
16131
|
+
edgePoint.z += 0.25 * facePoint.z;
|
|
16132
|
+
}
|
|
16133
|
+
}
|
|
16134
|
+
var prePointCount = cellCount + 2;
|
|
16135
|
+
var edgePointOffset = prePointCount + cellCount;
|
|
16136
|
+
var pointIdx = 0;
|
|
16137
|
+
this._sphereEdgeIdx = 0;
|
|
16138
|
+
var preCells = cells.slice(0, 4 * cellCount);
|
|
16139
|
+
// Get New positions, which consists of updated positions of existing points, face points and edge points
|
|
16140
|
+
for(var j1 = 0; j1 < cellCount; j1++){
|
|
16141
|
+
// Add face point to new positions
|
|
16142
|
+
var face1 = faces[j1];
|
|
16143
|
+
face1.facePoint.copyToArray(positions, 3 * (prePointCount + j1));
|
|
16144
|
+
// Get the face point index
|
|
16145
|
+
var ic = prePointCount + j1;
|
|
16146
|
+
var id = void 0, ib = void 0, temp = void 0;
|
|
16147
|
+
// ia -- id -- ia
|
|
16148
|
+
// | | |
|
|
16149
|
+
// ib -- ic -- ib
|
|
16150
|
+
// | | |
|
|
16151
|
+
// ia -- id -- ia
|
|
16152
|
+
for(var k2 = 0; k2 < 4; k2++){
|
|
16153
|
+
// Get the updated existing point index
|
|
16154
|
+
var ia = preCells[pointIdx++];
|
|
16155
|
+
// ib and id share four edge points in one cell
|
|
16156
|
+
switch(k2){
|
|
16157
|
+
case 0:
|
|
16158
|
+
{
|
|
16159
|
+
var edgeB = face1.adjacentEdges[k2 % 4];
|
|
16160
|
+
var edgeD = face1.adjacentEdges[(k2 + 3) % 4];
|
|
16161
|
+
ib = this._calculateEdgeIndex(positions, edgeB, edgePointOffset);
|
|
16162
|
+
id = this._calculateEdgeIndex(positions, edgeD, edgePointOffset);
|
|
16163
|
+
temp = id;
|
|
16164
|
+
break;
|
|
16165
|
+
}
|
|
16166
|
+
case 1:
|
|
16167
|
+
case 2:
|
|
16168
|
+
{
|
|
16169
|
+
var edgeB1 = face1.adjacentEdges[k2 % 4];
|
|
16170
|
+
id = ib;
|
|
16171
|
+
ib = this._calculateEdgeIndex(positions, edgeB1, edgePointOffset);
|
|
16172
|
+
break;
|
|
16173
|
+
}
|
|
16174
|
+
case 3:
|
|
16175
|
+
{
|
|
16176
|
+
id = ib;
|
|
16177
|
+
ib = temp;
|
|
16178
|
+
break;
|
|
16179
|
+
}
|
|
16180
|
+
}
|
|
16181
|
+
var idx = 4 * (4 * j1 + k2);
|
|
16182
|
+
cells[idx] = ia;
|
|
16183
|
+
cells[idx + 1] = ib;
|
|
16184
|
+
cells[idx + 2] = ic;
|
|
16185
|
+
cells[idx + 3] = id;
|
|
16186
|
+
}
|
|
16187
|
+
}
|
|
16188
|
+
}
|
|
16189
|
+
};
|
|
16190
|
+
/**
|
|
16191
|
+
* Duplicate vertices at the poles and adjust their UV coordinates.
|
|
16192
|
+
*/ PrimitiveMesh._generateAndReplacePoleUV = function _generateAndReplacePoleUV(indices, vertices, idx, poleOffset) {
|
|
16193
|
+
var v = vertices[8 * indices[idx] + 7];
|
|
16194
|
+
if (v === 0 || v === 1) {
|
|
16195
|
+
var offset = 8 * indices[idx];
|
|
16196
|
+
var addedOffset = 8 * (poleOffset + this._spherePoleIdx);
|
|
16197
|
+
vertices.set(vertices.subarray(offset, offset + 8), addedOffset);
|
|
16198
|
+
vertices[addedOffset + 6] = 0.5 * (vertices[offset + 6] + vertices[8 * indices[idx + 1] + 6] + vertices[8 * indices[idx + 2] + 6] - 0.5);
|
|
16199
|
+
indices[idx] = poleOffset + this._spherePoleIdx++;
|
|
16200
|
+
}
|
|
16201
|
+
};
|
|
16202
|
+
/**
|
|
16203
|
+
* Get edge point index for subdivision surface sphere.
|
|
16204
|
+
*/ PrimitiveMesh._calculateEdgeIndex = function _calculateEdgeIndex(positions, edge, offset) {
|
|
16205
|
+
if (edge.edgePointIndex !== undefined) {
|
|
16206
|
+
return edge.edgePointIndex;
|
|
16207
|
+
} else {
|
|
16208
|
+
edge.edgePoint.copyToArray(positions, 3 * (offset + PrimitiveMesh._sphereEdgeIdx));
|
|
16209
|
+
var index = offset + PrimitiveMesh._sphereEdgeIdx++;
|
|
16210
|
+
edge.edgePointIndex = index;
|
|
16211
|
+
return index;
|
|
16212
|
+
}
|
|
16213
|
+
};
|
|
16214
|
+
/**
|
|
16215
|
+
* @internal
|
|
16007
16216
|
*/ PrimitiveMesh._setCuboidData = function _setCuboidData(cuboidMesh, width, height, depth, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
|
|
16008
16217
|
var halfWidth = width / 2;
|
|
16009
16218
|
var halfHeight = height / 2;
|
|
@@ -16628,6 +16837,68 @@
|
|
|
16628
16837
|
(function() {
|
|
16629
16838
|
PrimitiveMesh._tempVec30 = new Vector3();
|
|
16630
16839
|
})();
|
|
16840
|
+
(function() {
|
|
16841
|
+
PrimitiveMesh._sphereSeedPositions = new Float32Array([
|
|
16842
|
+
-1,
|
|
16843
|
+
1,
|
|
16844
|
+
1,
|
|
16845
|
+
-1,
|
|
16846
|
+
-1,
|
|
16847
|
+
1,
|
|
16848
|
+
1,
|
|
16849
|
+
-1,
|
|
16850
|
+
1,
|
|
16851
|
+
1,
|
|
16852
|
+
1,
|
|
16853
|
+
1,
|
|
16854
|
+
1,
|
|
16855
|
+
-1,
|
|
16856
|
+
-1,
|
|
16857
|
+
1,
|
|
16858
|
+
1,
|
|
16859
|
+
-1,
|
|
16860
|
+
-1,
|
|
16861
|
+
-1,
|
|
16862
|
+
-1,
|
|
16863
|
+
-1,
|
|
16864
|
+
1,
|
|
16865
|
+
-1
|
|
16866
|
+
]);
|
|
16867
|
+
})();
|
|
16868
|
+
(function() {
|
|
16869
|
+
PrimitiveMesh._sphereSeedCells = new Float32Array([
|
|
16870
|
+
0,
|
|
16871
|
+
1,
|
|
16872
|
+
2,
|
|
16873
|
+
3,
|
|
16874
|
+
3,
|
|
16875
|
+
2,
|
|
16876
|
+
4,
|
|
16877
|
+
5,
|
|
16878
|
+
5,
|
|
16879
|
+
4,
|
|
16880
|
+
6,
|
|
16881
|
+
7,
|
|
16882
|
+
7,
|
|
16883
|
+
0,
|
|
16884
|
+
3,
|
|
16885
|
+
5,
|
|
16886
|
+
7,
|
|
16887
|
+
6,
|
|
16888
|
+
1,
|
|
16889
|
+
0,
|
|
16890
|
+
6,
|
|
16891
|
+
4,
|
|
16892
|
+
2,
|
|
16893
|
+
1
|
|
16894
|
+
]);
|
|
16895
|
+
})();
|
|
16896
|
+
(function() {
|
|
16897
|
+
PrimitiveMesh._sphereEdgeIdx = 0;
|
|
16898
|
+
})();
|
|
16899
|
+
(function() {
|
|
16900
|
+
PrimitiveMesh._spherePoleIdx = 0;
|
|
16901
|
+
})();
|
|
16631
16902
|
/**
|
|
16632
16903
|
* Mesh skin data, equal glTF skins define
|
|
16633
16904
|
*/ var Skin = /*#__PURE__*/ function(EngineObject1) {
|
|
@@ -17133,8 +17404,10 @@
|
|
|
17133
17404
|
}
|
|
17134
17405
|
mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
|
|
17135
17406
|
batchedQueue[curMeshIndex] = preElement;
|
|
17136
|
-
|
|
17137
|
-
|
|
17407
|
+
// Set data option use Discard, or will resulted in performance slowdown when open antialias and cross-rendering of 3D and 2D elements.
|
|
17408
|
+
// Device: iphone X(16.7.2)、iphone 15 pro max(17.1.1)、iphone XR(17.1.2) etc.
|
|
17409
|
+
this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
|
|
17410
|
+
this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
|
|
17138
17411
|
};
|
|
17139
17412
|
_proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
|
|
17140
17413
|
var subMesh = this._subMeshPool.getFromPool();
|
|
@@ -21148,7 +21421,6 @@
|
|
|
21148
21421
|
if (this._destroyed) return;
|
|
21149
21422
|
ReferResource1.prototype._addReferCount.call(this, value);
|
|
21150
21423
|
this.shaderData._addReferCount(value);
|
|
21151
|
-
this._shader._addReferCount(value);
|
|
21152
21424
|
};
|
|
21153
21425
|
/**
|
|
21154
21426
|
* @override
|
|
@@ -21176,12 +21448,6 @@
|
|
|
21176
21448
|
return this._shader;
|
|
21177
21449
|
},
|
|
21178
21450
|
set: function set(value) {
|
|
21179
|
-
var refCount = this._getReferCount();
|
|
21180
|
-
if (refCount > 0) {
|
|
21181
|
-
var _this__shader;
|
|
21182
|
-
(_this__shader = this._shader) == null ? void 0 : _this__shader._addReferCount(-refCount);
|
|
21183
|
-
value._addReferCount(refCount);
|
|
21184
|
-
}
|
|
21185
21451
|
this._shader = value;
|
|
21186
21452
|
var renderStates = this._renderStates;
|
|
21187
21453
|
var lastStatesCount = renderStates.length;
|
|
@@ -21417,24 +21683,6 @@
|
|
|
21417
21683
|
*/ _proto.cache = function cache(shaderProgram) {
|
|
21418
21684
|
this._lastQueryMap[this._lastQueryKey] = shaderProgram;
|
|
21419
21685
|
};
|
|
21420
|
-
/**
|
|
21421
|
-
* @internal
|
|
21422
|
-
*/ _proto._destroy = function _destroy() {
|
|
21423
|
-
this._recursiveDestroy(0, this._cacheMap);
|
|
21424
|
-
this._cacheMap = Object.create(null);
|
|
21425
|
-
};
|
|
21426
|
-
_proto._recursiveDestroy = function _recursiveDestroy(hierarchy, cacheMap) {
|
|
21427
|
-
if (hierarchy === this._cacheHierarchyDepth - 1) {
|
|
21428
|
-
for(var k in cacheMap){
|
|
21429
|
-
cacheMap[k].destroy();
|
|
21430
|
-
}
|
|
21431
|
-
return;
|
|
21432
|
-
}
|
|
21433
|
-
++hierarchy;
|
|
21434
|
-
for(var k1 in cacheMap){
|
|
21435
|
-
this._recursiveDestroy(hierarchy, cacheMap[k1]);
|
|
21436
|
-
}
|
|
21437
|
-
};
|
|
21438
21686
|
_proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, currentHierarchy, increaseHierarchy) {
|
|
21439
21687
|
// Only expand but not shrink
|
|
21440
21688
|
if (hierarchy == currentHierarchy - 1) {
|
|
@@ -23001,7 +23249,7 @@
|
|
|
23001
23249
|
/**
|
|
23002
23250
|
* @internal
|
|
23003
23251
|
*/ _proto._render = function _render(context) {
|
|
23004
|
-
if (this.
|
|
23252
|
+
if (this._isTextNoVisible()) {
|
|
23005
23253
|
return;
|
|
23006
23254
|
}
|
|
23007
23255
|
if (this._isContainDirtyFlag(0x10)) {
|
|
@@ -23093,8 +23341,8 @@
|
|
|
23093
23341
|
}
|
|
23094
23342
|
};
|
|
23095
23343
|
_proto._updateLocalData = function _updateLocalData() {
|
|
23096
|
-
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
23097
23344
|
var _this__localBounds = this._localBounds, min = _this__localBounds.min, max = _this__localBounds.max;
|
|
23345
|
+
var _this = this, color = _this.color, charRenderDatas = _this._charRenderDatas, charFont = _this._subFont;
|
|
23098
23346
|
var textMetrics = this.enableWrapping ? TextUtils.measureTextWithWrap(this) : TextUtils.measureTextWithoutWrap(this);
|
|
23099
23347
|
var height = textMetrics.height, lines = textMetrics.lines, lineWidths = textMetrics.lineWidths, lineHeight = textMetrics.lineHeight, lineMaxSizes = textMetrics.lineMaxSizes;
|
|
23100
23348
|
var charRenderDataPool = TextRenderer._charRenderDataPool;
|
|
@@ -23162,7 +23410,7 @@
|
|
|
23162
23410
|
var left = startX * pixelsPerUnitReciprocal;
|
|
23163
23411
|
var right = (startX + w) * pixelsPerUnitReciprocal;
|
|
23164
23412
|
var top = (startY + ascent) * pixelsPerUnitReciprocal;
|
|
23165
|
-
var bottom = (startY - descent
|
|
23413
|
+
var bottom = (startY - descent) * pixelsPerUnitReciprocal;
|
|
23166
23414
|
localPositions.set(left, top, right, bottom);
|
|
23167
23415
|
i === firstLine && (maxY = Math.max(maxY, top));
|
|
23168
23416
|
minY = Math.min(minY, bottom);
|
|
@@ -23203,6 +23451,9 @@
|
|
|
23203
23451
|
Renderer1.prototype._onTransformChanged.call(this, bit);
|
|
23204
23452
|
this._setDirtyFlagTrue(0x4 | 0x8);
|
|
23205
23453
|
};
|
|
23454
|
+
_proto._isTextNoVisible = function _isTextNoVisible() {
|
|
23455
|
+
return this._text === "" || this._fontSize === 0 || this.enableWrapping && this.width <= 0 || this.overflowMode === exports.OverflowMode.Truncate && this.height <= 0;
|
|
23456
|
+
};
|
|
23206
23457
|
_create_class$3(TextRenderer, [
|
|
23207
23458
|
{
|
|
23208
23459
|
key: "color",
|
|
@@ -23405,6 +23656,16 @@
|
|
|
23405
23656
|
get: /**
|
|
23406
23657
|
* The bounding volume of the TextRenderer.
|
|
23407
23658
|
*/ function get() {
|
|
23659
|
+
if (this._isTextNoVisible()) {
|
|
23660
|
+
if (this._isContainDirtyFlag(0x8)) {
|
|
23661
|
+
var localBounds = this._localBounds;
|
|
23662
|
+
localBounds.min.set(0, 0, 0);
|
|
23663
|
+
localBounds.max.set(0, 0, 0);
|
|
23664
|
+
this._updateBounds(this._bounds);
|
|
23665
|
+
this._setDirtyFlagFalse(0x8);
|
|
23666
|
+
}
|
|
23667
|
+
return this._bounds;
|
|
23668
|
+
}
|
|
23408
23669
|
this._isContainDirtyFlag(0x1) && this._resetSubFont();
|
|
23409
23670
|
this._isContainDirtyFlag(0x2) && this._updateLocalData();
|
|
23410
23671
|
this._isContainDirtyFlag(0x4) && this._updatePosition();
|
|
@@ -23730,7 +23991,6 @@
|
|
|
23730
23991
|
shaderProgramPools.length = length;
|
|
23731
23992
|
}
|
|
23732
23993
|
shaderProgramPools[index] = pool = new ShaderProgramPool();
|
|
23733
|
-
shaderPass._shaderProgramPools.push(pool);
|
|
23734
23994
|
}
|
|
23735
23995
|
return pool;
|
|
23736
23996
|
};
|
|
@@ -26298,38 +26558,45 @@
|
|
|
26298
26558
|
var v0 = a[from];
|
|
26299
26559
|
var v1 = a[to - 1];
|
|
26300
26560
|
var v2 = a[third_index];
|
|
26561
|
+
var swapFlag = false;
|
|
26301
26562
|
var c01 = compareFunc(v0, v1);
|
|
26302
26563
|
if (c01 > 0) {
|
|
26303
26564
|
// v1 < v0, so swap them.
|
|
26304
26565
|
var tmp = v0;
|
|
26305
26566
|
v0 = v1;
|
|
26306
26567
|
v1 = tmp;
|
|
26568
|
+
swapFlag = true;
|
|
26307
26569
|
} // v0 <= v1.
|
|
26308
26570
|
var c02 = compareFunc(v0, v2);
|
|
26309
|
-
if (c02
|
|
26310
|
-
// v2
|
|
26571
|
+
if (c02 > 0) {
|
|
26572
|
+
// v2 < v0.
|
|
26311
26573
|
var tmp1 = v0;
|
|
26312
26574
|
v0 = v2;
|
|
26313
26575
|
v2 = v1;
|
|
26314
26576
|
v1 = tmp1;
|
|
26577
|
+
swapFlag = true;
|
|
26315
26578
|
} else {
|
|
26316
|
-
//
|
|
26579
|
+
// v2 >= v0
|
|
26317
26580
|
var c12 = compareFunc(v1, v2);
|
|
26318
26581
|
if (c12 > 0) {
|
|
26319
26582
|
// v0 <= v2 < v1
|
|
26320
26583
|
var tmp2 = v1;
|
|
26321
26584
|
v1 = v2;
|
|
26322
26585
|
v2 = tmp2;
|
|
26586
|
+
swapFlag = true;
|
|
26323
26587
|
}
|
|
26324
26588
|
}
|
|
26325
26589
|
// v0 <= v1 <= v2
|
|
26326
|
-
a[from] = v0;
|
|
26327
|
-
a[to - 1] = v2;
|
|
26328
|
-
var pivot = v1;
|
|
26329
26590
|
var low_end = from + 1; // Upper bound of elements lower than pivot.
|
|
26330
26591
|
var high_start = to - 1; // Lower bound of elements greater than pivot.
|
|
26331
|
-
|
|
26332
|
-
|
|
26592
|
+
var pivot = v2;
|
|
26593
|
+
if (swapFlag) {
|
|
26594
|
+
a[from] = v0;
|
|
26595
|
+
a[to - 1] = v2;
|
|
26596
|
+
pivot = v1;
|
|
26597
|
+
a[third_index] = a[low_end];
|
|
26598
|
+
a[low_end] = pivot;
|
|
26599
|
+
}
|
|
26333
26600
|
// From low_end to i are elements equal to pivot.
|
|
26334
26601
|
// From i to high_start are elements that haven't been compared yet.
|
|
26335
26602
|
partition: for(var i = low_end + 1; i < high_start; i++){
|
|
@@ -26384,12 +26651,38 @@
|
|
|
26384
26651
|
/**
|
|
26385
26652
|
* @internal
|
|
26386
26653
|
*/ RenderQueue._compareFromNearToFar = function _compareFromNearToFar(a, b) {
|
|
26387
|
-
|
|
26654
|
+
var dataA = a.data;
|
|
26655
|
+
var dataB = b.data;
|
|
26656
|
+
var componentA = dataA.component;
|
|
26657
|
+
var componentB = dataB.component;
|
|
26658
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
26659
|
+
if (priorityOrder !== 0) {
|
|
26660
|
+
return priorityOrder;
|
|
26661
|
+
}
|
|
26662
|
+
// make suer from the same renderer.
|
|
26663
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
26664
|
+
return dataA.material._priority - dataB.material._priority || componentA._distanceForSort - componentB._distanceForSort;
|
|
26665
|
+
} else {
|
|
26666
|
+
return componentA._distanceForSort - componentB._distanceForSort;
|
|
26667
|
+
}
|
|
26388
26668
|
};
|
|
26389
26669
|
/**
|
|
26390
26670
|
* @internal
|
|
26391
26671
|
*/ RenderQueue._compareFromFarToNear = function _compareFromFarToNear(a, b) {
|
|
26392
|
-
|
|
26672
|
+
var dataA = a.data;
|
|
26673
|
+
var dataB = b.data;
|
|
26674
|
+
var componentA = dataA.component;
|
|
26675
|
+
var componentB = dataB.component;
|
|
26676
|
+
var priorityOrder = componentA.priority - componentB.priority;
|
|
26677
|
+
if (priorityOrder !== 0) {
|
|
26678
|
+
return priorityOrder;
|
|
26679
|
+
}
|
|
26680
|
+
// make suer from the same renderer.
|
|
26681
|
+
if (componentA.instanceId === componentB.instanceId) {
|
|
26682
|
+
return dataA.material._priority - dataB.material._priority || componentB._distanceForSort - componentA._distanceForSort;
|
|
26683
|
+
} else {
|
|
26684
|
+
return componentB._distanceForSort - componentA._distanceForSort;
|
|
26685
|
+
}
|
|
26393
26686
|
};
|
|
26394
26687
|
return RenderQueue;
|
|
26395
26688
|
}();
|
|
@@ -28414,12 +28707,6 @@
|
|
|
28414
28707
|
return this._shader;
|
|
28415
28708
|
},
|
|
28416
28709
|
set: function set(value) {
|
|
28417
|
-
var refCount = this._getReferCount();
|
|
28418
|
-
if (refCount > 0) {
|
|
28419
|
-
var _this__shader;
|
|
28420
|
-
(_this__shader = this._shader) == null ? void 0 : _this__shader._addReferCount(-refCount);
|
|
28421
|
-
value._addReferCount(refCount);
|
|
28422
|
-
}
|
|
28423
28710
|
this._shader = value;
|
|
28424
28711
|
var renderStates = this._renderStates;
|
|
28425
28712
|
var lastStatesCount = renderStates.length;
|
|
@@ -32223,7 +32510,7 @@
|
|
|
32223
32510
|
if (!material) {
|
|
32224
32511
|
return;
|
|
32225
32512
|
}
|
|
32226
|
-
if (material.destroyed
|
|
32513
|
+
if (material.destroyed) {
|
|
32227
32514
|
material = this.engine._particleMagentaMaterial;
|
|
32228
32515
|
}
|
|
32229
32516
|
var renderData = this._engine._renderDataPool.getFromPool();
|
|
@@ -42909,7 +43196,7 @@
|
|
|
42909
43196
|
};
|
|
42910
43197
|
_proto._makeSprite = function _makeSprite(engine, config, texture) {
|
|
42911
43198
|
// Generate a SpriteAtlas object.
|
|
42912
|
-
var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
|
|
43199
|
+
var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
|
|
42913
43200
|
var sprite = new Sprite(engine, texture, region ? this._tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? this._tempVec2.set(pivot.x, pivot.y) : undefined, border ? this._tempVec4.set(border.x, border.y, border.z, border.w) : undefined, config.name);
|
|
42914
43201
|
if (texture) {
|
|
42915
43202
|
var invW = 1 / texture.width;
|
|
@@ -42921,6 +43208,8 @@
|
|
|
42921
43208
|
}
|
|
42922
43209
|
config.atlasRotated && (sprite.atlasRotated = true);
|
|
42923
43210
|
}
|
|
43211
|
+
isNaN(width) || (sprite.width = width);
|
|
43212
|
+
isNaN(height) || (sprite.height = height);
|
|
42924
43213
|
return sprite;
|
|
42925
43214
|
};
|
|
42926
43215
|
return SpriteAtlasLoader;
|
|
@@ -42938,26 +43227,39 @@
|
|
|
42938
43227
|
var _proto = SpriteLoader.prototype;
|
|
42939
43228
|
_proto.load = function load(item, resourceManager) {
|
|
42940
43229
|
var _this = this;
|
|
42941
|
-
return
|
|
42942
|
-
|
|
42943
|
-
|
|
42944
|
-
|
|
42945
|
-
|
|
42946
|
-
|
|
42947
|
-
|
|
42948
|
-
|
|
42949
|
-
|
|
42950
|
-
|
|
42951
|
-
|
|
42952
|
-
.getResourceByRef(data.texture).then(function(texture) {
|
|
42953
|
-
resolve(new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border));
|
|
42954
|
-
}).catch(reject);
|
|
42955
|
-
} else {
|
|
42956
|
-
resolve(new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
|
|
42957
|
-
}
|
|
42958
|
-
}).catch(reject);
|
|
43230
|
+
return this.request(item.url, _extends({}, item, {
|
|
43231
|
+
type: "json"
|
|
43232
|
+
})).then(function(data) {
|
|
43233
|
+
return data.belongToAtlas ? _this._loadFromAtlas(resourceManager, data) : _this._loadFromTexture(resourceManager, data);
|
|
43234
|
+
});
|
|
43235
|
+
};
|
|
43236
|
+
_proto._loadFromAtlas = function _loadFromAtlas(resourceManager, data) {
|
|
43237
|
+
var _this = this;
|
|
43238
|
+
return resourceManager // @ts-ignore
|
|
43239
|
+
.getResourceByRef(data.belongToAtlas).then(function(atlas) {
|
|
43240
|
+
return atlas.getSprite(data.fullPath) || _this._loadFromTexture(resourceManager, data);
|
|
42959
43241
|
});
|
|
42960
43242
|
};
|
|
43243
|
+
_proto._loadFromTexture = function _loadFromTexture(resourceManager, data) {
|
|
43244
|
+
if (data.texture) {
|
|
43245
|
+
return resourceManager // @ts-ignore
|
|
43246
|
+
.getResourceByRef(data.texture).then(function(texture) {
|
|
43247
|
+
var sprite = new Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
|
|
43248
|
+
var width = data.width, height = data.height;
|
|
43249
|
+
isNaN(width) || (sprite.width = width);
|
|
43250
|
+
isNaN(height) || (sprite.height = height);
|
|
43251
|
+
return sprite;
|
|
43252
|
+
});
|
|
43253
|
+
} else {
|
|
43254
|
+
return new AssetPromise(function(resolve) {
|
|
43255
|
+
var sprite = new Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
|
|
43256
|
+
var width = data.width, height = data.height;
|
|
43257
|
+
isNaN(width) || (sprite.width = width);
|
|
43258
|
+
isNaN(height) || (sprite.height = height);
|
|
43259
|
+
resolve(sprite);
|
|
43260
|
+
});
|
|
43261
|
+
}
|
|
43262
|
+
};
|
|
42961
43263
|
return SpriteLoader;
|
|
42962
43264
|
}(Loader);
|
|
42963
43265
|
SpriteLoader = __decorate([
|
|
@@ -43733,7 +44035,7 @@
|
|
|
43733
44035
|
], GALACEAN_animation_event);
|
|
43734
44036
|
|
|
43735
44037
|
//@ts-ignore
|
|
43736
|
-
var version = "0.0.0-experimental-
|
|
44038
|
+
var version = "0.0.0-experimental-renderSort.0";
|
|
43737
44039
|
console.log("Galacean engine version: " + version);
|
|
43738
44040
|
for(var key in CoreObjects){
|
|
43739
44041
|
Loader.registerClass(key, CoreObjects[key]);
|