@galacean/engine 1.2.0-beta.1 → 1.2.0-beta.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/browser.js +143 -125
- package/dist/browser.js.map +1 -0
- package/dist/browser.min.js +2 -1
- package/dist/browser.min.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/miniprogram.js +1 -1
- package/dist/module.js +1 -1
- package/package.json +5 -5
- package/dist/.DS_Store +0 -0
package/dist/browser.js
CHANGED
|
@@ -2242,11 +2242,11 @@
|
|
|
2242
2242
|
var unit = xx + yy + zz + ww;
|
|
2243
2243
|
var test = 2 * (x * w - y * z);
|
|
2244
2244
|
if (test > (1 - MathUtil.zeroTolerance) * unit) {
|
|
2245
|
-
out._x = Math.atan2(2.0 * (w * y - x * z),
|
|
2245
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), xx + ww - yy - zz);
|
|
2246
2246
|
out._y = Math.PI / 2;
|
|
2247
2247
|
out._z = 0;
|
|
2248
2248
|
} else if (test < -(1 - MathUtil.zeroTolerance) * unit) {
|
|
2249
|
-
out._x = Math.atan2(2.0 * (w * y - x * z),
|
|
2249
|
+
out._x = Math.atan2(2.0 * (w * y - x * z), xx + ww - yy - zz);
|
|
2250
2250
|
out._y = -Math.PI / 2;
|
|
2251
2251
|
out._z = 0;
|
|
2252
2252
|
} else {
|
|
@@ -5599,7 +5599,7 @@
|
|
|
5599
5599
|
if (Utils.isBase64Url(relativeUrl)) {
|
|
5600
5600
|
return relativeUrl;
|
|
5601
5601
|
}
|
|
5602
|
-
return relativeUrl ?
|
|
5602
|
+
return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
|
|
5603
5603
|
};
|
|
5604
5604
|
/**
|
|
5605
5605
|
* @internal
|
|
@@ -5742,14 +5742,6 @@
|
|
|
5742
5742
|
});
|
|
5743
5743
|
return result;
|
|
5744
5744
|
};
|
|
5745
|
-
Utils._formatRelativePath = function _formatRelativePath(path) {
|
|
5746
|
-
// For example input is "a/b", "/a/b", "./a/b", "./a/./b", "./a/../a/b", output is "a/b"
|
|
5747
|
-
return path.split("/").filter(Boolean).reduce(function(acc, cur) {
|
|
5748
|
-
if (cur === "..") acc.pop();
|
|
5749
|
-
else if (cur !== ".") acc.push(cur);
|
|
5750
|
-
return acc;
|
|
5751
|
-
}, []).join("/");
|
|
5752
|
-
};
|
|
5753
5745
|
Utils._insertionSort = function _insertionSort(a, from, to, compareFunc) {
|
|
5754
5746
|
for(var i = from + 1; i < to; i++){
|
|
5755
5747
|
var j = void 0;
|
|
@@ -6630,6 +6622,7 @@
|
|
|
6630
6622
|
GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
|
|
6631
6623
|
GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
|
|
6632
6624
|
GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
|
|
6625
|
+
GLCapabilityType["fragDepth"] = "EXT_frag_depth";
|
|
6633
6626
|
GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
|
|
6634
6627
|
GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
|
|
6635
6628
|
GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
|
|
@@ -8300,23 +8293,34 @@
|
|
|
8300
8293
|
* @param shader - code
|
|
8301
8294
|
* @param isFrag - Whether it is a fragment shader.
|
|
8302
8295
|
* */ ShaderFactory.convertTo300 = function convertTo300(shader, isFrag) {
|
|
8303
|
-
/** replace attribute and in */ shader = shader.replace(/\battribute\b/g, "in");
|
|
8304
8296
|
shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
|
|
8305
|
-
|
|
8306
|
-
shader = shader.replace(/\
|
|
8297
|
+
shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
|
|
8298
|
+
shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
|
|
8307
8299
|
if (isFrag) {
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
|
|
8300
|
+
shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
|
|
8301
|
+
shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
|
|
8302
|
+
shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
|
|
8303
|
+
shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
|
|
8304
|
+
shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
|
|
8305
|
+
if (!ShaderFactory._has300Output(shader)) {
|
|
8306
|
+
var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
|
|
8307
|
+
if (isMRT) {
|
|
8308
|
+
shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
|
|
8309
|
+
var result = shader.match(/\bgl_FragData\[.+?\]/g);
|
|
8310
|
+
shader = this._replaceMRTShader(shader, result);
|
|
8311
|
+
} else {
|
|
8312
|
+
shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
|
|
8313
|
+
shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
|
|
8314
|
+
}
|
|
8316
8315
|
}
|
|
8316
|
+
} else {
|
|
8317
|
+
shader = shader.replace(/\battribute\b/g, "in");
|
|
8317
8318
|
}
|
|
8318
8319
|
return shader;
|
|
8319
8320
|
};
|
|
8321
|
+
ShaderFactory._has300Output = function _has300Output(fragmentShader) {
|
|
8322
|
+
return ShaderFactory._has300OutInFragReg.test(fragmentShader);
|
|
8323
|
+
};
|
|
8320
8324
|
ShaderFactory._replaceMRTShader = function _replaceMRTShader(shader, result) {
|
|
8321
8325
|
var declaration = "";
|
|
8322
8326
|
var mrtIndexSet = new Set();
|
|
@@ -8338,11 +8342,16 @@
|
|
|
8338
8342
|
/** @internal */ ShaderFactory._shaderExtension = [
|
|
8339
8343
|
"GL_EXT_shader_texture_lod",
|
|
8340
8344
|
"GL_OES_standard_derivatives",
|
|
8341
|
-
"GL_EXT_draw_buffers"
|
|
8345
|
+
"GL_EXT_draw_buffers",
|
|
8346
|
+
"GL_EXT_frag_depth"
|
|
8342
8347
|
].map(function(e) {
|
|
8343
8348
|
return "#extension " + e + " : enable\n";
|
|
8344
8349
|
}).join("");
|
|
8345
8350
|
})();
|
|
8351
|
+
(function() {
|
|
8352
|
+
ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/ // [layout(location = 0)] out [highp] vec4 [color];
|
|
8353
|
+
;
|
|
8354
|
+
})();
|
|
8346
8355
|
/**
|
|
8347
8356
|
* Shader tag key.
|
|
8348
8357
|
*/ var ShaderTagKey = /*#__PURE__*/ function() {
|
|
@@ -8626,6 +8635,10 @@
|
|
|
8626
8635
|
this.materialUniformBlock = new ShaderUniformBlock();
|
|
8627
8636
|
this.otherUniformBlock = new ShaderUniformBlock();
|
|
8628
8637
|
/** @internal */ this._uploadRenderCount = -1;
|
|
8638
|
+
/** @internal */ this._uploadSceneId = -1;
|
|
8639
|
+
/** @internal */ this._uploadCameraId = -1;
|
|
8640
|
+
/** @internal */ this._uploadRendererId = -1;
|
|
8641
|
+
/** @internal */ this._uploadMaterialId = -1;
|
|
8629
8642
|
this.attributeLocation = Object.create(null);
|
|
8630
8643
|
this._activeTextureUint = 0;
|
|
8631
8644
|
this._engine = engine;
|
|
@@ -16245,10 +16258,8 @@
|
|
|
16245
16258
|
var vertexStride = this.createVertexElements(vertexElements);
|
|
16246
16259
|
// vertices
|
|
16247
16260
|
var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * vertexStride, exports.BufferUsage.Dynamic);
|
|
16248
|
-
vertexBuffer.isGCIgnored = true;
|
|
16249
16261
|
// indices
|
|
16250
16262
|
var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 6, exports.BufferUsage.Dynamic);
|
|
16251
|
-
indiceBuffer.isGCIgnored = true;
|
|
16252
16263
|
mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
|
|
16253
16264
|
mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
|
|
16254
16265
|
mesh.setVertexElements(vertexElements);
|
|
@@ -19872,6 +19883,7 @@
|
|
|
19872
19883
|
1
|
|
19873
19884
|
]); // left-top
|
|
19874
19885
|
var blitMaterial = new Material(engine, Shader.find("blit"));
|
|
19886
|
+
blitMaterial._addReferCount(1);
|
|
19875
19887
|
blitMaterial.renderState.depthState.enabled = false;
|
|
19876
19888
|
blitMaterial.renderState.depthState.writeEnabled = false;
|
|
19877
19889
|
this.blitMesh = this._createBlitMesh(engine, vertices);
|
|
@@ -20567,6 +20579,9 @@
|
|
|
20567
20579
|
projectionParams.set(flipProjection ? -1 : 1, virtualCamera.nearClipPlane, virtualCamera.farClipPlane, 0);
|
|
20568
20580
|
shaderData.setVector4(RenderContext._cameraProjectionProperty, projectionParams);
|
|
20569
20581
|
};
|
|
20582
|
+
_proto.garbageCollection = function garbageCollection() {
|
|
20583
|
+
this.camera = null;
|
|
20584
|
+
};
|
|
20570
20585
|
return RenderContext;
|
|
20571
20586
|
}();
|
|
20572
20587
|
(function() {
|
|
@@ -24178,7 +24193,8 @@
|
|
|
24178
24193
|
/** @internal */ this._upList = new DisorderedArray();
|
|
24179
24194
|
/** @internal */ this._downList = new DisorderedArray();
|
|
24180
24195
|
this._nativeEvents = [];
|
|
24181
|
-
|
|
24196
|
+
// Temporary solution for mini program, window does not exist
|
|
24197
|
+
if (typeof Window !== "undefined" && _instanceof1$2(target, Window)) {
|
|
24182
24198
|
throw "Do not set window as target because window cannot listen to pointer leave event.";
|
|
24183
24199
|
}
|
|
24184
24200
|
this._engine = engine;
|
|
@@ -24647,66 +24663,84 @@
|
|
|
24647
24663
|
})(ParticleInstanceVertexAttribute || (ParticleInstanceVertexAttribute = {}));
|
|
24648
24664
|
/**
|
|
24649
24665
|
* @internal
|
|
24650
|
-
*/ var ParticleBufferUtils =
|
|
24651
|
-
|
|
24652
|
-
|
|
24653
|
-
|
|
24654
|
-
|
|
24655
|
-
|
|
24656
|
-
|
|
24657
|
-
|
|
24658
|
-
|
|
24659
|
-
|
|
24660
|
-
|
|
24661
|
-
|
|
24662
|
-
|
|
24663
|
-
|
|
24664
|
-
|
|
24665
|
-
|
|
24666
|
-
|
|
24667
|
-
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24683
|
-
|
|
24684
|
-
|
|
24685
|
-
|
|
24686
|
-
|
|
24687
|
-
|
|
24688
|
-
|
|
24689
|
-
|
|
24690
|
-
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24666
|
+
*/ var ParticleBufferUtils = function ParticleBufferUtils(engine) {
|
|
24667
|
+
this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
|
|
24668
|
+
this.instanceVertexElements = [
|
|
24669
|
+
new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
|
|
24670
|
+
new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
|
|
24671
|
+
new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
|
|
24672
|
+
new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
|
|
24673
|
+
new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
|
|
24674
|
+
new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
|
|
24675
|
+
new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
|
|
24676
|
+
new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
|
|
24677
|
+
new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
|
|
24678
|
+
new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
|
|
24679
|
+
new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
|
|
24680
|
+
];
|
|
24681
|
+
this.instanceVertexStride = 152;
|
|
24682
|
+
this.instanceVertexFloatStride = this.instanceVertexStride / 4;
|
|
24683
|
+
this.startLifeTimeOffset = 3;
|
|
24684
|
+
this.timeOffset = 7;
|
|
24685
|
+
this.simulationUVOffset = 34;
|
|
24686
|
+
this.billboardIndexCount = 6;
|
|
24687
|
+
var stride = 16;
|
|
24688
|
+
var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
|
|
24689
|
+
billboardGeometryBuffer.isGCIgnored = true;
|
|
24690
|
+
this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
|
|
24691
|
+
var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
|
|
24692
|
+
indexBuffer.isGCIgnored = true;
|
|
24693
|
+
this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
|
|
24694
|
+
var billboardGeometryData = new Float32Array([
|
|
24695
|
+
-0.5,
|
|
24696
|
+
-0.5,
|
|
24697
|
+
0,
|
|
24698
|
+
1,
|
|
24699
|
+
0.5,
|
|
24700
|
+
-0.5,
|
|
24701
|
+
1,
|
|
24702
|
+
1,
|
|
24703
|
+
0.5,
|
|
24704
|
+
0.5,
|
|
24705
|
+
1,
|
|
24706
|
+
0,
|
|
24707
|
+
-0.5,
|
|
24708
|
+
0.5,
|
|
24709
|
+
0,
|
|
24710
|
+
0
|
|
24711
|
+
]);
|
|
24712
|
+
var indexData = new Uint8Array([
|
|
24713
|
+
0,
|
|
24714
|
+
2,
|
|
24715
|
+
3,
|
|
24716
|
+
0,
|
|
24717
|
+
1,
|
|
24718
|
+
2
|
|
24719
|
+
]);
|
|
24720
|
+
billboardGeometryBuffer.setData(billboardGeometryData);
|
|
24721
|
+
indexBuffer.setData(indexData);
|
|
24722
|
+
// Register content restorer
|
|
24723
|
+
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
24724
|
+
var _class = function _class() {
|
|
24725
|
+
return ContentRestorer.call(this, billboardGeometryBuffer);
|
|
24726
|
+
};
|
|
24727
|
+
_inherits$2(_class, ContentRestorer);
|
|
24728
|
+
var _proto = _class.prototype;
|
|
24729
|
+
_proto.restoreContent = function restoreContent() {
|
|
24730
|
+
billboardGeometryBuffer.setData(billboardGeometryData);
|
|
24731
|
+
};
|
|
24732
|
+
return _class;
|
|
24733
|
+
}(ContentRestorer))());
|
|
24734
|
+
engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
|
|
24735
|
+
var _class = function _class() {
|
|
24736
|
+
return ContentRestorer.call(this, indexBuffer);
|
|
24737
|
+
};
|
|
24738
|
+
_inherits$2(_class, ContentRestorer);
|
|
24739
|
+
var _proto = _class.prototype;
|
|
24740
|
+
_proto.restoreContent = function restoreContent() {};
|
|
24741
|
+
return _class;
|
|
24742
|
+
}(ContentRestorer))());
|
|
24743
|
+
};
|
|
24710
24744
|
var blitFs = "#define GLSLIFY 1\nuniform mediump sampler2D renderer_BlitTexture;\n#ifdef HAS_TEX_LOD\nuniform float renderer_BlitMipLevel;\n#endif\nvarying vec2 v_uv;void main(){\n#ifdef HAS_TEX_LOD\ngl_FragColor=texture2DLodEXT(renderer_BlitTexture,v_uv,renderer_BlitMipLevel);\n#else\ngl_FragColor=texture2D(renderer_BlitTexture,v_uv);\n#endif\n}"; // eslint-disable-line
|
|
24711
24745
|
var blitVs = "#define GLSLIFY 1\nattribute vec4 POSITION_UV;varying vec2 v_uv;void main(){gl_Position=vec4(POSITION_UV.xy,0.0,1.0);v_uv=POSITION_UV.zw;}"; // eslint-disable-line
|
|
24712
24746
|
var skyProceduralFs = "#define GLSLIFY 1\n#include <common>\nconst float MIE_G=-0.990;const float MIE_G2=0.9801;const float SKY_GROUND_THRESHOLD=0.02;uniform float material_SunSize;uniform float material_SunSizeConvergence;uniform vec4 scene_SunlightColor;uniform vec3 scene_SunlightDirection;varying vec3 v_GroundColor;varying vec3 v_SkyColor;\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvarying vec3 v_Vertex;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_RayDir;\n#else\nvarying float v_SkyGroundFactor;\n#endif\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nvarying vec3 v_SunColor;\n#endif\n#if defined(ENGINE_IS_COLORSPACE_GAMMA)\n#define LINEAR_2_OUTPUT(color) sqrt(color)\n#endif\nfloat getMiePhase(float eyeCos,float eyeCos2){float temp=1.0+MIE_G2-2.0*MIE_G*eyeCos;temp=pow(temp,pow(material_SunSize,0.65)*10.0);temp=max(temp,1.0e-4);temp=1.5*((1.0-MIE_G2)/(2.0+MIE_G2))*(1.0+eyeCos2)/temp;return temp;}float calcSunAttenuation(vec3 lightPos,vec3 ray){\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nfloat focusedEyeCos=pow(clamp(dot(lightPos,ray),0.0,1.0),material_SunSizeConvergence);return getMiePhase(-focusedEyeCos,focusedEyeCos*focusedEyeCos);\n#else\nvec3 delta=lightPos-ray;float dist=length(delta);float spot=1.0-smoothstep(0.0,material_SunSize,dist);return spot*spot;\n#endif\n}void main(){vec3 col=vec3(0.0,0.0,0.0);\n#ifdef MATERIAL_SUN_HIGH_QUALITY\nvec3 ray=normalize(v_Vertex);float y=ray.y/SKY_GROUND_THRESHOLD;\n#elif defined(MATERIAL_SUN_SIMPLE)\nvec3 ray=v_RayDir;float y=ray.y/SKY_GROUND_THRESHOLD;\n#else\nfloat y=v_SkyGroundFactor;\n#endif\ncol=mix(v_SkyColor,v_GroundColor,clamp(y,0.0,1.0));\n#if defined(MATERIAL_SUN_HIGH_QUALITY)||defined(MATERIAL_SUN_SIMPLE)\nif(y<0.0)col+=v_SunColor*calcSunAttenuation(-scene_SunlightDirection,-ray);\n#endif\n#ifdef ENGINE_IS_COLORSPACE_GAMMA\ncol=LINEAR_2_OUTPUT(col);\n#endif\ngl_FragColor=vec4(col,1.0);\n#ifndef ENGINE_IS_COLORSPACE_GAMMA\ngl_FragColor=linearToGamma(gl_FragColor);\n#endif\n}"; // eslint-disable-line
|
|
@@ -25379,7 +25413,6 @@
|
|
|
25379
25413
|
resourceManager._restoreGraphicResources();
|
|
25380
25414
|
console.log("Graphic resource restored.");
|
|
25381
25415
|
// Restore resources content
|
|
25382
|
-
this._particleBufferUtils.setBufferData();
|
|
25383
25416
|
resourceManager._restoreResourcesContent().then(function() {
|
|
25384
25417
|
console.log("Graphic resource content restored.\n\n" + "Device restored.");
|
|
25385
25418
|
_this.dispatch("devicerestored", _this);
|
|
@@ -25394,6 +25427,7 @@
|
|
|
25394
25427
|
this._spriteRenderDataPool.garbageCollection();
|
|
25395
25428
|
this._spriteMaskRenderDataPool.garbageCollection();
|
|
25396
25429
|
this._textRenderDataPool.garbageCollection();
|
|
25430
|
+
this._renderContext.garbageCollection();
|
|
25397
25431
|
};
|
|
25398
25432
|
_create_class$2(Engine, [
|
|
25399
25433
|
{
|
|
@@ -25746,7 +25780,6 @@
|
|
|
25746
25780
|
};
|
|
25747
25781
|
_proto._createPlane = function _createPlane(engine) {
|
|
25748
25782
|
var mesh = new ModelMesh(engine);
|
|
25749
|
-
mesh.isGCIgnored = true;
|
|
25750
25783
|
var indices = new Uint8Array([
|
|
25751
25784
|
1,
|
|
25752
25785
|
2,
|
|
@@ -27713,22 +27746,6 @@
|
|
|
27713
27746
|
maskManager.postRender(renderer);
|
|
27714
27747
|
}
|
|
27715
27748
|
};
|
|
27716
|
-
_proto.destroy = function destroy() {
|
|
27717
|
-
this._batchedQueue = null;
|
|
27718
|
-
var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
|
|
27719
|
-
for(var i = 0, n = meshes.length; i < n; ++i){
|
|
27720
|
-
meshes[i].destroy();
|
|
27721
|
-
}
|
|
27722
|
-
this._meshes = null;
|
|
27723
|
-
for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
|
|
27724
|
-
vertexBuffers[i1].destroy();
|
|
27725
|
-
}
|
|
27726
|
-
this._vertexBuffers = null;
|
|
27727
|
-
for(var i2 = 0, n2 = indiceBuffers.length; i2 < n2; ++i2){
|
|
27728
|
-
indiceBuffers[i2].destroy();
|
|
27729
|
-
}
|
|
27730
|
-
this._indiceBuffers = null;
|
|
27731
|
-
};
|
|
27732
27749
|
return SpriteBatcher;
|
|
27733
27750
|
}(Basic2DBatcher);
|
|
27734
27751
|
(function() {
|
|
@@ -27753,11 +27770,10 @@
|
|
|
27753
27770
|
if (elements.length === 0) {
|
|
27754
27771
|
return;
|
|
27755
27772
|
}
|
|
27756
|
-
var engine = camera.engine,
|
|
27773
|
+
var engine = camera.engine, cameraId = camera.instanceId, cameraData = camera.shaderData;
|
|
27774
|
+
var _camera_scene = camera.scene, sceneData = _camera_scene.shaderData, sceneId = _camera_scene.instanceId;
|
|
27757
27775
|
var renderCount = engine._renderCount;
|
|
27758
27776
|
var rhi = engine._hardwareRenderer;
|
|
27759
|
-
var sceneData = scene.shaderData;
|
|
27760
|
-
var cameraData = camera.shaderData;
|
|
27761
27777
|
var pipelineStageKey = RenderContext.pipelineStageKey;
|
|
27762
27778
|
var renderQueueType = this._renderQueueType;
|
|
27763
27779
|
for(var i = 0, n = elements.length; i < n; i++){
|
|
@@ -27769,9 +27785,8 @@
|
|
|
27769
27785
|
var primitive = data.primitive;
|
|
27770
27786
|
var renderer = data.component;
|
|
27771
27787
|
var material = data.material;
|
|
27772
|
-
var rendererData = renderer.shaderData;
|
|
27773
|
-
var materialData = material.shaderData;
|
|
27774
|
-
var renderStates = material.renderStates;
|
|
27788
|
+
var rendererData = renderer.shaderData, rendererId = renderer.instanceId;
|
|
27789
|
+
var materialData = material.shaderData, materialId = material.instanceId, renderStates = material.renderStates;
|
|
27775
27790
|
// union render global macro and material self macro.
|
|
27776
27791
|
ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
|
|
27777
27792
|
for(var j = 0, m = shaderPasses.length; j < m; j++){
|
|
@@ -27797,33 +27812,33 @@
|
|
|
27797
27812
|
program.uploadAll(program.materialUniformBlock, materialData);
|
|
27798
27813
|
// UnGroup textures should upload default value, texture uint maybe change by logic of texture bind.
|
|
27799
27814
|
program.uploadUnGroupTextures();
|
|
27800
|
-
program.
|
|
27801
|
-
program.
|
|
27802
|
-
program.
|
|
27803
|
-
program.
|
|
27815
|
+
program._uploadSceneId = sceneId;
|
|
27816
|
+
program._uploadCameraId = cameraId;
|
|
27817
|
+
program._uploadRendererId = rendererId;
|
|
27818
|
+
program._uploadMaterialId = materialId;
|
|
27804
27819
|
program._uploadRenderCount = renderCount;
|
|
27805
27820
|
} else {
|
|
27806
|
-
if (program.
|
|
27821
|
+
if (program._uploadSceneId !== sceneId) {
|
|
27807
27822
|
program.uploadAll(program.sceneUniformBlock, sceneData);
|
|
27808
|
-
program.
|
|
27823
|
+
program._uploadSceneId = sceneId;
|
|
27809
27824
|
} else if (switchProgram) {
|
|
27810
27825
|
program.uploadTextures(program.sceneUniformBlock, sceneData);
|
|
27811
27826
|
}
|
|
27812
|
-
if (program.
|
|
27827
|
+
if (program._uploadCameraId !== cameraId) {
|
|
27813
27828
|
program.uploadAll(program.cameraUniformBlock, cameraData);
|
|
27814
|
-
program.
|
|
27829
|
+
program._uploadCameraId = cameraId;
|
|
27815
27830
|
} else if (switchProgram) {
|
|
27816
27831
|
program.uploadTextures(program.cameraUniformBlock, cameraData);
|
|
27817
27832
|
}
|
|
27818
|
-
if (program.
|
|
27833
|
+
if (program._uploadRendererId !== rendererId) {
|
|
27819
27834
|
program.uploadAll(program.rendererUniformBlock, rendererData);
|
|
27820
|
-
program.
|
|
27835
|
+
program._uploadRendererId = rendererId;
|
|
27821
27836
|
} else if (switchProgram) {
|
|
27822
27837
|
program.uploadTextures(program.rendererUniformBlock, rendererData);
|
|
27823
27838
|
}
|
|
27824
|
-
if (program.
|
|
27839
|
+
if (program._uploadMaterialId !== materialId) {
|
|
27825
27840
|
program.uploadAll(program.materialUniformBlock, materialData);
|
|
27826
|
-
program.
|
|
27841
|
+
program._uploadMaterialId = materialId;
|
|
27827
27842
|
} else if (switchProgram) {
|
|
27828
27843
|
program.uploadTextures(program.materialUniformBlock, materialData);
|
|
27829
27844
|
}
|
|
@@ -36605,7 +36620,7 @@
|
|
|
36605
36620
|
var cap = this.capabilityList;
|
|
36606
36621
|
var isWebGL2 = this.rhi.isWebGL2;
|
|
36607
36622
|
var requireExtension = this.rhi.requireExtension.bind(this.rhi);
|
|
36608
|
-
var shaderVertexID = exports.GLCapabilityType.shaderVertexID, standardDerivatives = exports.GLCapabilityType.standardDerivatives, shaderTextureLod = exports.GLCapabilityType.shaderTextureLod, elementIndexUint = exports.GLCapabilityType.elementIndexUint, depthTexture = exports.GLCapabilityType.depthTexture, vertexArrayObject = exports.GLCapabilityType.vertexArrayObject, instancedArrays = exports.GLCapabilityType.instancedArrays, multipleSample = exports.GLCapabilityType.multipleSample, drawBuffers = exports.GLCapabilityType.drawBuffers, blendMinMax = exports.GLCapabilityType.blendMinMax, astc = exports.GLCapabilityType.astc, astc_webkit = exports.GLCapabilityType.astc_webkit, etc = exports.GLCapabilityType.etc, etc_webkit = exports.GLCapabilityType.etc_webkit, etc1 = exports.GLCapabilityType.etc1, etc1_webkit = exports.GLCapabilityType.etc1_webkit, pvrtc = exports.GLCapabilityType.pvrtc, pvrtc_webkit = exports.GLCapabilityType.pvrtc_webkit, s3tc = exports.GLCapabilityType.s3tc, s3tc_webkit = exports.GLCapabilityType.s3tc_webkit, bptc = exports.GLCapabilityType.bptc, textureFloat = exports.GLCapabilityType.textureFloat, textureHalfFloat = exports.GLCapabilityType.textureHalfFloat, textureFloatLinear = exports.GLCapabilityType.textureFloatLinear, textureHalfFloatLinear = exports.GLCapabilityType.textureHalfFloatLinear, WEBGL_colorBufferFloat = exports.GLCapabilityType.WEBGL_colorBufferFloat, colorBufferFloat = exports.GLCapabilityType.colorBufferFloat, colorBufferHalfFloat = exports.GLCapabilityType.colorBufferHalfFloat, textureFilterAnisotropic = exports.GLCapabilityType.textureFilterAnisotropic;
|
|
36623
|
+
var shaderVertexID = exports.GLCapabilityType.shaderVertexID, standardDerivatives = exports.GLCapabilityType.standardDerivatives, shaderTextureLod = exports.GLCapabilityType.shaderTextureLod, elementIndexUint = exports.GLCapabilityType.elementIndexUint, depthTexture = exports.GLCapabilityType.depthTexture, vertexArrayObject = exports.GLCapabilityType.vertexArrayObject, instancedArrays = exports.GLCapabilityType.instancedArrays, multipleSample = exports.GLCapabilityType.multipleSample, drawBuffers = exports.GLCapabilityType.drawBuffers, blendMinMax = exports.GLCapabilityType.blendMinMax, astc = exports.GLCapabilityType.astc, astc_webkit = exports.GLCapabilityType.astc_webkit, etc = exports.GLCapabilityType.etc, etc_webkit = exports.GLCapabilityType.etc_webkit, etc1 = exports.GLCapabilityType.etc1, etc1_webkit = exports.GLCapabilityType.etc1_webkit, pvrtc = exports.GLCapabilityType.pvrtc, pvrtc_webkit = exports.GLCapabilityType.pvrtc_webkit, s3tc = exports.GLCapabilityType.s3tc, s3tc_webkit = exports.GLCapabilityType.s3tc_webkit, bptc = exports.GLCapabilityType.bptc, textureFloat = exports.GLCapabilityType.textureFloat, textureHalfFloat = exports.GLCapabilityType.textureHalfFloat, textureFloatLinear = exports.GLCapabilityType.textureFloatLinear, textureHalfFloatLinear = exports.GLCapabilityType.textureHalfFloatLinear, WEBGL_colorBufferFloat = exports.GLCapabilityType.WEBGL_colorBufferFloat, colorBufferFloat = exports.GLCapabilityType.colorBufferFloat, colorBufferHalfFloat = exports.GLCapabilityType.colorBufferHalfFloat, textureFilterAnisotropic = exports.GLCapabilityType.textureFilterAnisotropic, fragDepth = exports.GLCapabilityType.fragDepth;
|
|
36609
36624
|
cap.set(shaderVertexID, isWebGL2);
|
|
36610
36625
|
cap.set(standardDerivatives, isWebGL2 || !!requireExtension(standardDerivatives));
|
|
36611
36626
|
cap.set(shaderTextureLod, isWebGL2 || !!requireExtension(shaderTextureLod));
|
|
@@ -36623,6 +36638,7 @@
|
|
|
36623
36638
|
cap.set(colorBufferFloat, isWebGL2 && !!requireExtension(colorBufferFloat) || !!requireExtension(WEBGL_colorBufferFloat));
|
|
36624
36639
|
cap.set(colorBufferHalfFloat, isWebGL2 && !!requireExtension(colorBufferFloat) || !!requireExtension(colorBufferHalfFloat));
|
|
36625
36640
|
cap.set(textureFilterAnisotropic, !!requireExtension(textureFilterAnisotropic));
|
|
36641
|
+
cap.set(fragDepth, isWebGL2 || !!requireExtension(fragDepth));
|
|
36626
36642
|
cap.set(astc, !!(requireExtension(astc) || requireExtension(astc_webkit)));
|
|
36627
36643
|
cap.set(etc, !!(requireExtension(etc) || requireExtension(etc_webkit)));
|
|
36628
36644
|
cap.set(etc1, !!(requireExtension(etc1) || requireExtension(etc1_webkit)));
|
|
@@ -39316,10 +39332,11 @@
|
|
|
39316
39332
|
entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : entity.isActive;
|
|
39317
39333
|
var _entityConfig_name;
|
|
39318
39334
|
entity.name = (_entityConfig_name = entityConfig.name) != null ? _entityConfig_name : entity.name;
|
|
39319
|
-
var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale;
|
|
39335
|
+
var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale, layer = entityConfig.layer;
|
|
39320
39336
|
if (position) entity.transform.position.copyFrom(position);
|
|
39321
39337
|
if (rotation) entity.transform.rotation.copyFrom(rotation);
|
|
39322
39338
|
if (scale) entity.transform.scale.copyFrom(scale);
|
|
39339
|
+
if (layer) entity.layer = layer;
|
|
39323
39340
|
return entity;
|
|
39324
39341
|
};
|
|
39325
39342
|
_proto._traverseAddEntityToMap = function _traverseAddEntityToMap(entity, context, path) {
|
|
@@ -44941,7 +44958,7 @@
|
|
|
44941
44958
|
], KHR_materials_anisotropy);
|
|
44942
44959
|
|
|
44943
44960
|
//@ts-ignore
|
|
44944
|
-
var version = "1.2.0-beta.
|
|
44961
|
+
var version = "1.2.0-beta.3";
|
|
44945
44962
|
console.log("Galacean engine version: " + version);
|
|
44946
44963
|
for(var key in CoreObjects){
|
|
44947
44964
|
Loader.registerClass(key, CoreObjects[key]);
|
|
@@ -45136,3 +45153,4 @@
|
|
|
45136
45153
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
45137
45154
|
|
|
45138
45155
|
}));
|
|
45156
|
+
//# sourceMappingURL=browser.js.map
|