@xtctwins/tctwins-core 1.1.21 → 1.1.22

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.
@@ -16753,7 +16753,9 @@ texArray.set(positionDecodeMatrices[_i318],_i318*16);}var texture=gl.createTextu
16753
16753
  */var DTXTrianglesLayer=/*#__PURE__*/function(){function DTXTrianglesLayer(model,cfg){_classCallCheck(this,DTXTrianglesLayer);// console.info("Creating DTXTrianglesLayer");
16754
16754
  dataTextureRamStats.numberOfLayers++;this._layerNumber=numLayers++;this.sortId="TriDTX-".concat(this._layerNumber);// State sorting key.
16755
16755
  this.layerIndex=cfg.layerIndex;// Index of this TrianglesDataTextureLayer in {@link SceneModel#_layerList}.
16756
- this._renderers=getRenderers(model.scene);this.model=model;this._buffer=new DTXTrianglesBuffer();this._dtxState=new DTXTrianglesState();this._dtxTextureFactory=new DTXTrianglesTextureFactory();// 构造时读取:需在创建 Viewer/Layer 之前设置 Configs.maxDataTextureHeight 才生效
16756
+ this._renderers=getRenderers(model.scene);this.model=model;// 本层承载的 primitive(同层一致:SceneModel#_getDTXLayer 的 layerId 已含 primitive)。
16757
+ // 用于在 _updateBackfaceCull 里与 VBO 路径保持同一套双面策略。
16758
+ this.primitive=cfg.primitive;this._buffer=new DTXTrianglesBuffer();this._dtxState=new DTXTrianglesState();this._dtxTextureFactory=new DTXTrianglesTextureFactory();// 构造时读取:需在创建 Viewer/Layer 之前设置 Configs.maxDataTextureHeight 才生效
16757
16759
  //(旧实现在模块 import 时读一次,运行时再设无效)。
16758
16760
  this._maxDataTextureHeight=configs.maxDataTextureHeight;this._state=new RenderState({origin:math.vec3(cfg.origin),metallicRoughnessBuf:null,textureState:this._dtxState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numEdgeIndices8Bits:0,numEdgeIndices16Bits:0,numEdgeIndices32Bits:0,numVertices:0});this._numPortions=0;// These counts are used to avoid unnecessary render passes
16759
16761
  this._numVisibleLayerPortions=0;this._numTransparentLayerPortions=0;this._numXRayedLayerPortions=0;this._numSelectedLayerPortions=0;this._numHighlightedLayerPortions=0;this._numClippableLayerPortions=0;this._numEdgesLayerPortions=0;this._numPickableLayerPortions=0;this._numCulledLayerPortions=0;this._subPortions=[];/**
@@ -16914,7 +16916,11 @@ Math.floor(subPortionId/512),// yoffset
16914
16916
  1,// height
16915
16917
  gl.RGBA,gl.FLOAT,tempMat4a);// gl.bindTexture (gl.TEXTURE_2D, null);
16916
16918
  }// ---------------------- COLOR RENDERING -----------------------------------
16917
- },{key:"drawColorOpaque",value:function drawColorOpaque(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(frameCtx.withSAO&&this.model.saoEnabled){if(this._renderers.colorRendererWithSAO){this._renderers.colorRendererWithSAO.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else{if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}}},{key:"_updateBackfaceCull",value:function _updateBackfaceCull(renderFlags,frameCtx){var backfaces=this.model.backfaces||renderFlags.sectioned;if(frameCtx.backfaces!==backfaces){var _gl6=frameCtx.gl;if(backfaces){_gl6.disable(_gl6.CULL_FACE);}else{_gl6.enable(_gl6.CULL_FACE);}frameCtx.backfaces=backfaces;}}},{key:"drawColorTransparent",value:function drawColorTransparent(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===0||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}// ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
16919
+ },{key:"drawColorOpaque",value:function drawColorOpaque(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(frameCtx.withSAO&&this.model.saoEnabled){if(this._renderers.colorRendererWithSAO){this._renderers.colorRendererWithSAO.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else{if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}}},{key:"_updateBackfaceCull",value:function _updateBackfaceCull(renderFlags,frameCtx){// 与 VBO 路径(VBOBatchingTrianglesLayer:1128 / VBOInstancingTrianglesLayer:930)对齐:
16920
+ // surface(开放网格)关闭背面剔除,保证从任意一侧都能看到。
16921
+ // 旧实现只按 model.backfaces 决定,使同一份 surface 几何在 DTX 与 VBO 下透明层数不同:
16922
+ // VBO 双面各画一次,DTX 只画朝向相机的一面,单层玻璃因此明显偏透,观感等同构件缺失。
16923
+ var backfaces=this.model.backfaces||this.primitive!=="solid"||renderFlags.sectioned;if(frameCtx.backfaces!==backfaces){var _gl6=frameCtx.gl;if(backfaces){_gl6.disable(_gl6.CULL_FACE);}else{_gl6.enable(_gl6.CULL_FACE);}frameCtx.backfaces=backfaces;}}},{key:"drawColorTransparent",value:function drawColorTransparent(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===0||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}// ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
16918
16924
  },{key:"drawDepth",value:function drawDepth(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(this._renderers.depthRenderer){this._renderers.depthRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);// Assume whatever post-effect uses depth (eg SAO) does not apply to transparent objects
16919
16925
  }}},{key:"drawNormals",value:function drawNormals(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(this._renderers.normalsRenderer){this._renderers.normalsRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);// Assume whatever post-effect uses normals (eg SAO) does not apply to transparent objects
16920
16926
  }}// ---------------------- SILHOUETTE RENDERING -----------------------------------