@combeenation/3d-viewer 12.0.0-alpha2 → 12.0.0-alpha3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combeenation/3d-viewer",
3
- "version": "12.0.0-alpha2",
3
+ "version": "12.0.0-alpha3",
4
4
  "description": "Combeenation 3D Viewer",
5
5
  "homepage": "https://github.com/Combeenation/3d-viewer#readme",
6
6
  "bugs": {
@@ -59,6 +59,8 @@ export class GltfExportManager {
59
59
  }
60
60
 
61
61
  protected async _exportPreProcess(excluded?: ExcludedGeometryList): Promise<void> {
62
+ this.viewer.pauseRendering();
63
+
62
64
  // handle materials
63
65
  this.viewer.scene.materials
64
66
  .filter(material => this._shouldReplaceMaterial(material))
@@ -75,7 +77,7 @@ export class GltfExportManager {
75
77
 
76
78
  // reset transformation of all "TransformNodes", which couldn't be handled by the geometry baking algorithm
77
79
  // it's important that this is done AFTER all geometries have been baked
78
- this.viewer.scene.transformNodes
80
+ [...this.viewer.scene.transformNodes, ...this.viewer.scene.meshes]
79
81
  .filter(node => !!node.metadata?.[GltfExportManager._METADATA_PROPS.exportNode])
80
82
  .forEach(node => resetTransformation(node as TransformNode));
81
83
  }
@@ -89,6 +91,8 @@ export class GltfExportManager {
89
91
  this.viewer.scene.materials
90
92
  .filter(mat => !!mat.metadata?.[GltfExportManager._METADATA_PROPS.deleteAfterExport])
91
93
  .forEach(material => material.dispose(false, false));
94
+
95
+ this.viewer.resumeRendering();
92
96
  }
93
97
 
94
98
  protected _gltfExportOptions(): IExportOptions {
@@ -176,12 +180,12 @@ export class GltfExportManager {
176
180
  /**
177
181
  * Create an export-friendly replacement material for a material using refraction.
178
182
  */
179
- protected _createRefractionMaterialReplacement(material: PBRMaterial): PBRMaterial {
183
+ protected _createRefractionMaterialReplacement(material: PBRMaterial) {
180
184
  const newName = `${material.name}_clone`;
181
- // change material according to https://www.notion.so/combeenation/Glas-materials-don-t-look-glasy-after-export-d5fda2c6515e4420a8772744d3e6b460
182
- const clonedMaterial = material.clone(newName); // clone material
185
+
186
+ const clonedMaterial = material.clone(newName);
183
187
  clonedMaterial.refractionTexture = null;
184
- clonedMaterial.metallicReflectanceTexture = null; // is this the correct one for metallic roughness?
188
+ clonedMaterial.metallicReflectanceTexture = null;
185
189
  clonedMaterial.alpha = 0.7;
186
190
  clonedMaterial.albedoColor = new Color3(0.3, 0.3, 0.3);
187
191
  clonedMaterial.transparencyMode = PBRMaterial.PBRMATERIAL_ALPHABLEND;
@@ -190,7 +194,5 @@ export class GltfExportManager {
190
194
 
191
195
  injectMetadata(material, { [GltfExportManager._METADATA_PROPS.exchangeMaterialWith]: newName });
192
196
  injectMetadata(clonedMaterial, { [GltfExportManager._METADATA_PROPS.deleteAfterExport]: true });
193
-
194
- return clonedMaterial;
195
197
  }
196
198
  }