@galacean/engine 1.2.0-beta.1 → 1.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -5599,7 +5599,7 @@
5599
5599
  if (Utils.isBase64Url(relativeUrl)) {
5600
5600
  return relativeUrl;
5601
5601
  }
5602
- return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
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
- /** replace api */ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
8306
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
8297
+ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
8298
+ shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
8307
8299
  if (isFrag) {
8308
- var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
8309
- if (isMRT) {
8310
- shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
8311
- var result = shader.match(/\bgl_FragData\[.+?\]/g);
8312
- shader = this._replaceMRTShader(shader, result);
8313
- } else {
8314
- shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
8315
- shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
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() {
@@ -24647,66 +24662,84 @@
24647
24662
  })(ParticleInstanceVertexAttribute || (ParticleInstanceVertexAttribute = {}));
24648
24663
  /**
24649
24664
  * @internal
24650
- */ var ParticleBufferUtils = /*#__PURE__*/ function() {
24651
- var ParticleBufferUtils = function ParticleBufferUtils(engine) {
24652
- this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
24653
- this.instanceVertexElements = [
24654
- new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
24655
- new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
24656
- new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
24657
- new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
24658
- new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
24659
- new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
24660
- new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
24661
- new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
24662
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
24663
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
24664
- new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
24665
- ];
24666
- this.instanceVertexStride = 152;
24667
- this.instanceVertexFloatStride = this.instanceVertexStride / 4;
24668
- this.startLifeTimeOffset = 3;
24669
- this.timeOffset = 7;
24670
- this.simulationUVOffset = 34;
24671
- this.billboardIndexCount = 6;
24672
- var stride = 16;
24673
- var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
24674
- this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
24675
- var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
24676
- this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
24677
- this.setBufferData();
24678
- };
24679
- var _proto = ParticleBufferUtils.prototype;
24680
- _proto.setBufferData = function setBufferData() {
24681
- this.billboardVertexBufferBinding.buffer.setData(new Float32Array([
24682
- -0.5,
24683
- -0.5,
24684
- 0,
24685
- 1,
24686
- 0.5,
24687
- -0.5,
24688
- 1,
24689
- 1,
24690
- 0.5,
24691
- 0.5,
24692
- 1,
24693
- 0,
24694
- -0.5,
24695
- 0.5,
24696
- 0,
24697
- 0
24698
- ]));
24699
- this.billboardIndexBufferBinding.buffer.setData(new Uint8Array([
24700
- 0,
24701
- 2,
24702
- 3,
24703
- 0,
24704
- 1,
24705
- 2
24706
- ]));
24707
- };
24708
- return ParticleBufferUtils;
24709
- }();
24665
+ */ var ParticleBufferUtils = function ParticleBufferUtils(engine) {
24666
+ this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
24667
+ this.instanceVertexElements = [
24668
+ new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
24669
+ new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
24670
+ new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
24671
+ new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
24672
+ new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
24673
+ new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
24674
+ new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
24675
+ new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
24676
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
24677
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
24678
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
24679
+ ];
24680
+ this.instanceVertexStride = 152;
24681
+ this.instanceVertexFloatStride = this.instanceVertexStride / 4;
24682
+ this.startLifeTimeOffset = 3;
24683
+ this.timeOffset = 7;
24684
+ this.simulationUVOffset = 34;
24685
+ this.billboardIndexCount = 6;
24686
+ var stride = 16;
24687
+ var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
24688
+ billboardGeometryBuffer.isGCIgnored = true;
24689
+ this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
24690
+ var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
24691
+ indexBuffer.isGCIgnored = true;
24692
+ this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
24693
+ var billboardGeometryData = new Float32Array([
24694
+ -0.5,
24695
+ -0.5,
24696
+ 0,
24697
+ 1,
24698
+ 0.5,
24699
+ -0.5,
24700
+ 1,
24701
+ 1,
24702
+ 0.5,
24703
+ 0.5,
24704
+ 1,
24705
+ 0,
24706
+ -0.5,
24707
+ 0.5,
24708
+ 0,
24709
+ 0
24710
+ ]);
24711
+ var indexData = new Uint8Array([
24712
+ 0,
24713
+ 2,
24714
+ 3,
24715
+ 0,
24716
+ 1,
24717
+ 2
24718
+ ]);
24719
+ billboardGeometryBuffer.setData(billboardGeometryData);
24720
+ indexBuffer.setData(indexData);
24721
+ // Register content restorer
24722
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
24723
+ var _class = function _class() {
24724
+ return ContentRestorer.call(this, billboardGeometryBuffer);
24725
+ };
24726
+ _inherits$2(_class, ContentRestorer);
24727
+ var _proto = _class.prototype;
24728
+ _proto.restoreContent = function restoreContent() {
24729
+ billboardGeometryBuffer.setData(billboardGeometryData);
24730
+ };
24731
+ return _class;
24732
+ }(ContentRestorer))());
24733
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
24734
+ var _class = function _class() {
24735
+ return ContentRestorer.call(this, indexBuffer);
24736
+ };
24737
+ _inherits$2(_class, ContentRestorer);
24738
+ var _proto = _class.prototype;
24739
+ _proto.restoreContent = function restoreContent() {};
24740
+ return _class;
24741
+ }(ContentRestorer))());
24742
+ };
24710
24743
  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
24744
  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
24745
  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 +25412,6 @@
25379
25412
  resourceManager._restoreGraphicResources();
25380
25413
  console.log("Graphic resource restored.");
25381
25414
  // Restore resources content
25382
- this._particleBufferUtils.setBufferData();
25383
25415
  resourceManager._restoreResourcesContent().then(function() {
25384
25416
  console.log("Graphic resource content restored.\n\n" + "Device restored.");
25385
25417
  _this.dispatch("devicerestored", _this);
@@ -25394,6 +25426,7 @@
25394
25426
  this._spriteRenderDataPool.garbageCollection();
25395
25427
  this._spriteMaskRenderDataPool.garbageCollection();
25396
25428
  this._textRenderDataPool.garbageCollection();
25429
+ this._renderContext.garbageCollection();
25397
25430
  };
25398
25431
  _create_class$2(Engine, [
25399
25432
  {
@@ -25746,7 +25779,6 @@
25746
25779
  };
25747
25780
  _proto._createPlane = function _createPlane(engine) {
25748
25781
  var mesh = new ModelMesh(engine);
25749
- mesh.isGCIgnored = true;
25750
25782
  var indices = new Uint8Array([
25751
25783
  1,
25752
25784
  2,
@@ -27713,22 +27745,6 @@
27713
27745
  maskManager.postRender(renderer);
27714
27746
  }
27715
27747
  };
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
27748
  return SpriteBatcher;
27733
27749
  }(Basic2DBatcher);
27734
27750
  (function() {
@@ -27753,11 +27769,10 @@
27753
27769
  if (elements.length === 0) {
27754
27770
  return;
27755
27771
  }
27756
- var engine = camera.engine, scene = camera.scene;
27772
+ var engine = camera.engine, cameraId = camera.instanceId, cameraData = camera.shaderData;
27773
+ var _camera_scene = camera.scene, sceneData = _camera_scene.shaderData, sceneId = _camera_scene.instanceId;
27757
27774
  var renderCount = engine._renderCount;
27758
27775
  var rhi = engine._hardwareRenderer;
27759
- var sceneData = scene.shaderData;
27760
- var cameraData = camera.shaderData;
27761
27776
  var pipelineStageKey = RenderContext.pipelineStageKey;
27762
27777
  var renderQueueType = this._renderQueueType;
27763
27778
  for(var i = 0, n = elements.length; i < n; i++){
@@ -27769,9 +27784,8 @@
27769
27784
  var primitive = data.primitive;
27770
27785
  var renderer = data.component;
27771
27786
  var material = data.material;
27772
- var rendererData = renderer.shaderData;
27773
- var materialData = material.shaderData;
27774
- var renderStates = material.renderStates;
27787
+ var rendererData = renderer.shaderData, rendererId = renderer.instanceId;
27788
+ var materialData = material.shaderData, materialId = material.instanceId, renderStates = material.renderStates;
27775
27789
  // union render global macro and material self macro.
27776
27790
  ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
27777
27791
  for(var j = 0, m = shaderPasses.length; j < m; j++){
@@ -27797,33 +27811,33 @@
27797
27811
  program.uploadAll(program.materialUniformBlock, materialData);
27798
27812
  // UnGroup textures should upload default value, texture uint maybe change by logic of texture bind.
27799
27813
  program.uploadUnGroupTextures();
27800
- program._uploadScene = scene;
27801
- program._uploadCamera = camera;
27802
- program._uploadRenderer = renderer;
27803
- program._uploadMaterial = material;
27814
+ program._uploadSceneId = sceneId;
27815
+ program._uploadCameraId = cameraId;
27816
+ program._uploadRendererId = rendererId;
27817
+ program._uploadMaterialId = materialId;
27804
27818
  program._uploadRenderCount = renderCount;
27805
27819
  } else {
27806
- if (program._uploadScene !== scene) {
27820
+ if (program._uploadSceneId !== sceneId) {
27807
27821
  program.uploadAll(program.sceneUniformBlock, sceneData);
27808
- program._uploadScene = scene;
27822
+ program._uploadSceneId = sceneId;
27809
27823
  } else if (switchProgram) {
27810
27824
  program.uploadTextures(program.sceneUniformBlock, sceneData);
27811
27825
  }
27812
- if (program._uploadCamera !== camera) {
27826
+ if (program._uploadCameraId !== cameraId) {
27813
27827
  program.uploadAll(program.cameraUniformBlock, cameraData);
27814
- program._uploadCamera = camera;
27828
+ program._uploadCameraId = cameraId;
27815
27829
  } else if (switchProgram) {
27816
27830
  program.uploadTextures(program.cameraUniformBlock, cameraData);
27817
27831
  }
27818
- if (program._uploadRenderer !== renderer) {
27832
+ if (program._uploadRendererId !== rendererId) {
27819
27833
  program.uploadAll(program.rendererUniformBlock, rendererData);
27820
- program._uploadRenderer = renderer;
27834
+ program._uploadRendererId = rendererId;
27821
27835
  } else if (switchProgram) {
27822
27836
  program.uploadTextures(program.rendererUniformBlock, rendererData);
27823
27837
  }
27824
- if (program._uploadMaterial !== material) {
27838
+ if (program._uploadMaterialId !== materialId) {
27825
27839
  program.uploadAll(program.materialUniformBlock, materialData);
27826
- program._uploadMaterial = material;
27840
+ program._uploadMaterialId = materialId;
27827
27841
  } else if (switchProgram) {
27828
27842
  program.uploadTextures(program.materialUniformBlock, materialData);
27829
27843
  }
@@ -36605,7 +36619,7 @@
36605
36619
  var cap = this.capabilityList;
36606
36620
  var isWebGL2 = this.rhi.isWebGL2;
36607
36621
  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;
36622
+ 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
36623
  cap.set(shaderVertexID, isWebGL2);
36610
36624
  cap.set(standardDerivatives, isWebGL2 || !!requireExtension(standardDerivatives));
36611
36625
  cap.set(shaderTextureLod, isWebGL2 || !!requireExtension(shaderTextureLod));
@@ -36623,6 +36637,7 @@
36623
36637
  cap.set(colorBufferFloat, isWebGL2 && !!requireExtension(colorBufferFloat) || !!requireExtension(WEBGL_colorBufferFloat));
36624
36638
  cap.set(colorBufferHalfFloat, isWebGL2 && !!requireExtension(colorBufferFloat) || !!requireExtension(colorBufferHalfFloat));
36625
36639
  cap.set(textureFilterAnisotropic, !!requireExtension(textureFilterAnisotropic));
36640
+ cap.set(fragDepth, isWebGL2 || !!requireExtension(fragDepth));
36626
36641
  cap.set(astc, !!(requireExtension(astc) || requireExtension(astc_webkit)));
36627
36642
  cap.set(etc, !!(requireExtension(etc) || requireExtension(etc_webkit)));
36628
36643
  cap.set(etc1, !!(requireExtension(etc1) || requireExtension(etc1_webkit)));
@@ -39316,10 +39331,11 @@
39316
39331
  entity.isActive = (_entityConfig_isActive = entityConfig.isActive) != null ? _entityConfig_isActive : entity.isActive;
39317
39332
  var _entityConfig_name;
39318
39333
  entity.name = (_entityConfig_name = entityConfig.name) != null ? _entityConfig_name : entity.name;
39319
- var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale;
39334
+ var position = entityConfig.position, rotation = entityConfig.rotation, scale = entityConfig.scale, layer = entityConfig.layer;
39320
39335
  if (position) entity.transform.position.copyFrom(position);
39321
39336
  if (rotation) entity.transform.rotation.copyFrom(rotation);
39322
39337
  if (scale) entity.transform.scale.copyFrom(scale);
39338
+ if (layer) entity.layer = layer;
39323
39339
  return entity;
39324
39340
  };
39325
39341
  _proto._traverseAddEntityToMap = function _traverseAddEntityToMap(entity, context, path) {
@@ -44941,7 +44957,7 @@
44941
44957
  ], KHR_materials_anisotropy);
44942
44958
 
44943
44959
  //@ts-ignore
44944
- var version = "1.2.0-beta.1";
44960
+ var version = "1.2.0-beta.2";
44945
44961
  console.log("Galacean engine version: " + version);
44946
44962
  for(var key in CoreObjects){
44947
44963
  Loader.registerClass(key, CoreObjects[key]);