@galacean/engine-core 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.
@@ -628,7 +628,7 @@ var Utils = /*#__PURE__*/ function() {
628
628
  if (Utils.isBase64Url(relativeUrl)) {
629
629
  return relativeUrl;
630
630
  }
631
- return relativeUrl ? baseUrl.replace(/\/+$/, "") + "/" + relativeUrl.replace(/^\/+/, "") : baseUrl;
631
+ return relativeUrl ? new engineMiniprogramAdapter.URL(relativeUrl, baseUrl).href : baseUrl;
632
632
  };
633
633
  /**
634
634
  * @internal
@@ -771,14 +771,6 @@ var Utils = /*#__PURE__*/ function() {
771
771
  });
772
772
  return result;
773
773
  };
774
- Utils._formatRelativePath = function _formatRelativePath(path) {
775
- // For example input is "a/b", "/a/b", "./a/b", "./a/./b", "./a/../a/b", output is "a/b"
776
- return path.split("/").filter(Boolean).reduce(function(acc, cur) {
777
- if (cur === "..") acc.pop();
778
- else if (cur !== ".") acc.push(cur);
779
- return acc;
780
- }, []).join("/");
781
- };
782
774
  Utils._insertionSort = function _insertionSort(a, from, to, compareFunc) {
783
775
  for(var i = from + 1; i < to; i++){
784
776
  var j = void 0;
@@ -1668,6 +1660,7 @@ exports.GLCapabilityType = void 0;
1668
1660
  GLCapabilityType["colorBufferHalfFloat"] = "EXT_color_buffer_half_float";
1669
1661
  GLCapabilityType["textureFilterAnisotropic"] = "EXT_texture_filter_anisotropic";
1670
1662
  GLCapabilityType["blendMinMax"] = "EXT_blend_minmax";
1663
+ GLCapabilityType["fragDepth"] = "EXT_frag_depth";
1671
1664
  GLCapabilityType["astc"] = "WEBGL_compressed_texture_astc";
1672
1665
  GLCapabilityType["astc_webkit"] = "WEBKIT_WEBGL_compressed_texture_astc";
1673
1666
  GLCapabilityType["etc"] = "WEBGL_compressed_texture_etc";
@@ -3431,23 +3424,34 @@ var ShaderFactory = /*#__PURE__*/ function() {
3431
3424
  * @param shader - code
3432
3425
  * @param isFrag - Whether it is a fragment shader.
3433
3426
  * */ ShaderFactory.convertTo300 = function convertTo300(shader, isFrag) {
3434
- /** replace attribute and in */ shader = shader.replace(/\battribute\b/g, "in");
3435
3427
  shader = shader.replace(/\bvarying\b/g, isFrag ? "in" : "out");
3436
- /** replace api */ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
3437
- shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
3428
+ shader = shader.replace(/\btexture(2D|Cube)\b/g, "texture");
3429
+ shader = shader.replace(/\btexture2DProj\b/g, "textureProj");
3438
3430
  if (isFrag) {
3439
- var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
3440
- if (isMRT) {
3441
- shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
3442
- var result = shader.match(/\bgl_FragData\[.+?\]/g);
3443
- shader = this._replaceMRTShader(shader, result);
3444
- } else {
3445
- shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
3446
- shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
3431
+ shader = shader.replace(/\btexture(2D|Cube)LodEXT\b/g, "textureLod");
3432
+ shader = shader.replace(/\btexture(2D|Cube)GradEXT\b/g, "textureGrad");
3433
+ shader = shader.replace(/\btexture2DProjLodEXT\b/g, "textureProjLod");
3434
+ shader = shader.replace(/\btexture2DProjGradEXT\b/g, "textureProjGrad");
3435
+ shader = shader.replace(/\bgl_FragDepthEXT\b/g, "gl_FragDepth");
3436
+ if (!ShaderFactory._has300Output(shader)) {
3437
+ var isMRT = /\bgl_FragData\[.+?\]/g.test(shader);
3438
+ if (isMRT) {
3439
+ shader = shader.replace(/\bgl_FragColor\b/g, "gl_FragData[0]");
3440
+ var result = shader.match(/\bgl_FragData\[.+?\]/g);
3441
+ shader = this._replaceMRTShader(shader, result);
3442
+ } else {
3443
+ shader = shader.replace(/void\s+?main\s*\(/g, "out vec4 glFragColor;\nvoid main(");
3444
+ shader = shader.replace(/\bgl_FragColor\b/g, "glFragColor");
3445
+ }
3447
3446
  }
3447
+ } else {
3448
+ shader = shader.replace(/\battribute\b/g, "in");
3448
3449
  }
3449
3450
  return shader;
3450
3451
  };
3452
+ ShaderFactory._has300Output = function _has300Output(fragmentShader) {
3453
+ return ShaderFactory._has300OutInFragReg.test(fragmentShader);
3454
+ };
3451
3455
  ShaderFactory._replaceMRTShader = function _replaceMRTShader(shader, result) {
3452
3456
  var declaration = "";
3453
3457
  var mrtIndexSet = new Set();
@@ -3469,11 +3473,16 @@ var ShaderFactory = /*#__PURE__*/ function() {
3469
3473
  /** @internal */ ShaderFactory._shaderExtension = [
3470
3474
  "GL_EXT_shader_texture_lod",
3471
3475
  "GL_OES_standard_derivatives",
3472
- "GL_EXT_draw_buffers"
3476
+ "GL_EXT_draw_buffers",
3477
+ "GL_EXT_frag_depth"
3473
3478
  ].map(function(e) {
3474
3479
  return "#extension " + e + " : enable\n";
3475
3480
  }).join("");
3476
3481
  })();
3482
+ (function() {
3483
+ ShaderFactory._has300OutInFragReg = /\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/ // [layout(location = 0)] out [highp] vec4 [color];
3484
+ ;
3485
+ })();
3477
3486
 
3478
3487
  /**
3479
3488
  * Shader tag key.
@@ -3764,6 +3773,10 @@ var ShaderFactory = /*#__PURE__*/ function() {
3764
3773
  this.materialUniformBlock = new ShaderUniformBlock();
3765
3774
  this.otherUniformBlock = new ShaderUniformBlock();
3766
3775
  /** @internal */ this._uploadRenderCount = -1;
3776
+ /** @internal */ this._uploadSceneId = -1;
3777
+ /** @internal */ this._uploadCameraId = -1;
3778
+ /** @internal */ this._uploadRendererId = -1;
3779
+ /** @internal */ this._uploadMaterialId = -1;
3767
3780
  this.attributeLocation = Object.create(null);
3768
3781
  this._activeTextureUint = 0;
3769
3782
  this._engine = engine;
@@ -11445,10 +11458,8 @@ var Basic2DBatcher = /*#__PURE__*/ function() {
11445
11458
  var vertexStride = this.createVertexElements(vertexElements);
11446
11459
  // vertices
11447
11460
  var vertexBuffer = this._vertexBuffers[index] = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, MAX_VERTEX_COUNT * vertexStride, exports.BufferUsage.Dynamic);
11448
- vertexBuffer.isGCIgnored = true;
11449
11461
  // indices
11450
11462
  var indiceBuffer = this._indiceBuffers[index] = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, MAX_VERTEX_COUNT * 6, exports.BufferUsage.Dynamic);
11451
- indiceBuffer.isGCIgnored = true;
11452
11463
  mesh.setVertexBufferBinding(vertexBuffer, vertexStride);
11453
11464
  mesh.setIndexBufferBinding(indiceBuffer, exports.IndexFormat.UInt16);
11454
11465
  mesh.setVertexElements(vertexElements);
@@ -15094,6 +15105,7 @@ var BaseMaterial = /*#__PURE__*/ function(Material1) {
15094
15105
  1
15095
15106
  ]); // left-top
15096
15107
  var blitMaterial = new Material(engine, Shader.find("blit"));
15108
+ blitMaterial._addReferCount(1);
15097
15109
  blitMaterial.renderState.depthState.enabled = false;
15098
15110
  blitMaterial.renderState.depthState.writeEnabled = false;
15099
15111
  this.blitMesh = this._createBlitMesh(engine, vertices);
@@ -15793,6 +15805,9 @@ var ComponentCloner = /*#__PURE__*/ function() {
15793
15805
  projectionParams.set(flipProjection ? -1 : 1, virtualCamera.nearClipPlane, virtualCamera.farClipPlane, 0);
15794
15806
  shaderData.setVector4(RenderContext._cameraProjectionProperty, projectionParams);
15795
15807
  };
15808
+ _proto.garbageCollection = function garbageCollection() {
15809
+ this.camera = null;
15810
+ };
15796
15811
  return RenderContext;
15797
15812
  }();
15798
15813
  (function() {
@@ -19451,7 +19466,8 @@ __decorate([
19451
19466
  /** @internal */ this._upList = new DisorderedArray();
19452
19467
  /** @internal */ this._downList = new DisorderedArray();
19453
19468
  this._nativeEvents = [];
19454
- if (_instanceof(target, Window)) {
19469
+ // Temporary solution for mini program, window does not exist
19470
+ if (typeof Window !== "undefined" && _instanceof(target, Window)) {
19455
19471
  throw "Do not set window as target because window cannot listen to pointer leave event.";
19456
19472
  }
19457
19473
  this._engine = engine;
@@ -19925,66 +19941,85 @@ __decorate([
19925
19941
 
19926
19942
  /**
19927
19943
  * @internal
19928
- */ var ParticleBufferUtils = /*#__PURE__*/ function() {
19929
- function ParticleBufferUtils(engine) {
19930
- this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
19931
- this.instanceVertexElements = [
19932
- new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
19933
- new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
19934
- new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
19935
- new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
19936
- new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
19937
- new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
19938
- new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
19939
- new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
19940
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
19941
- new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
19942
- new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
19943
- ];
19944
- this.instanceVertexStride = 152;
19945
- this.instanceVertexFloatStride = this.instanceVertexStride / 4;
19946
- this.startLifeTimeOffset = 3;
19947
- this.timeOffset = 7;
19948
- this.simulationUVOffset = 34;
19949
- this.billboardIndexCount = 6;
19950
- var stride = 16;
19951
- var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
19952
- this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
19953
- var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
19954
- this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
19955
- this.setBufferData();
19956
- }
19957
- var _proto = ParticleBufferUtils.prototype;
19958
- _proto.setBufferData = function setBufferData() {
19959
- this.billboardVertexBufferBinding.buffer.setData(new Float32Array([
19960
- -0.5,
19961
- -0.5,
19962
- 0,
19963
- 1,
19964
- 0.5,
19965
- -0.5,
19966
- 1,
19967
- 1,
19968
- 0.5,
19969
- 0.5,
19970
- 1,
19971
- 0,
19972
- -0.5,
19973
- 0.5,
19974
- 0,
19975
- 0
19976
- ]));
19977
- this.billboardIndexBufferBinding.buffer.setData(new Uint8Array([
19978
- 0,
19979
- 2,
19980
- 3,
19981
- 0,
19982
- 1,
19983
- 2
19984
- ]));
19985
- };
19986
- return ParticleBufferUtils;
19987
- }();
19944
+ */ var ParticleBufferUtils = function ParticleBufferUtils(engine) {
19945
+ this.billboardVertexElement = new VertexElement(ParticleBillboardVertexAttribute.cornerTextureCoordinate, 0, exports.VertexElementFormat.Vector4, 0);
19946
+ this.instanceVertexElements = [
19947
+ new VertexElement(ParticleInstanceVertexAttribute.ShapePositionStartLifeTime, 0, exports.VertexElementFormat.Vector4, 1, 1),
19948
+ new VertexElement(ParticleInstanceVertexAttribute.DirectionTime, 16, exports.VertexElementFormat.Vector4, 1, 1),
19949
+ new VertexElement(ParticleInstanceVertexAttribute.StartColor, 32, exports.VertexElementFormat.Vector4, 1, 1),
19950
+ new VertexElement(ParticleInstanceVertexAttribute.StartSize, 48, exports.VertexElementFormat.Vector3, 1, 1),
19951
+ new VertexElement(ParticleInstanceVertexAttribute.StartRotation0, 60, exports.VertexElementFormat.Vector3, 1, 1),
19952
+ new VertexElement(ParticleInstanceVertexAttribute.StartSpeed, 72, exports.VertexElementFormat.Float, 1, 1),
19953
+ new VertexElement(ParticleInstanceVertexAttribute.Random0, 76, exports.VertexElementFormat.Vector4, 1, 1),
19954
+ new VertexElement(ParticleInstanceVertexAttribute.Random1, 92, exports.VertexElementFormat.Vector4, 1, 1),
19955
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldPosition, 108, exports.VertexElementFormat.Vector3, 1, 1),
19956
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationWorldRotation, 120, exports.VertexElementFormat.Vector4, 1, 1),
19957
+ new VertexElement(ParticleInstanceVertexAttribute.SimulationUV, 136, exports.VertexElementFormat.Vector4, 1, 1)
19958
+ ];
19959
+ this.instanceVertexStride = 152;
19960
+ this.instanceVertexFloatStride = this.instanceVertexStride / 4;
19961
+ this.startLifeTimeOffset = 3;
19962
+ this.timeOffset = 7;
19963
+ this.simulationUVOffset = 34;
19964
+ this.billboardIndexCount = 6;
19965
+ var stride = 16;
19966
+ var billboardGeometryBuffer = new Buffer(engine, exports.BufferBindFlag.VertexBuffer, stride * 4, exports.BufferUsage.Static, false);
19967
+ billboardGeometryBuffer.isGCIgnored = true;
19968
+ this.billboardVertexBufferBinding = new VertexBufferBinding(billboardGeometryBuffer, stride);
19969
+ var indexBuffer = new Buffer(engine, exports.BufferBindFlag.IndexBuffer, this.billboardIndexCount, exports.BufferUsage.Static, false);
19970
+ indexBuffer.isGCIgnored = true;
19971
+ this.billboardIndexBufferBinding = new IndexBufferBinding(indexBuffer, exports.IndexFormat.UInt8);
19972
+ var billboardGeometryData = new Float32Array([
19973
+ -0.5,
19974
+ -0.5,
19975
+ 0,
19976
+ 1,
19977
+ 0.5,
19978
+ -0.5,
19979
+ 1,
19980
+ 1,
19981
+ 0.5,
19982
+ 0.5,
19983
+ 1,
19984
+ 0,
19985
+ -0.5,
19986
+ 0.5,
19987
+ 0,
19988
+ 0
19989
+ ]);
19990
+ var indexData = new Uint8Array([
19991
+ 0,
19992
+ 2,
19993
+ 3,
19994
+ 0,
19995
+ 1,
19996
+ 2
19997
+ ]);
19998
+ billboardGeometryBuffer.setData(billboardGeometryData);
19999
+ indexBuffer.setData(indexData);
20000
+ // Register content restorer
20001
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
20002
+ _inherits(_class, ContentRestorer);
20003
+ function _class() {
20004
+ return ContentRestorer.call(this, billboardGeometryBuffer);
20005
+ }
20006
+ var _proto = _class.prototype;
20007
+ _proto.restoreContent = function restoreContent() {
20008
+ billboardGeometryBuffer.setData(billboardGeometryData);
20009
+ };
20010
+ return _class;
20011
+ }(ContentRestorer))());
20012
+ engine.resourceManager.addContentRestorer(new /*#__PURE__*/ (function(ContentRestorer) {
20013
+ _inherits(_class, ContentRestorer);
20014
+ function _class() {
20015
+ return ContentRestorer.call(this, indexBuffer);
20016
+ }
20017
+ var _proto = _class.prototype;
20018
+ _proto.restoreContent = function restoreContent() {
20019
+ };
20020
+ return _class;
20021
+ }(ContentRestorer))());
20022
+ };
19988
20023
 
19989
20024
  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
19990
20025
 
@@ -20686,7 +20721,6 @@ ShaderPool.init();
20686
20721
  resourceManager._restoreGraphicResources();
20687
20722
  console.log("Graphic resource restored.");
20688
20723
  // Restore resources content
20689
- this._particleBufferUtils.setBufferData();
20690
20724
  resourceManager._restoreResourcesContent().then(function() {
20691
20725
  console.log("Graphic resource content restored.\n\n" + "Device restored.");
20692
20726
  _this.dispatch("devicerestored", _this);
@@ -20701,6 +20735,7 @@ ShaderPool.init();
20701
20735
  this._spriteRenderDataPool.garbageCollection();
20702
20736
  this._spriteMaskRenderDataPool.garbageCollection();
20703
20737
  this._textRenderDataPool.garbageCollection();
20738
+ this._renderContext.garbageCollection();
20704
20739
  };
20705
20740
  _create_class(Engine, [
20706
20741
  {
@@ -21058,7 +21093,6 @@ ShaderPool.init();
21058
21093
  };
21059
21094
  _proto._createPlane = function _createPlane(engine) {
21060
21095
  var mesh = new ModelMesh(engine);
21061
- mesh.isGCIgnored = true;
21062
21096
  var indices = new Uint8Array([
21063
21097
  1,
21064
21098
  2,
@@ -23043,22 +23077,6 @@ __decorate([
23043
23077
  maskManager.postRender(renderer);
23044
23078
  }
23045
23079
  };
23046
- _proto.destroy = function destroy() {
23047
- this._batchedQueue = null;
23048
- var _this = this, meshes = _this._meshes, vertexBuffers = _this._vertexBuffers, indiceBuffers = _this._indiceBuffers;
23049
- for(var i = 0, n = meshes.length; i < n; ++i){
23050
- meshes[i].destroy();
23051
- }
23052
- this._meshes = null;
23053
- for(var i1 = 0, n1 = vertexBuffers.length; i1 < n1; ++i1){
23054
- vertexBuffers[i1].destroy();
23055
- }
23056
- this._vertexBuffers = null;
23057
- for(var i2 = 0, n2 = indiceBuffers.length; i2 < n2; ++i2){
23058
- indiceBuffers[i2].destroy();
23059
- }
23060
- this._indiceBuffers = null;
23061
- };
23062
23080
  return SpriteBatcher;
23063
23081
  }(Basic2DBatcher);
23064
23082
  (function() {
@@ -23084,11 +23102,10 @@ __decorate([
23084
23102
  if (elements.length === 0) {
23085
23103
  return;
23086
23104
  }
23087
- var engine = camera.engine, scene = camera.scene;
23105
+ var engine = camera.engine, cameraId = camera.instanceId, cameraData = camera.shaderData;
23106
+ var _camera_scene = camera.scene, sceneData = _camera_scene.shaderData, sceneId = _camera_scene.instanceId;
23088
23107
  var renderCount = engine._renderCount;
23089
23108
  var rhi = engine._hardwareRenderer;
23090
- var sceneData = scene.shaderData;
23091
- var cameraData = camera.shaderData;
23092
23109
  var pipelineStageKey = RenderContext.pipelineStageKey;
23093
23110
  var renderQueueType = this._renderQueueType;
23094
23111
  for(var i = 0, n = elements.length; i < n; i++){
@@ -23100,9 +23117,8 @@ __decorate([
23100
23117
  var primitive = data.primitive;
23101
23118
  var renderer = data.component;
23102
23119
  var material = data.material;
23103
- var rendererData = renderer.shaderData;
23104
- var materialData = material.shaderData;
23105
- var renderStates = material.renderStates;
23120
+ var rendererData = renderer.shaderData, rendererId = renderer.instanceId;
23121
+ var materialData = material.shaderData, materialId = material.instanceId, renderStates = material.renderStates;
23106
23122
  // union render global macro and material self macro.
23107
23123
  ShaderMacroCollection.unionCollection(renderer._globalShaderMacro, materialData._macroCollection, compileMacros);
23108
23124
  for(var j = 0, m = shaderPasses.length; j < m; j++){
@@ -23128,33 +23144,33 @@ __decorate([
23128
23144
  program.uploadAll(program.materialUniformBlock, materialData);
23129
23145
  // UnGroup textures should upload default value, texture uint maybe change by logic of texture bind.
23130
23146
  program.uploadUnGroupTextures();
23131
- program._uploadScene = scene;
23132
- program._uploadCamera = camera;
23133
- program._uploadRenderer = renderer;
23134
- program._uploadMaterial = material;
23147
+ program._uploadSceneId = sceneId;
23148
+ program._uploadCameraId = cameraId;
23149
+ program._uploadRendererId = rendererId;
23150
+ program._uploadMaterialId = materialId;
23135
23151
  program._uploadRenderCount = renderCount;
23136
23152
  } else {
23137
- if (program._uploadScene !== scene) {
23153
+ if (program._uploadSceneId !== sceneId) {
23138
23154
  program.uploadAll(program.sceneUniformBlock, sceneData);
23139
- program._uploadScene = scene;
23155
+ program._uploadSceneId = sceneId;
23140
23156
  } else if (switchProgram) {
23141
23157
  program.uploadTextures(program.sceneUniformBlock, sceneData);
23142
23158
  }
23143
- if (program._uploadCamera !== camera) {
23159
+ if (program._uploadCameraId !== cameraId) {
23144
23160
  program.uploadAll(program.cameraUniformBlock, cameraData);
23145
- program._uploadCamera = camera;
23161
+ program._uploadCameraId = cameraId;
23146
23162
  } else if (switchProgram) {
23147
23163
  program.uploadTextures(program.cameraUniformBlock, cameraData);
23148
23164
  }
23149
- if (program._uploadRenderer !== renderer) {
23165
+ if (program._uploadRendererId !== rendererId) {
23150
23166
  program.uploadAll(program.rendererUniformBlock, rendererData);
23151
- program._uploadRenderer = renderer;
23167
+ program._uploadRendererId = rendererId;
23152
23168
  } else if (switchProgram) {
23153
23169
  program.uploadTextures(program.rendererUniformBlock, rendererData);
23154
23170
  }
23155
- if (program._uploadMaterial !== material) {
23171
+ if (program._uploadMaterialId !== materialId) {
23156
23172
  program.uploadAll(program.materialUniformBlock, materialData);
23157
- program._uploadMaterial = material;
23173
+ program._uploadMaterialId = materialId;
23158
23174
  } else if (switchProgram) {
23159
23175
  program.uploadTextures(program.materialUniformBlock, materialData);
23160
23176
  }