@combeenation/3d-viewer 9.2.0-beta1 → 9.2.0
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/lib-cjs/api/manager/gltfExportManager.js +9 -1
- package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
- package/dist/lib-cjs/api/util/geometryHelper.js +8 -4
- package/dist/lib-cjs/api/util/geometryHelper.js.map +1 -1
- package/dist/lib-cjs/api/util/structureHelper.js +0 -1
- package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
- package/dist/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/api/manager/gltfExportManager.ts +9 -7
- package/src/api/util/geometryHelper.ts +8 -4
- package/src/api/util/structureHelper.ts +0 -1
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { Viewer } from '../classes/viewer';
|
|
|
3
3
|
import { injectMetadata } from '../util/babylonHelper';
|
|
4
4
|
import { isNodeIncludedInExclusionList } from '../util/structureHelper';
|
|
5
5
|
import { Engine } from '@babylonjs/core/Engines/engine';
|
|
6
|
+
import { EngineStore } from '@babylonjs/core/Engines/engineStore';
|
|
6
7
|
import { SceneLoader } from '@babylonjs/core/Loading/sceneLoader';
|
|
7
8
|
import { PBRMaterial } from '@babylonjs/core/Materials/PBR/pbrMaterial';
|
|
8
9
|
import { Color3 } from '@babylonjs/core/Maths/math.color';
|
|
@@ -199,14 +200,15 @@ export class GltfExportManager {
|
|
|
199
200
|
engine.getCaps().maxTextureSize = 1024;
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
// overwritting _LastCreatedScene to fix issue: https://combeenation.youtrack.cloud/issue/CB-8972
|
|
204
|
+
// In short: dummy scene erroneously interacts with original viewer scene
|
|
205
|
+
// setting viewer scene as fallback again (`_LastCreatedScene`) resolves that issue
|
|
206
|
+
const curLastScene = EngineStore._LastCreatedScene;
|
|
207
|
+
const newScene = new Scene(engine);
|
|
208
|
+
EngineStore._LastCreatedScene = curLastScene;
|
|
209
|
+
|
|
202
210
|
SceneLoader.ShowLoadingScreen = false;
|
|
203
|
-
|
|
204
|
-
'',
|
|
205
|
-
'data:' + JSON.stringify(serializedScene),
|
|
206
|
-
engine,
|
|
207
|
-
undefined,
|
|
208
|
-
'.babylon'
|
|
209
|
-
);
|
|
211
|
+
await SceneLoader.AppendAsync('', 'data:' + JSON.stringify(serializedScene), newScene, undefined, '.babylon');
|
|
210
212
|
|
|
211
213
|
return newScene;
|
|
212
214
|
}
|
|
@@ -82,6 +82,10 @@ const bakeGeometryOfMesh = function (mesh: Mesh) {
|
|
|
82
82
|
mesh.bakeCurrentTransformIntoVertices();
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* @param kind morph targets can affect various vertices kinds, whereas "position" is the most common one
|
|
87
|
+
* still other kinds (like normals or tangents) can be affected as well and can be provided on this input
|
|
88
|
+
*/
|
|
85
89
|
const bakeMorphTargetManagerIntoVertices = function (
|
|
86
90
|
kind: string,
|
|
87
91
|
morphTargetManager: MorphTargetManager,
|
|
@@ -113,13 +117,13 @@ const bakeMorphTargetManagerIntoVertices = function (
|
|
|
113
117
|
|
|
114
118
|
const getVerticesDataFromMorphTarget = function (kind: string, morphTarget: MorphTarget): Nullable<FloatArray> {
|
|
115
119
|
switch (kind) {
|
|
116
|
-
case
|
|
120
|
+
case VertexBuffer.PositionKind:
|
|
117
121
|
return morphTarget.getPositions();
|
|
118
|
-
case
|
|
122
|
+
case VertexBuffer.NormalKind:
|
|
119
123
|
return morphTarget.getNormals();
|
|
120
|
-
case
|
|
124
|
+
case VertexBuffer.TangentKind:
|
|
121
125
|
return morphTarget.getTangents();
|
|
122
|
-
case
|
|
126
|
+
case VertexBuffer.UVKind:
|
|
123
127
|
return morphTarget.getUVs();
|
|
124
128
|
}
|
|
125
129
|
|
|
@@ -13,7 +13,6 @@ import { Tags } from '@babylonjs/core/Misc/tags';
|
|
|
13
13
|
*/
|
|
14
14
|
const isNodeIncludedInExclusionList = function (node: TransformNode, list: ExcludedGeometryList): boolean {
|
|
15
15
|
const checkNode = (inputNode: TransformNode, nodeToCheck: TransformNode) => {
|
|
16
|
-
// return inputNode.uniqueId === nodeToCheck.uniqueId;
|
|
17
16
|
// check name instead of unique id, since the unique id changes when copying the scene, which is the case in the
|
|
18
17
|
// GLB export
|
|
19
18
|
const nodeName = nodeToCheck.metadata?.[GltfExportManager.NAME_BEFORE_EXPORT_METADATA_PROPERTY] ?? nodeToCheck.name;
|