@galacean/engine-core 1.2.0-beta.0 → 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/module.js CHANGED
@@ -623,7 +623,7 @@ var Utils = /*#__PURE__*/ function() {
623
623
  if (Utils.isBase64Url(relativeUrl)) {
624
624
  return relativeUrl;
625
625
  }
626
- return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
626
+ return relativeUrl ? new URL(relativeUrl, baseUrl).href : baseUrl;
627
627
  };
628
628
  /**
629
629
  * @internal
@@ -766,14 +766,6 @@ var Utils = /*#__PURE__*/ function() {
766
766
  });
767
767
  return result;
768
768
  };
769
- Utils._formatRelativePath = function _formatRelativePath(path) {
770
- // For example input is "a/b", "/a/b", "./a/b", "./a/./b", "./a/../a/b", output is "a/b"
771
- return path.split("/").filter(Boolean).reduce(function(acc, cur) {
772
- if (cur === "..") acc.pop();
773
- else if (cur !== ".") acc.push(cur);
774
- return acc;
775
- }, []).join("/");
776
- };
777
769
  Utils._insertionSort = function _insertionSort(a, from, to, compareFunc) {
778
770
  for(var i = from + 1; i < to; i++){
779
771
  var j = void 0;
@@ -1663,6 +1655,7 @@ var GLCapabilityType;
1663
1655
  GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
1664
1656
  GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
1665
1657
  GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
1658
+ GLCapabilityType["fragDepth"] = "EXT_frag_depth";
1666
1659
  GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
1667
1660
  GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
1668
1661
  GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
@@ -3426,23 +3419,34 @@ var ShaderFactory = /*#__PURE__*/ function() {
3426
3419
  * @param shader - code
3427
3420
  * @param isFrag - Whether it is a fragment shader.
3428
3421
  * */ ShaderFactory.convertTo300 = function convertTo300(shader, isFrag) {
3429
- /** replace attribute and in */ shader = shader.replace(/\battribute\b/g, "in");
3430
3422
  shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
3431
- /** replace api */ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
3432
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
3423
+ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
3424
+ shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
3433
3425
  if (isFrag) {
3434
- var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
3435
- if (isMRT) {
3436
- shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
3437
- var result = shader.match(/\bgl_FragData\[.+?\]/g);
3438
- shader = this._replaceMRTShader(shader, result);
3439
- } else {
3440
- shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
3441
- shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
3426
+ shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
3427
+ shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
3428
+ shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
3429
+ shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
3430
+ shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
3431
+ if (!ShaderFactory._has300Output(shader)) {
3432
+ var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
3433
+ if (isMRT) {
3434
+ shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
3435
+ var result = shader.match(/\bgl_FragData\[.+?\]/g);
3436
+ shader = this._replaceMRTShader(shader, result);
3437
+ } else {
3438
+ shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
3439
+ shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
3440
+ }
3442
3441
  }
3442
+ } else {
3443
+ shader = shader.replace(/\battribute\b/g, "in");
3443
3444
  }
3444
3445
  return shader;
3445
3446
  };
3447
+ ShaderFactory._has300Output = function _has300Output(fragmentShader) {
3448
+ return ShaderFactory._has300OutInFragReg.test(fragmentShader);
3449
+ };
3446
3450
  ShaderFactory._replaceMRTShader = function _replaceMRTShader(shader, result) {
3447
3451
  var declaration = "";
3448
3452
  var mrtIndexSet = new Set();
@@ -3464,11 +3468,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
3464
3468
  /** @internal */ ShaderFactory._shaderExtension = [
3465
3469
  "GL_EXT_shader_texture_lod",
3466
3470
  "GL_OES_standard_derivatives",
3467
- "GL_EXT_draw_buffers"
3471
+ "GL_EXT_draw_buffers",
3472
+ "GL_EXT_frag_depth"
3468
3473
  ].map(function(e) {
3469
3474
  return "#extension " + e + " : enable\n";
3470
3475
  }).join("");
3471
3476
  })();
3477
+ (function() {
3478
+ ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/ // [layout(location = 0)] out [highp] vec4 [color];
3479
+ ;
3480
+ })();
3472
3481
 
3473
3482
  /**
3474
3483
  * Shader tag key.
@@ -3759,6 +3768,10 @@ var ShaderFactory = /*#__PURE__*/ function() {
3759
3768
  this.materialUniformBlock = new ShaderUniformBlock();
3760
3769
  this.otherUniformBlock = new ShaderUniformBlock();
3761
3770
  /** @internal */ this._uploadRenderCount = -1;
3771
+ /** @internal */ this._uploadSceneId = -1;
3772
+ /** @internal */ this._uploadCameraId = -1;
3773
+ /** @internal */ this._uploadRendererId = -1;
3774
+ /** @internal */ this._uploadMaterialId = -1;
3762
3775
  this.attributeLocation = Object.create(null);
3763
3776
  this._activeTextureUint = 0;
3764
3777
  this._engine = engine;
@@ -6924,6 +6937,7 @@ var BufferUtil = /*#__PURE__*/ function() {
6924
6937
  this._isContentLost = false;
6925
6938
  };
6926
6939
  _proto._onDestroy = function _onDestroy() {
6940
+ GraphicsResource1.prototype._onDestroy.call(this);
6927
6941
  this._platformPrimitive.destroy();
6928
6942
  this._vertexElementMap = null;
6929
6943
  };
@@ -11439,10 +11453,8 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
11439
11453
  var vertexStride = this.createVertexElements(vertexElements);
11440
11454
  // vertices
11441
11455
  var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * vertexStride, BufferUsage.Dynamic);
11442
- vertexBuffer.isGCIgnored = true;
11443
11456
  // indices
11444
11457
  var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 6, BufferUsage.Dynamic);
11445
- indiceBuffer.isGCIgnored = true;
11446
11458
  mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
11447
11459
  mesh.setIndexBufferBinding(indiceBuffer, IndexFormat.UInt16);
11448
11460
  mesh.setVertexElements(vertexElements);
@@ -15088,6 +15100,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
15088
15100
  1
15089
15101
  ]); // left-top
15090
15102
  var blitMaterial = new Material(engine, Shader.find("blit"));
15103
+ blitMaterial._addReferCount(1);
15091
15104
  blitMaterial.renderState.depthState.enabled = false;
15092
15105
  blitMaterial.renderState.depthState.writeEnabled = false;
15093
15106
  this.blitMesh = this._createBlitMesh(engine, vertices);
@@ -15787,6 +15800,9 @@ var ComponentCloner = /*#__PURE__*/ function() {
15787
15800
  projectionParams.set(flipProjection ? -1 : 1, virtualCamera.nearClipPlane, virtualCamera.farClipPlane, 0);
15788
15801
  shaderData.setVector4(RenderContext._cameraProjectionProperty, projectionParams);
15789
15802
  };
15803
+ _proto.garbageCollection = function garbageCollection() {
15804
+ this.camera = null;
15805
+ };
15790
15806
  return RenderContext;
15791
15807
  }();
15792
15808
  (function() {
@@ -19919,66 +19935,85 @@ __decorate([
19919
19935
 
19920
19936
  /**
19921
19937
  * @internal
19922
- */ var ParticleBufferUtils = /*#__PURE__*/ function() {
19923
- function ParticleBufferUtils(engine) {
19924
- this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, VertexElementFormat.Vector4, 0);
19925
- this.instanceVertexElements = [
19926
- new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, VertexElementFormat.Vector4, 1, 1),
19927
- new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, VertexElementFormat.Vector4, 1, 1),
19928
- new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, VertexElementFormat.Vector4, 1, 1),
19929
- new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, VertexElementFormat.Vector3, 1, 1),
19930
- new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, VertexElementFormat.Vector3, 1, 1),
19931
- new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, VertexElementFormat.Float, 1, 1),
19932
- new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, VertexElementFormat.Vector4, 1, 1),
19933
- new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, VertexElementFormat.Vector4, 1, 1),
19934
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, VertexElementFormat.Vector3, 1, 1),
19935
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, VertexElementFormat.Vector4, 1, 1),
19936
- new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, VertexElementFormat.Vector4, 1, 1)
19937
- ];
19938
- this.instanceVertexStride = 152;
19939
- this.instanceVertexFloatStride = this.instanceVertexStride / 4;
19940
- this.startLifeTimeOffset = 3;
19941
- this.timeOffset = 7;
19942
- this.simulationUVOffset = 34;
19943
- this.billboardIndexCount = 6;
19944
- var stride = 16;
19945
- var billboardGeometryBuffer = new Buffer(engine, BufferBindFlag.VertexBuffer, stride * 4, BufferUsage.Static, false);
19946
- this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
19947
- var indexBuffer = new Buffer(engine, BufferBindFlag.IndexBuffer, this.billboardIndexCount, BufferUsage.Static, false);
19948
- this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, IndexFormat.UInt8);
19949
- this.setBufferData();
19950
- }
19951
- var _proto = ParticleBufferUtils.prototype;
19952
- _proto.setBufferData = function setBufferData() {
19953
- this.billboardVertexBufferBinding.buffer.setData(new Float32Array([
19954
- -0.5,
19955
- -0.5,
19956
- 0,
19957
- 1,
19958
- 0.5,
19959
- -0.5,
19960
- 1,
19961
- 1,
19962
- 0.5,
19963
- 0.5,
19964
- 1,
19965
- 0,
19966
- -0.5,
19967
- 0.5,
19968
- 0,
19969
- 0
19970
- ]));
19971
- this.billboardIndexBufferBinding.buffer.setData(new Uint8Array([
19972
- 0,
19973
- 2,
19974
- 3,
19975
- 0,
19976
- 1,
19977
- 2
19978
- ]));
19979
- };
19980
- return ParticleBufferUtils;
19981
- }();
19938
+ */ var ParticleBufferUtils = function ParticleBufferUtils(engine) {
19939
+ this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, VertexElementFormat.Vector4, 0);
19940
+ this.instanceVertexElements = [
19941
+ new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, VertexElementFormat.Vector4, 1, 1),
19942
+ new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, VertexElementFormat.Vector4, 1, 1),
19943
+ new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, VertexElementFormat.Vector4, 1, 1),
19944
+ new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, VertexElementFormat.Vector3, 1, 1),
19945
+ new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, VertexElementFormat.Vector3, 1, 1),
19946
+ new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, VertexElementFormat.Float, 1, 1),
19947
+ new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, VertexElementFormat.Vector4, 1, 1),
19948
+ new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, VertexElementFormat.Vector4, 1, 1),
19949
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, VertexElementFormat.Vector3, 1, 1),
19950
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, VertexElementFormat.Vector4, 1, 1),
19951
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, VertexElementFormat.Vector4, 1, 1)
19952
+ ];
19953
+ this.instanceVertexStride = 152;
19954
+ this.instanceVertexFloatStride = this.instanceVertexStride / 4;
19955
+ this.startLifeTimeOffset = 3;
19956
+ this.timeOffset = 7;
19957
+ this.simulationUVOffset = 34;
19958
+ this.billboardIndexCount = 6;
19959
+ var stride = 16;
19960
+ var billboardGeometryBuffer = new Buffer(engine, BufferBindFlag.VertexBuffer, stride * 4, BufferUsage.Static, false);
19961
+ billboardGeometryBuffer.isGCIgnored = true;
19962
+ this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
19963
+ var indexBuffer = new Buffer(engine, BufferBindFlag.IndexBuffer, this.billboardIndexCount, BufferUsage.Static, false);
19964
+ indexBuffer.isGCIgnored = true;
19965
+ this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, IndexFormat.UInt8);
19966
+ var billboardGeometryData = new Float32Array([
19967
+ -0.5,
19968
+ -0.5,
19969
+ 0,
19970
+ 1,
19971
+ 0.5,
19972
+ -0.5,
19973
+ 1,
19974
+ 1,
19975
+ 0.5,
19976
+ 0.5,
19977
+ 1,
19978
+ 0,
19979
+ -0.5,
19980
+ 0.5,
19981
+ 0,
19982
+ 0
19983
+ ]);
19984
+ var indexData = new Uint8Array([
19985
+ 0,
19986
+ 2,
19987
+ 3,
19988
+ 0,
19989
+ 1,
19990
+ 2
19991
+ ]);
19992
+ billboardGeometryBuffer.setData(billboardGeometryData);
19993
+ indexBuffer.setData(indexData);
19994
+ // Register content restorer
19995
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
19996
+ _inherits(_class, ContentRestorer);
19997
+ function _class() {
19998
+ return ContentRestorer.call(this, billboardGeometryBuffer);
19999
+ }
20000
+ var _proto = _class.prototype;
20001
+ _proto.restoreContent = function restoreContent() {
20002
+ billboardGeometryBuffer.setData(billboardGeometryData);
20003
+ };
20004
+ return _class;
20005
+ }(ContentRestorer))());
20006
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
20007
+ _inherits(_class, ContentRestorer);
20008
+ function _class() {
20009
+ return ContentRestorer.call(this, indexBuffer);
20010
+ }
20011
+ var _proto = _class.prototype;
20012
+ _proto.restoreContent = function restoreContent() {
20013
+ };
20014
+ return _class;
20015
+ }(ContentRestorer))());
20016
+ };
19982
20017
 
19983
20018
  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
19984
20019
 
@@ -20680,7 +20715,6 @@ ShaderPool.init();
20680
20715
  resourceManager._restoreGraphicResources();
20681
20716
  console.log("Graphic resource restored.");
20682
20717
  // Restore resources content
20683
- this._particleBufferUtils.setBufferData();
20684
20718
  resourceManager._restoreResourcesContent().then(function() {
20685
20719
  console.log("Graphic resource content restored.\n\n" + "Device restored.");
20686
20720
  _this.dispatch("devicerestored", _this);
@@ -20695,6 +20729,7 @@ ShaderPool.init();
20695
20729
  this._spriteRenderDataPool.garbageCollection();
20696
20730
  this._spriteMaskRenderDataPool.garbageCollection();
20697
20731
  this._textRenderDataPool.garbageCollection();
20732
+ this._renderContext.garbageCollection();
20698
20733
  };
20699
20734
  _create_class(Engine, [
20700
20735
  {
@@ -21052,7 +21087,6 @@ ShaderPool.init();
21052
21087
  };
21053
21088
  _proto._createPlane = function _createPlane(engine) {
21054
21089
  var mesh = new ModelMesh(engine);
21055
- mesh.isGCIgnored = true;
21056
21090
  var indices = new Uint8Array([
21057
21091
  1,
21058
21092
  2,
@@ -23037,22 +23071,6 @@ __decorate([
23037
23071
  maskManager.postRender(renderer);
23038
23072
  }
23039
23073
  };
23040
- _proto.destroy = function destroy() {
23041
- this._batchedQueue = null;
23042
- var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
23043
- for(var i = 0, n = meshes.length; i < n; ++i){
23044
- meshes[i].destroy();
23045
- }
23046
- this._meshes = null;
23047
- for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
23048
- vertexBuffers[i1].destroy();
23049
- }
23050
- this._vertexBuffers = null;
23051
- for(var i2 = 0, n2 = indiceBuffers.length; i2 < n2; ++i2){
23052
- indiceBuffers[i2].destroy();
23053
- }
23054
- this._indiceBuffers = null;
23055
- };
23056
23074
  return SpriteBatcher;
23057
23075
  }(Basic2DBatcher);
23058
23076
  (function() {
@@ -23078,11 +23096,10 @@ __decorate([
23078
23096
  if (elements.length === 0) {
23079
23097
  return;
23080
23098
  }
23081
- var engine = camera.engine, scene = camera.scene;
23099
+ var engine = camera.engine, cameraId = camera.instanceId, cameraData = camera.shaderData;
23100
+ var _camera_scene = camera.scene, sceneData = _camera_scene.shaderData, sceneId = _camera_scene.instanceId;
23082
23101
  var renderCount = engine._renderCount;
23083
23102
  var rhi = engine._hardwareRenderer;
23084
- var sceneData = scene.shaderData;
23085
- var cameraData = camera.shaderData;
23086
23103
  var pipelineStageKey = RenderContext.pipelineStageKey;
23087
23104
  var renderQueueType = this._renderQueueType;
23088
23105
  for(var i = 0, n = elements.length; i < n; i++){
@@ -23094,9 +23111,8 @@ __decorate([
23094
23111
  var primitive = data.primitive;
23095
23112
  var renderer = data.component;
23096
23113
  var material = data.material;
23097
- var rendererData = renderer.shaderData;
23098
- var materialData = material.shaderData;
23099
- var renderStates = material.renderStates;
23114
+ var rendererData = renderer.shaderData, rendererId = renderer.instanceId;
23115
+ var materialData = material.shaderData, materialId = material.instanceId, renderStates = material.renderStates;
23100
23116
  // union render global macro and material self macro.
23101
23117
  ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
23102
23118
  for(var j = 0, m = shaderPasses.length; j < m; j++){
@@ -23122,33 +23138,33 @@ __decorate([
23122
23138
  program.uploadAll(program.materialUniformBlock, materialData);
23123
23139
  // UnGroup textures should upload default value, texture uint maybe change by logic of texture bind.
23124
23140
  program.uploadUnGroupTextures();
23125
- program._uploadScene = scene;
23126
- program._uploadCamera = camera;
23127
- program._uploadRenderer = renderer;
23128
- program._uploadMaterial = material;
23141
+ program._uploadSceneId = sceneId;
23142
+ program._uploadCameraId = cameraId;
23143
+ program._uploadRendererId = rendererId;
23144
+ program._uploadMaterialId = materialId;
23129
23145
  program._uploadRenderCount = renderCount;
23130
23146
  } else {
23131
- if (program._uploadScene !== scene) {
23147
+ if (program._uploadSceneId !== sceneId) {
23132
23148
  program.uploadAll(program.sceneUniformBlock, sceneData);
23133
- program._uploadScene = scene;
23149
+ program._uploadSceneId = sceneId;
23134
23150
  } else if (switchProgram) {
23135
23151
  program.uploadTextures(program.sceneUniformBlock, sceneData);
23136
23152
  }
23137
- if (program._uploadCamera !== camera) {
23153
+ if (program._uploadCameraId !== cameraId) {
23138
23154
  program.uploadAll(program.cameraUniformBlock, cameraData);
23139
- program._uploadCamera = camera;
23155
+ program._uploadCameraId = cameraId;
23140
23156
  } else if (switchProgram) {
23141
23157
  program.uploadTextures(program.cameraUniformBlock, cameraData);
23142
23158
  }
23143
- if (program._uploadRenderer !== renderer) {
23159
+ if (program._uploadRendererId !== rendererId) {
23144
23160
  program.uploadAll(program.rendererUniformBlock, rendererData);
23145
- program._uploadRenderer = renderer;
23161
+ program._uploadRendererId = rendererId;
23146
23162
  } else if (switchProgram) {
23147
23163
  program.uploadTextures(program.rendererUniformBlock, rendererData);
23148
23164
  }
23149
- if (program._uploadMaterial !== material) {
23165
+ if (program._uploadMaterialId !== materialId) {
23150
23166
  program.uploadAll(program.materialUniformBlock, materialData);
23151
- program._uploadMaterial = material;
23167
+ program._uploadMaterialId = materialId;
23152
23168
  } else if (switchProgram) {
23153
23169
  program.uploadTextures(program.materialUniformBlock, materialData);
23154
23170
  }