@galacean/engine-core 0.0.0-experimental-shaderlab.0 → 0.0.0-experimental-uploadSameBuffer.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 +328 -91
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +328 -91
- package/dist/module.js +328 -91
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/mesh/PrimitiveMesh.d.ts +22 -0
- package/types/physics/PhysicsManager.d.ts +2 -4
- package/types/shader/Shader.d.ts +2 -15
- package/types/2d/data/RenderData2D.d.ts +0 -1
- package/types/RenderPipeline/MeshRenderElement.d.ts +0 -19
- package/types/RenderPipeline/SpriteElement.d.ts +0 -15
- package/types/RenderPipeline/SpriteMaskElement.d.ts +0 -12
- package/types/RenderPipeline/TextRenderElement.d.ts +0 -8
- package/types/animation/AnimatorLayerMask.d.ts +0 -45
- package/types/animation/LayerPathMask.d.ts +0 -16
- package/types/animation/animationCurve/AnimationStringCurve.d.ts +0 -7
- package/types/asset/IRefObject.d.ts +0 -2
- package/types/asset/RefObject.d.ts +0 -27
- package/types/base/Event.d.ts +0 -24
- package/types/base/Util.d.ts +0 -14
- package/types/enums/CameraType.d.ts +0 -1
- package/types/xr/XRManager.d.ts +0 -5
- /package/types/RenderPipeline/{index.d.ts → Index.d.ts} +0 -0
package/dist/main.js
CHANGED
|
@@ -2036,7 +2036,8 @@ var Logger = {
|
|
|
2036
2036
|
_proto._createFontAtlas = function _createFontAtlas() {
|
|
2037
2037
|
var _this = this, engine = _this._engine;
|
|
2038
2038
|
var fontAtlas = new FontAtlas(engine);
|
|
2039
|
-
var texture = new Texture2D(engine, 256, 256);
|
|
2039
|
+
var texture = new Texture2D(engine, 256, 256, exports.TextureFormat.R8G8B8A8, false);
|
|
2040
|
+
texture.filterMode = exports.TextureFilterMode.Point;
|
|
2040
2041
|
fontAtlas.texture = texture;
|
|
2041
2042
|
fontAtlas.isGCIgnored = texture.isGCIgnored = true;
|
|
2042
2043
|
this._fontAtlases.push(fontAtlas);
|
|
@@ -5979,7 +5980,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
5979
5980
|
_this = ShaderPart1.call(this) || this;
|
|
5980
5981
|
/** @internal */ _this._shaderPassId = 0;
|
|
5981
5982
|
/** @internal */ _this._renderStateDataMap = {};
|
|
5982
|
-
/** @internal */ _this._shaderProgramPools = [];
|
|
5983
5983
|
_this._shaderPassId = ShaderPass._shaderPassCounter++;
|
|
5984
5984
|
if (typeof fragmentSourceOrTags === "string") {
|
|
5985
5985
|
_this._name = nameOrVertexSource;
|
|
@@ -6033,15 +6033,6 @@ var ShaderFactory = /*#__PURE__*/ function() {
|
|
|
6033
6033
|
shaderProgramPool.cache(shaderProgram);
|
|
6034
6034
|
return shaderProgram;
|
|
6035
6035
|
};
|
|
6036
|
-
/**
|
|
6037
|
-
* @internal
|
|
6038
|
-
*/ _proto._destroy = function _destroy() {
|
|
6039
|
-
var shaderProgramPools = this._shaderProgramPools;
|
|
6040
|
-
for(var i = 0, n = shaderProgramPools.length; i < n; i++){
|
|
6041
|
-
shaderProgramPools[i]._destroy();
|
|
6042
|
-
}
|
|
6043
|
-
shaderProgramPools.length = 0;
|
|
6044
|
-
};
|
|
6045
6036
|
return ShaderPass;
|
|
6046
6037
|
}(ShaderPart);
|
|
6047
6038
|
(function() {
|
|
@@ -6672,8 +6663,6 @@ __decorate([
|
|
|
6672
6663
|
*/ var Shader = /*#__PURE__*/ function() {
|
|
6673
6664
|
function Shader(name, subShaders) {
|
|
6674
6665
|
this.name = name;
|
|
6675
|
-
this._refCount = 0;
|
|
6676
|
-
this._destroyed = false;
|
|
6677
6666
|
this.name = name;
|
|
6678
6667
|
this._subShaders = subShaders;
|
|
6679
6668
|
}
|
|
@@ -6693,46 +6682,20 @@ __decorate([
|
|
|
6693
6682
|
for(var i = 0, n = macros.length; i < n; i++){
|
|
6694
6683
|
compileMacros.enable(ShaderMacro.getByName(macros[i]));
|
|
6695
6684
|
}
|
|
6696
|
-
var isValid = false;
|
|
6697
6685
|
var subShaders = this._subShaders;
|
|
6698
6686
|
for(var i1 = 0, n1 = subShaders.length; i1 < n1; i1++){
|
|
6687
|
+
var isValid = void 0;
|
|
6699
6688
|
var passes = subShaders[i1].passes;
|
|
6700
6689
|
for(var j = 0, m = passes.length; j < m; j++){
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
};
|
|
6707
|
-
/**
|
|
6708
|
-
* Destroy the shader.
|
|
6709
|
-
* @param force - Whether to force the destruction, if it is false, refCount = 0 can be released successfully.
|
|
6710
|
-
* @returns Whether the release was successful.
|
|
6711
|
-
*/ _proto.destroy = function destroy(force) {
|
|
6712
|
-
if (force === void 0) force = false;
|
|
6713
|
-
if (!force && this._refCount !== 0) {
|
|
6714
|
-
return false;
|
|
6715
|
-
}
|
|
6716
|
-
var subShaders = this._subShaders;
|
|
6717
|
-
for(var i = 0, n = subShaders.length; i < n; i++){
|
|
6718
|
-
var passes = subShaders[i].passes;
|
|
6719
|
-
for(var j = 0, m = passes.length; j < m; j++){
|
|
6720
|
-
passes[j]._destroy();
|
|
6690
|
+
if (isValid === undefined) {
|
|
6691
|
+
isValid = passes[j]._getShaderProgram(engine, compileMacros).isValid;
|
|
6692
|
+
} else {
|
|
6693
|
+
isValid && (isValid = passes[j]._getShaderProgram(engine, compileMacros).isValid);
|
|
6694
|
+
}
|
|
6721
6695
|
}
|
|
6696
|
+
if (isValid) return true;
|
|
6722
6697
|
}
|
|
6723
|
-
|
|
6724
|
-
this._destroyed = true;
|
|
6725
|
-
return true;
|
|
6726
|
-
};
|
|
6727
|
-
/**
|
|
6728
|
-
* @internal
|
|
6729
|
-
*/ _proto._getReferCount = function _getReferCount() {
|
|
6730
|
-
return this._refCount;
|
|
6731
|
-
};
|
|
6732
|
-
/**
|
|
6733
|
-
* @internal
|
|
6734
|
-
*/ _proto._addReferCount = function _addReferCount(value) {
|
|
6735
|
-
this._refCount += value;
|
|
6698
|
+
return false;
|
|
6736
6699
|
};
|
|
6737
6700
|
Shader.create = function create(nameOrShaderSource, vertexSourceOrShaderPassesOrSubShaders, fragmentSource) {
|
|
6738
6701
|
var shader;
|
|
@@ -6919,14 +6882,6 @@ __decorate([
|
|
|
6919
6882
|
*/ function get() {
|
|
6920
6883
|
return this._subShaders;
|
|
6921
6884
|
}
|
|
6922
|
-
},
|
|
6923
|
-
{
|
|
6924
|
-
key: "destroyed",
|
|
6925
|
-
get: /**
|
|
6926
|
-
* Whether it has been destroyed.
|
|
6927
|
-
*/ function get() {
|
|
6928
|
-
return this._destroyed;
|
|
6929
|
-
}
|
|
6930
6885
|
}
|
|
6931
6886
|
]);
|
|
6932
6887
|
return Shader;
|
|
@@ -8055,6 +8010,9 @@ SimpleSpriteAssembler = __decorate([
|
|
|
8055
8010
|
__decorate([
|
|
8056
8011
|
assignmentClone
|
|
8057
8012
|
], SpriteMask.prototype, "influenceLayers", void 0);
|
|
8013
|
+
__decorate([
|
|
8014
|
+
ignoreClone
|
|
8015
|
+
], SpriteMask.prototype, "_verticesData", void 0);
|
|
8058
8016
|
__decorate([
|
|
8059
8017
|
ignoreClone
|
|
8060
8018
|
], SpriteMask.prototype, "_sprite", void 0);
|
|
@@ -9187,7 +9145,7 @@ var BlendShapeFrameDirty;
|
|
|
9187
9145
|
if (!material) {
|
|
9188
9146
|
continue;
|
|
9189
9147
|
}
|
|
9190
|
-
if (material.destroyed
|
|
9148
|
+
if (material.destroyed) {
|
|
9191
9149
|
material = this.engine._meshMagentaMaterial;
|
|
9192
9150
|
}
|
|
9193
9151
|
var renderData = meshRenderDataPool.getFromPool();
|
|
@@ -10842,6 +10800,10 @@ var VertexElementIndex;
|
|
|
10842
10800
|
var sphereInfo = primitiveInfo;
|
|
10843
10801
|
PrimitiveMesh._setSphereData(this.resource, sphereInfo.radius, sphereInfo.segments, sphereInfo.noLongerAccessible, true, sphereInfo.vertexBuffer);
|
|
10844
10802
|
break;
|
|
10803
|
+
case 7:
|
|
10804
|
+
var CCSphereInfo = primitiveInfo;
|
|
10805
|
+
PrimitiveMesh._setSubdivisionSurfaceSphereData(this.resource, CCSphereInfo.radius, CCSphereInfo.step, CCSphereInfo.noLongerAccessible, true, CCSphereInfo.vertexBuffer);
|
|
10806
|
+
break;
|
|
10845
10807
|
case 1:
|
|
10846
10808
|
var cuboidInfo = primitiveInfo;
|
|
10847
10809
|
PrimitiveMesh._setCuboidData(this.resource, cuboidInfo.width, cuboidInfo.height, cuboidInfo.depth, cuboidInfo.noLongerAccessible, true, cuboidInfo.vertexBuffer);
|
|
@@ -10879,6 +10841,7 @@ var PrimitiveType;
|
|
|
10879
10841
|
PrimitiveType[PrimitiveType["Torus"] = 4] = "Torus";
|
|
10880
10842
|
PrimitiveType[PrimitiveType["Cone"] = 5] = "Cone";
|
|
10881
10843
|
PrimitiveType[PrimitiveType["Capsule"] = 6] = "Capsule";
|
|
10844
|
+
PrimitiveType[PrimitiveType["CCSphere"] = 7] = "CCSphere";
|
|
10882
10845
|
})(PrimitiveType || (PrimitiveType = {}));
|
|
10883
10846
|
/**
|
|
10884
10847
|
* @internal
|
|
@@ -10900,6 +10863,19 @@ var PrimitiveType;
|
|
|
10900
10863
|
}
|
|
10901
10864
|
return SphereRestoreInfo;
|
|
10902
10865
|
}(PrimitiveRestoreInfo);
|
|
10866
|
+
/**
|
|
10867
|
+
* @internal
|
|
10868
|
+
*/ var SubdivisionSurfaceSphereRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
|
|
10869
|
+
_inherits(SubdivisionSurfaceSphereRestoreInfo, PrimitiveRestoreInfo);
|
|
10870
|
+
function SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible) {
|
|
10871
|
+
var _this;
|
|
10872
|
+
_this = PrimitiveRestoreInfo.call(this, 7, vertexBuffer, noLongerAccessible) || this;
|
|
10873
|
+
_this.radius = radius;
|
|
10874
|
+
_this.step = step;
|
|
10875
|
+
return _this;
|
|
10876
|
+
}
|
|
10877
|
+
return SubdivisionSurfaceSphereRestoreInfo;
|
|
10878
|
+
}(PrimitiveRestoreInfo);
|
|
10903
10879
|
/**
|
|
10904
10880
|
* @internal
|
|
10905
10881
|
*/ var CuboidRestoreInfo = /*#__PURE__*/ function(PrimitiveRestoreInfo) {
|
|
@@ -11014,6 +10990,24 @@ var PrimitiveType;
|
|
|
11014
10990
|
return sphereMesh;
|
|
11015
10991
|
};
|
|
11016
10992
|
/**
|
|
10993
|
+
* Create a sphere mesh by implementing Catmull-Clark Surface Subdivision Algorithm.
|
|
10994
|
+
* Max step is limited to 6.
|
|
10995
|
+
* @param engine - Engine
|
|
10996
|
+
* @param radius - Sphere radius
|
|
10997
|
+
* @param step - Number of subdiv steps
|
|
10998
|
+
* @param noLongerAccessible - No longer access the vertices of the mesh after creation
|
|
10999
|
+
* @returns Sphere model mesh
|
|
11000
|
+
*/ PrimitiveMesh.createSubdivisionSurfaceSphere = function createSubdivisionSurfaceSphere(engine, radius, step, noLongerAccessible) {
|
|
11001
|
+
if (radius === void 0) radius = 0.5;
|
|
11002
|
+
if (step === void 0) step = 3;
|
|
11003
|
+
if (noLongerAccessible === void 0) noLongerAccessible = true;
|
|
11004
|
+
var sphereMesh = new ModelMesh(engine);
|
|
11005
|
+
PrimitiveMesh._setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, false);
|
|
11006
|
+
var vertexBuffer = sphereMesh.vertexBufferBindings[0].buffer;
|
|
11007
|
+
engine.resourceManager.addContentRestorer(new PrimitiveMeshRestorer(sphereMesh, new SubdivisionSurfaceSphereRestoreInfo(radius, step, vertexBuffer, noLongerAccessible)));
|
|
11008
|
+
return sphereMesh;
|
|
11009
|
+
};
|
|
11010
|
+
/**
|
|
11017
11011
|
* Create a cuboid mesh.
|
|
11018
11012
|
* @param engine - Engine
|
|
11019
11013
|
* @param width - Cuboid width
|
|
@@ -11143,6 +11137,90 @@ var PrimitiveType;
|
|
|
11143
11137
|
};
|
|
11144
11138
|
/**
|
|
11145
11139
|
* @internal
|
|
11140
|
+
*/ PrimitiveMesh._setSubdivisionSurfaceSphereData = function _setSubdivisionSurfaceSphereData(sphereMesh, radius, step, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
|
|
11141
|
+
// Max step is limited to 6. Because 7 step will generate a single mesh with over 98306 vertices
|
|
11142
|
+
step = engineMath.MathUtil.clamp(Math.floor(step), 1, 6);
|
|
11143
|
+
var positions = new Float32Array(3 * (6 * Math.pow(4, step) + 2));
|
|
11144
|
+
var cells = new Float32Array(24 * Math.pow(4, step));
|
|
11145
|
+
PrimitiveMesh._subdiveCatmullClark(step, positions, cells);
|
|
11146
|
+
var positionCount = positions.length / 3;
|
|
11147
|
+
var cellsCount = cells.length / 4;
|
|
11148
|
+
var poleOffset = positionCount + Math.pow(2, step + 1) - 1;
|
|
11149
|
+
// 16 extra vertices for pole uv
|
|
11150
|
+
// 2 vertices at each pole are idle
|
|
11151
|
+
var vertexCount = poleOffset + 16;
|
|
11152
|
+
var vertices = new Float32Array(vertexCount * 8);
|
|
11153
|
+
var indices = PrimitiveMesh._generateIndices(sphereMesh.engine, positionCount, cellsCount * 6);
|
|
11154
|
+
var seamCount = 0;
|
|
11155
|
+
var seamVertices = {};
|
|
11156
|
+
// Get normals, uvs, and scale to radius
|
|
11157
|
+
for(var i = 0; i < positionCount; i++){
|
|
11158
|
+
var offset = 3 * i;
|
|
11159
|
+
var x = positions[offset];
|
|
11160
|
+
var y = positions[offset + 1];
|
|
11161
|
+
var z = positions[offset + 2];
|
|
11162
|
+
var reciprocalLength = 1 / Math.sqrt(x * x + y * y + z * z);
|
|
11163
|
+
x *= reciprocalLength;
|
|
11164
|
+
y *= reciprocalLength;
|
|
11165
|
+
z *= reciprocalLength;
|
|
11166
|
+
offset = 8 * i;
|
|
11167
|
+
vertices[offset] = x * radius;
|
|
11168
|
+
vertices[offset + 1] = y * radius;
|
|
11169
|
+
vertices[offset + 2] = z * radius;
|
|
11170
|
+
vertices[offset + 3] = x;
|
|
11171
|
+
vertices[offset + 4] = y;
|
|
11172
|
+
vertices[offset + 5] = z;
|
|
11173
|
+
vertices[offset + 6] = (Math.PI - Math.atan2(z, x)) / (2 * Math.PI);
|
|
11174
|
+
vertices[offset + 7] = Math.acos(y) / Math.PI;
|
|
11175
|
+
if (vertices[offset + 6] === 0) {
|
|
11176
|
+
// Generate seam vertex
|
|
11177
|
+
var seamOffset = 8 * (positionCount + seamCount++);
|
|
11178
|
+
vertices.set(vertices.subarray(offset, offset + 8), seamOffset);
|
|
11179
|
+
vertices[seamOffset + 6] = 1.0;
|
|
11180
|
+
// Cache seam vertex
|
|
11181
|
+
seamVertices[offset / 8] = seamOffset / 8;
|
|
11182
|
+
}
|
|
11183
|
+
}
|
|
11184
|
+
// Get indices
|
|
11185
|
+
var offset1 = 0;
|
|
11186
|
+
this._spherePoleIdx = 0;
|
|
11187
|
+
for(var i1 = 0; i1 < cellsCount; i1++){
|
|
11188
|
+
var idx = 4 * i1;
|
|
11189
|
+
var indexA = cells[idx];
|
|
11190
|
+
var indexB = cells[idx + 1];
|
|
11191
|
+
var indexC = cells[idx + 2];
|
|
11192
|
+
var indexD = cells[idx + 3];
|
|
11193
|
+
// Handle seam by replacing vertex index to seam vertex index if necessary
|
|
11194
|
+
var floatIndexA = 8 * indexA;
|
|
11195
|
+
var floatIndexB = 8 * indexB;
|
|
11196
|
+
var floatIndexC = 8 * indexC;
|
|
11197
|
+
var floatIndexD = 8 * indexD;
|
|
11198
|
+
// If center Z is negative
|
|
11199
|
+
if (vertices[floatIndexA + 2] + vertices[floatIndexB + 2] + vertices[floatIndexC + 2] < 0) {
|
|
11200
|
+
vertices[floatIndexA + 6] === 0 && (indexA = seamVertices[indexA]);
|
|
11201
|
+
vertices[floatIndexB + 6] === 0 && (indexB = seamVertices[indexB]);
|
|
11202
|
+
vertices[floatIndexC + 6] === 0 && (indexC = seamVertices[indexC]);
|
|
11203
|
+
vertices[floatIndexD + 6] === 0 && (indexD = seamVertices[indexD]);
|
|
11204
|
+
}
|
|
11205
|
+
indices[offset1] = indexA;
|
|
11206
|
+
indices[offset1 + 1] = indexB;
|
|
11207
|
+
indices[offset1 + 2] = indexC;
|
|
11208
|
+
this._generateAndReplacePoleUV(indices, vertices, offset1, poleOffset);
|
|
11209
|
+
indices[offset1 + 3] = indexA;
|
|
11210
|
+
indices[offset1 + 4] = indexC;
|
|
11211
|
+
indices[offset1 + 5] = indexD;
|
|
11212
|
+
this._generateAndReplacePoleUV(indices, vertices, offset1 + 3, poleOffset);
|
|
11213
|
+
offset1 += 6;
|
|
11214
|
+
}
|
|
11215
|
+
if (!isRestoreMode) {
|
|
11216
|
+
var bounds = sphereMesh.bounds;
|
|
11217
|
+
bounds.min.set(-radius, -radius, -radius);
|
|
11218
|
+
bounds.max.set(radius, radius, radius);
|
|
11219
|
+
}
|
|
11220
|
+
PrimitiveMesh._initialize(sphereMesh, vertices, indices, noLongerAccessible, isRestoreMode, restoreVertexBuffer);
|
|
11221
|
+
};
|
|
11222
|
+
/**
|
|
11223
|
+
* @internal
|
|
11146
11224
|
*/ PrimitiveMesh._setSphereData = function _setSphereData(sphereMesh, radius, segments, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
|
|
11147
11225
|
segments = Math.max(2, Math.floor(segments));
|
|
11148
11226
|
var count = segments + 1;
|
|
@@ -11203,6 +11281,135 @@ var PrimitiveType;
|
|
|
11203
11281
|
};
|
|
11204
11282
|
/**
|
|
11205
11283
|
* @internal
|
|
11284
|
+
*/ PrimitiveMesh._subdiveCatmullClark = function _subdiveCatmullClark(step, positions, cells) {
|
|
11285
|
+
var edges = new Map();
|
|
11286
|
+
var faces = new Array();
|
|
11287
|
+
positions.set(PrimitiveMesh._sphereSeedPositions);
|
|
11288
|
+
cells.set(PrimitiveMesh._sphereSeedCells);
|
|
11289
|
+
for(var i = 0; i < step; i++){
|
|
11290
|
+
var cellCount = 6 * Math.pow(4, i);
|
|
11291
|
+
var positionCount = 4 * cellCount + 2;
|
|
11292
|
+
edges.clear();
|
|
11293
|
+
faces.length = 0;
|
|
11294
|
+
// Get cell face's facePoint
|
|
11295
|
+
for(var j = 0; j < cellCount; j++){
|
|
11296
|
+
var face = faces[j] = {
|
|
11297
|
+
facePoint: new engineMath.Vector3(),
|
|
11298
|
+
adjacentEdges: new Array(4)
|
|
11299
|
+
};
|
|
11300
|
+
// Get cell's edgePoint
|
|
11301
|
+
for(var k = 0; k < 4; k++){
|
|
11302
|
+
var offset = 3 * cells[4 * j + k];
|
|
11303
|
+
face.facePoint.x += 0.25 * positions[offset];
|
|
11304
|
+
face.facePoint.y += 0.25 * positions[offset + 1];
|
|
11305
|
+
face.facePoint.z += 0.25 * positions[offset + 2];
|
|
11306
|
+
}
|
|
11307
|
+
// Get cell edges
|
|
11308
|
+
for(var k1 = 0; k1 < 4; k1++){
|
|
11309
|
+
var vertexIdxA = cells[4 * j + k1];
|
|
11310
|
+
var vertexIdxB = cells[4 * j + (k1 + 1) % 4];
|
|
11311
|
+
var edgeIdxKey = Math.min(vertexIdxA, vertexIdxB) * positionCount + Math.max(vertexIdxA, vertexIdxB);
|
|
11312
|
+
if (!edges.has(edgeIdxKey)) {
|
|
11313
|
+
var edge = {
|
|
11314
|
+
edgePoint: new engineMath.Vector3(),
|
|
11315
|
+
edgePointIndex: undefined
|
|
11316
|
+
};
|
|
11317
|
+
var offsetA = 3 * vertexIdxA;
|
|
11318
|
+
var offsetB = 3 * vertexIdxB;
|
|
11319
|
+
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]));
|
|
11320
|
+
edges.set(edgeIdxKey, edge);
|
|
11321
|
+
}
|
|
11322
|
+
var edge1 = edges.get(edgeIdxKey);
|
|
11323
|
+
face.adjacentEdges[k1] = edge1;
|
|
11324
|
+
var edgePoint = edge1.edgePoint;
|
|
11325
|
+
var facePoint = face.facePoint;
|
|
11326
|
+
edgePoint.x += 0.25 * facePoint.x;
|
|
11327
|
+
edgePoint.y += 0.25 * facePoint.y;
|
|
11328
|
+
edgePoint.z += 0.25 * facePoint.z;
|
|
11329
|
+
}
|
|
11330
|
+
}
|
|
11331
|
+
var prePointCount = cellCount + 2;
|
|
11332
|
+
var edgePointOffset = prePointCount + cellCount;
|
|
11333
|
+
var pointIdx = 0;
|
|
11334
|
+
this._sphereEdgeIdx = 0;
|
|
11335
|
+
var preCells = cells.slice(0, 4 * cellCount);
|
|
11336
|
+
// Get New positions, which consists of updated positions of existing points, face points and edge points
|
|
11337
|
+
for(var j1 = 0; j1 < cellCount; j1++){
|
|
11338
|
+
// Add face point to new positions
|
|
11339
|
+
var face1 = faces[j1];
|
|
11340
|
+
face1.facePoint.copyToArray(positions, 3 * (prePointCount + j1));
|
|
11341
|
+
// Get the face point index
|
|
11342
|
+
var ic = prePointCount + j1;
|
|
11343
|
+
var id = void 0, ib = void 0, temp = void 0;
|
|
11344
|
+
// ia -- id -- ia
|
|
11345
|
+
// | | |
|
|
11346
|
+
// ib -- ic -- ib
|
|
11347
|
+
// | | |
|
|
11348
|
+
// ia -- id -- ia
|
|
11349
|
+
for(var k2 = 0; k2 < 4; k2++){
|
|
11350
|
+
// Get the updated existing point index
|
|
11351
|
+
var ia = preCells[pointIdx++];
|
|
11352
|
+
// ib and id share four edge points in one cell
|
|
11353
|
+
switch(k2){
|
|
11354
|
+
case 0:
|
|
11355
|
+
{
|
|
11356
|
+
var edgeB = face1.adjacentEdges[k2 % 4];
|
|
11357
|
+
var edgeD = face1.adjacentEdges[(k2 + 3) % 4];
|
|
11358
|
+
ib = this._calculateEdgeIndex(positions, edgeB, edgePointOffset);
|
|
11359
|
+
id = this._calculateEdgeIndex(positions, edgeD, edgePointOffset);
|
|
11360
|
+
temp = id;
|
|
11361
|
+
break;
|
|
11362
|
+
}
|
|
11363
|
+
case 1:
|
|
11364
|
+
case 2:
|
|
11365
|
+
{
|
|
11366
|
+
var edgeB1 = face1.adjacentEdges[k2 % 4];
|
|
11367
|
+
id = ib;
|
|
11368
|
+
ib = this._calculateEdgeIndex(positions, edgeB1, edgePointOffset);
|
|
11369
|
+
break;
|
|
11370
|
+
}
|
|
11371
|
+
case 3:
|
|
11372
|
+
{
|
|
11373
|
+
id = ib;
|
|
11374
|
+
ib = temp;
|
|
11375
|
+
break;
|
|
11376
|
+
}
|
|
11377
|
+
}
|
|
11378
|
+
var idx = 4 * (4 * j1 + k2);
|
|
11379
|
+
cells[idx] = ia;
|
|
11380
|
+
cells[idx + 1] = ib;
|
|
11381
|
+
cells[idx + 2] = ic;
|
|
11382
|
+
cells[idx + 3] = id;
|
|
11383
|
+
}
|
|
11384
|
+
}
|
|
11385
|
+
}
|
|
11386
|
+
};
|
|
11387
|
+
/**
|
|
11388
|
+
* Duplicate vertices at the poles and adjust their UV coordinates.
|
|
11389
|
+
*/ PrimitiveMesh._generateAndReplacePoleUV = function _generateAndReplacePoleUV(indices, vertices, idx, poleOffset) {
|
|
11390
|
+
var v = vertices[8 * indices[idx] + 7];
|
|
11391
|
+
if (v === 0 || v === 1) {
|
|
11392
|
+
var offset = 8 * indices[idx];
|
|
11393
|
+
var addedOffset = 8 * (poleOffset + this._spherePoleIdx);
|
|
11394
|
+
vertices.set(vertices.subarray(offset, offset + 8), addedOffset);
|
|
11395
|
+
vertices[addedOffset + 6] = 0.5 * (vertices[offset + 6] + vertices[8 * indices[idx + 1] + 6] + vertices[8 * indices[idx + 2] + 6] - 0.5);
|
|
11396
|
+
indices[idx] = poleOffset + this._spherePoleIdx++;
|
|
11397
|
+
}
|
|
11398
|
+
};
|
|
11399
|
+
/**
|
|
11400
|
+
* Get edge point index for subdivision surface sphere.
|
|
11401
|
+
*/ PrimitiveMesh._calculateEdgeIndex = function _calculateEdgeIndex(positions, edge, offset) {
|
|
11402
|
+
if (edge.edgePointIndex !== undefined) {
|
|
11403
|
+
return edge.edgePointIndex;
|
|
11404
|
+
} else {
|
|
11405
|
+
edge.edgePoint.copyToArray(positions, 3 * (offset + PrimitiveMesh._sphereEdgeIdx));
|
|
11406
|
+
var index = offset + PrimitiveMesh._sphereEdgeIdx++;
|
|
11407
|
+
edge.edgePointIndex = index;
|
|
11408
|
+
return index;
|
|
11409
|
+
}
|
|
11410
|
+
};
|
|
11411
|
+
/**
|
|
11412
|
+
* @internal
|
|
11206
11413
|
*/ PrimitiveMesh._setCuboidData = function _setCuboidData(cuboidMesh, width, height, depth, noLongerAccessible, isRestoreMode, restoreVertexBuffer) {
|
|
11207
11414
|
var halfWidth = width / 2;
|
|
11208
11415
|
var halfHeight = height / 2;
|
|
@@ -11832,6 +12039,68 @@ var PrimitiveType;
|
|
|
11832
12039
|
(function() {
|
|
11833
12040
|
PrimitiveMesh._tempVec30 = new engineMath.Vector3();
|
|
11834
12041
|
})();
|
|
12042
|
+
(function() {
|
|
12043
|
+
PrimitiveMesh._sphereSeedPositions = new Float32Array([
|
|
12044
|
+
-1,
|
|
12045
|
+
1,
|
|
12046
|
+
1,
|
|
12047
|
+
-1,
|
|
12048
|
+
-1,
|
|
12049
|
+
1,
|
|
12050
|
+
1,
|
|
12051
|
+
-1,
|
|
12052
|
+
1,
|
|
12053
|
+
1,
|
|
12054
|
+
1,
|
|
12055
|
+
1,
|
|
12056
|
+
1,
|
|
12057
|
+
-1,
|
|
12058
|
+
-1,
|
|
12059
|
+
1,
|
|
12060
|
+
1,
|
|
12061
|
+
-1,
|
|
12062
|
+
-1,
|
|
12063
|
+
-1,
|
|
12064
|
+
-1,
|
|
12065
|
+
-1,
|
|
12066
|
+
1,
|
|
12067
|
+
-1
|
|
12068
|
+
]);
|
|
12069
|
+
})();
|
|
12070
|
+
(function() {
|
|
12071
|
+
PrimitiveMesh._sphereSeedCells = new Float32Array([
|
|
12072
|
+
0,
|
|
12073
|
+
1,
|
|
12074
|
+
2,
|
|
12075
|
+
3,
|
|
12076
|
+
3,
|
|
12077
|
+
2,
|
|
12078
|
+
4,
|
|
12079
|
+
5,
|
|
12080
|
+
5,
|
|
12081
|
+
4,
|
|
12082
|
+
6,
|
|
12083
|
+
7,
|
|
12084
|
+
7,
|
|
12085
|
+
0,
|
|
12086
|
+
3,
|
|
12087
|
+
5,
|
|
12088
|
+
7,
|
|
12089
|
+
6,
|
|
12090
|
+
1,
|
|
12091
|
+
0,
|
|
12092
|
+
6,
|
|
12093
|
+
4,
|
|
12094
|
+
2,
|
|
12095
|
+
1
|
|
12096
|
+
]);
|
|
12097
|
+
})();
|
|
12098
|
+
(function() {
|
|
12099
|
+
PrimitiveMesh._sphereEdgeIdx = 0;
|
|
12100
|
+
})();
|
|
12101
|
+
(function() {
|
|
12102
|
+
PrimitiveMesh._spherePoleIdx = 0;
|
|
12103
|
+
})();
|
|
11835
12104
|
|
|
11836
12105
|
/**
|
|
11837
12106
|
* Mesh skin data, equal glTF skins define
|
|
@@ -12340,8 +12609,8 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
|
|
|
12340
12609
|
}
|
|
12341
12610
|
mesh.addSubMesh(this._getSubMeshFromPool(vertexStartIndex, vertexCount));
|
|
12342
12611
|
batchedQueue[curMeshIndex] = preElement;
|
|
12343
|
-
this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex);
|
|
12344
|
-
this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex);
|
|
12612
|
+
this._vertexBuffers[_flushId].setData(vertices, 0, 0, vertexIndex, exports.SetDataOptions.Discard);
|
|
12613
|
+
this._indiceBuffers[_flushId].setData(indices, 0, 0, indiceIndex, exports.SetDataOptions.Discard);
|
|
12345
12614
|
};
|
|
12346
12615
|
_proto._getSubMeshFromPool = function _getSubMeshFromPool(start, count) {
|
|
12347
12616
|
var subMesh = this._subMeshPool.getFromPool();
|
|
@@ -16403,7 +16672,6 @@ __decorate([
|
|
|
16403
16672
|
if (this._destroyed) return;
|
|
16404
16673
|
ReferResource1.prototype._addReferCount.call(this, value);
|
|
16405
16674
|
this.shaderData._addReferCount(value);
|
|
16406
|
-
this._shader._addReferCount(value);
|
|
16407
16675
|
};
|
|
16408
16676
|
/**
|
|
16409
16677
|
* @override
|
|
@@ -16431,12 +16699,6 @@ __decorate([
|
|
|
16431
16699
|
return this._shader;
|
|
16432
16700
|
},
|
|
16433
16701
|
set: function set(value) {
|
|
16434
|
-
var refCount = this._getReferCount();
|
|
16435
|
-
if (refCount > 0) {
|
|
16436
|
-
var _this__shader;
|
|
16437
|
-
(_this__shader = this._shader) == null ? void 0 : _this__shader._addReferCount(-refCount);
|
|
16438
|
-
value._addReferCount(refCount);
|
|
16439
|
-
}
|
|
16440
16702
|
this._shader = value;
|
|
16441
16703
|
var renderStates = this._renderStates;
|
|
16442
16704
|
var lastStatesCount = renderStates.length;
|
|
@@ -16700,24 +16962,6 @@ var unlitVs = "#define GLSLIFY 1\n#include <common>\n#include <common_vert>\n#in
|
|
|
16700
16962
|
*/ _proto.cache = function cache(shaderProgram) {
|
|
16701
16963
|
this._lastQueryMap[this._lastQueryKey] = shaderProgram;
|
|
16702
16964
|
};
|
|
16703
|
-
/**
|
|
16704
|
-
* @internal
|
|
16705
|
-
*/ _proto._destroy = function _destroy() {
|
|
16706
|
-
this._recursiveDestroy(0, this._cacheMap);
|
|
16707
|
-
this._cacheMap = Object.create(null);
|
|
16708
|
-
};
|
|
16709
|
-
_proto._recursiveDestroy = function _recursiveDestroy(hierarchy, cacheMap) {
|
|
16710
|
-
if (hierarchy === this._cacheHierarchyDepth - 1) {
|
|
16711
|
-
for(var k in cacheMap){
|
|
16712
|
-
cacheMap[k].destroy();
|
|
16713
|
-
}
|
|
16714
|
-
return;
|
|
16715
|
-
}
|
|
16716
|
-
++hierarchy;
|
|
16717
|
-
for(var k1 in cacheMap){
|
|
16718
|
-
this._recursiveDestroy(hierarchy, cacheMap[k1]);
|
|
16719
|
-
}
|
|
16720
|
-
};
|
|
16721
16965
|
_proto._resizeCacheMapHierarchy = function _resizeCacheMapHierarchy(cacheMap, hierarchy, currentHierarchy, increaseHierarchy) {
|
|
16722
16966
|
// Only expand but not shrink
|
|
16723
16967
|
if (hierarchy == currentHierarchy - 1) {
|
|
@@ -19025,7 +19269,6 @@ ShaderPool.init();
|
|
|
19025
19269
|
shaderProgramPools.length = length;
|
|
19026
19270
|
}
|
|
19027
19271
|
shaderProgramPools[index] = pool = new ShaderProgramPool();
|
|
19028
|
-
shaderPass._shaderProgramPools.push(pool);
|
|
19029
19272
|
}
|
|
19030
19273
|
return pool;
|
|
19031
19274
|
};
|
|
@@ -23747,12 +23990,6 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
|
|
|
23747
23990
|
return this._shader;
|
|
23748
23991
|
},
|
|
23749
23992
|
set: function set(value) {
|
|
23750
|
-
var refCount = this._getReferCount();
|
|
23751
|
-
if (refCount > 0) {
|
|
23752
|
-
var _this__shader;
|
|
23753
|
-
(_this__shader = this._shader) == null ? void 0 : _this__shader._addReferCount(-refCount);
|
|
23754
|
-
value._addReferCount(refCount);
|
|
23755
|
-
}
|
|
23756
23993
|
this._shader = value;
|
|
23757
23994
|
var renderStates = this._renderStates;
|
|
23758
23995
|
var lastStatesCount = renderStates.length;
|
|
@@ -27612,7 +27849,7 @@ exports.ParticleStopMode = void 0;
|
|
|
27612
27849
|
if (!material) {
|
|
27613
27850
|
return;
|
|
27614
27851
|
}
|
|
27615
|
-
if (material.destroyed
|
|
27852
|
+
if (material.destroyed) {
|
|
27616
27853
|
material = this.engine._particleMagentaMaterial;
|
|
27617
27854
|
}
|
|
27618
27855
|
var renderData = this._engine._renderDataPool.getFromPool();
|