Skip to content

Commit

Permalink
Merge branch 'master' into hflatval/load-error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonflatval-cognite authored Aug 29, 2023
2 parents 6c0aa9e + a65ad05 commit d8548f8
Show file tree
Hide file tree
Showing 15 changed files with 113 additions and 98 deletions.
2 changes: 1 addition & 1 deletion documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"ws:replace": "replace"
},
"dependencies": {
"@azure/msal-browser": "2.38.1",
"@azure/msal-browser": "2.38.2",
"@codemirror/lang-javascript": "6.1.9",
"@docusaurus/core": "2.4.1",
"@docusaurus/preset-classic": "2.4.1",
Expand Down
20 changes: 10 additions & 10 deletions documentation/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@types/react-dom": "18.2.4",
"@types/stats.js": "^0.17.0",
"@types/styled-components": "^5.1.26",
"@types/three": "0.155.0",
"@types/three": "0.155.1",
"css-loader": "^6.7.1",
"dotenv-webpack": "^7.1.0",
"html-webpack-plugin": "^5.5.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions react-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cognite/reveal-react-components",
"version": "0.12.0",
"version": "0.13.0",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
Expand All @@ -18,7 +18,7 @@
},
"peerDependencies": {
"@cognite/cogs.js": ">=9",
"@cognite/reveal": "4.4.0",
"@cognite/reveal": "4.4.1",
"react": ">=18",
"react-dom": ">=18",
"styled-components": ">=5"
Expand All @@ -28,7 +28,7 @@
"@babel/preset-react": "7.22.5",
"@babel/preset-typescript": "7.22.5",
"@cognite/cogs.js": "^9.17.0",
"@cognite/reveal": "4.4.0",
"@cognite/reveal": "4.4.1",
"@cognite/sdk": "^8.2.0",
"@storybook/addon-essentials": "7.3.2",
"@storybook/addon-interactions": "7.3.2",
Expand All @@ -42,7 +42,7 @@
"@types/react": "18.2.7",
"@types/react-dom": "^18.2.7",
"@types/styled-components": "5.1.26",
"@types/three": "0.155.0",
"@types/three": "0.155.1",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^9.0.0",
Expand Down
1 change: 0 additions & 1 deletion react-components/src/hooks/useCalculateModelsStyling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export const useCalculateCadStyling = (
defaultResourceStyling?.cad?.mapped
);
const modelInstanceStyleGroups = useCalculateInstanceStyling(models, instanceGroups);
console.log('Model instance style groups = ', modelInstanceStyleGroups);
const joinedStyleGroups = useJoinStylingGroups(
models,
modelsMappedStyleGroups,
Expand Down
24 changes: 12 additions & 12 deletions react-components/yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions viewer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cognite/reveal",
"version": "4.4.0",
"version": "4.4.1",
"description": "WebGL based 3D viewer for CAD and point clouds processed in Cognite Data Fusion.",
"homepage": "https://github.com/cognitedata/reveal/tree/master/viewer",
"repository": {
Expand Down Expand Up @@ -78,27 +78,27 @@
"sparse-octree": "7.1.8"
},
"devDependencies": {
"@azure/msal-browser": "2.38.1",
"@azure/msal-browser": "2.38.2",
"@cognite/sdk": "8.2.0",
"@microsoft/api-extractor": "^7.33.6",
"@types/dat.gui": "0.7.10",
"@types/gl": "^6.0.2",
"@types/glob": "8.1.0",
"@types/jest": "29.5.3",
"@types/jest": "29.5.4",
"@types/jest-environment-puppeteer": "5.0.3",
"@types/jest-image-snapshot": "6.2.0",
"@types/jsdom": "21.1.1",
"@types/jsdom": "21.1.2",
"@types/lodash": "4.14.197",
"@types/mixpanel-browser": "2.47.1",
"@types/node": "18.17.6",
"@types/node": "18.17.9",
"@types/random-seed": "0.3.3",
"@types/skmeans": "0.11.4",
"@types/stats": "0.16.30",
"@types/three": "0.155.0",
"@types/three": "0.155.1",
"@types/tween.js": "18.5.1",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"concurrently": "8.2.0",
"concurrently": "8.2.1",
"cross-env": "7.0.3",
"dat.gui": "0.7.9",
"eslint": "8.47.0",
Expand All @@ -113,9 +113,9 @@
"glob": "10.3.3",
"glslify-loader": "2.0.0",
"html-webpack-plugin": "5.5.3",
"jest": "29.6.3",
"jest": "29.6.4",
"jest-canvas-mock": "2.5.2",
"jest-environment-jsdom": "29.6.3",
"jest-environment-jsdom": "29.6.4",
"jest-extended": "4.0.1",
"jest-image-snapshot": "6.2.0",
"jest-puppeteer": "9.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function createDetermineSectorsInput([settings, _, camera, clipping, models]: [
ClippingInput,
CadNode[]
]): DetermineSectorsPayload {
const prioritizedAreas = models.flatMap(model => model.prioritizedAreas);
const prioritizedAreas = models.filter(model => !model.isDisposed).flatMap(model => model.prioritizedAreas);
return {
...camera,
...settings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class SectorLoader {
}

const cadModels = input.models;
const visibleCadModels = cadModels.filter(x => x.visible);
const visibleCadModels = cadModels.filter(x => x.visible && !x.isDisposed);

const sectorCullerInput: DetermineSectorsInput = {
...input,
Expand Down
8 changes: 8 additions & 0 deletions viewer/packages/cad-model/src/wrappers/CadNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class CadNode extends Object3D {
private readonly _batchedGeometryMeshGroup: Group;
private readonly _styledTreeIndexSets: StyledTreeIndexSets;

private _isDisposed: boolean = false;

private _needsRedraw: boolean = false;

public readonly treeIndexToSectorsMap = new TreeIndexToSectorsMap();
Expand Down Expand Up @@ -153,6 +155,10 @@ export class CadNode extends Object3D {
return this._materialManager.getRenderMode();
}

get isDisposed(): boolean {
return this._isDisposed;
}

public loadSector(sector: WantedSector, abortSignal?: AbortSignal): Promise<ConsumedSector> {
return this._sectorRepository.loadSector(sector, abortSignal);
}
Expand Down Expand Up @@ -203,13 +209,15 @@ export class CadNode extends Object3D {
}

public dispose(): void {
this.nodeAppearanceProvider.dispose();
this.nodeAppearanceProvider.off('changed', this._setModelRenderLayers);
this._sectorRepository.clearCache();
this._materialManager.removeModelMaterials(this._cadModelMetadata.modelIdentifier);
this._geometryBatchingManager?.dispose();
this._rootSector?.dereferenceAllNodes();
this._rootSector?.clear();
this.clear();
this._isDisposed = true;

delete this._geometryBatchingManager;
// @ts-ignore
Expand Down
7 changes: 7 additions & 0 deletions viewer/packages/cad-styling/src/NodeAppearanceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ export class NodeAppearanceProvider {
return this._styledCollections.some(x => x.nodeCollection.isLoading);
}

dispose(): void {
this.scheduleNotifyChanged.cancel();
this._events.changed.unsubscribeAll();
this._events.loadingStateChanged.unsubscribeAll();
this._events.prioritizedAreasChanged.unsubscribeAll();
}

private notifyChanged() {
this._cachedPrioritizedAreas = undefined;
this._events.changed.fire();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default class HighlightedVisualTest extends StreamingVisualTestFixture {
.getModelNodeAppearanceProvider(modelIdentifier)
.assignStyledNodeCollection(nodes, DefaultNodeAppearance.Highlighted);

// Styles are not applied immidiatly, so wait a little for styling to take effect
// Styles are not applied immediately, so wait a little for styling to take effect
await new Promise(resolve => setTimeout(resolve, 100));

model.geometryNode.position.set(25, 0, -15);
Expand Down
1 change: 1 addition & 0 deletions viewer/packages/rendering/src/CadMaterialManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export class CadMaterialManager {
for (const [_, wrapper] of this.materialsMap) {
wrapper.nodeAppearanceTextureBuilder.dispose();
wrapper.nodeTransformTextureBuilder.dispose();
wrapper.nodeAppearanceProvider.dispose();
}
}

Expand Down
Loading

0 comments on commit d8548f8

Please sign in to comment.