Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Jul 28, 2024
1 parent 780d8fd commit 5f14261
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 21 deletions.
44 changes: 41 additions & 3 deletions packages/bcf/src/SaveBCFViewpointParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,65 @@ import type {View} from "@xeokit/viewer";
export interface SaveBCFViewpointParams {

defaultInvisible?: boolean;

/**
* Whether to capture a snapshot image in the BCF viewpoint.
*
* The snapshot would be saved in {@link @xeokit/bcf!BCFViewpoint.snapshot | BCFViewpoint.snapshot}.
*/
snapshot?: boolean;

/**
* Identifies the system that authors this BCF viewpoint.
*/
originatingSystem?: string;

/**
* Whether to flip the direction of the {@link @xeokit/viewer!SectionPlane | SectionPlanes} captured in the BCF viewpoint.
*/
reverseClippingPlanes?: boolean;

/**
* Value to set on {@link @xeokit/bcf!BCFSetupHints.openings_translucent | BCFSetupHints.openings_translucent} within the BCF viewpoint.
*/
openings_translucent?: boolean;

/**
* Value to set on {@link @xeokit/bcf!BCFSetupHints.space_boundaries_translucent | BCFSetupHints.space_boundaries_translucent} within the BCF viewpoint.
*/
space_boundaries_translucent?: boolean;

/**
* Value to set on {@link @xeokit/bcf!BCFSetupHints.spaces_translucent | BCFSetupHints.spaces_translucent} within the BCF viewpoint.
*/
spaces_translucent?: boolean;

/**
* Value to set on {@link @xeokit/bcf!BCFSetupHints.openingsVisible | BCFSetupHints.openingsVisible} within the BCF viewpoint.
*/
openingsVisible?: boolean;

/**
* Value to set on {@link @xeokit/bcf!BCFSetupHints.spaceBoundariesVisible | BCFSetupHints.spaceBoundariesVisible} within the BCF viewpoint.
*/
spaceBoundariesVisible?: boolean;

/**
* Value to set on {@link @xeokit/bcf!BCFSetupHints.spacesVisible | BCFSetupHints.spacesVisible} within the BCF viewpoint.
*/
spacesVisible?: boolean;

/**
* A {@link @xeokit/viewer!View | View} to save as a BCF viewpoint.
* The {@link @xeokit/viewer!View | View} to save as a BCF viewpoint.
*
* This will save component states in the BCF (see {@link @xeokit/bcf!BCFComponents}) for all
* {@link @xeokit/viewer!ViewObject | ViewObjects} in the given target View.
* {@link @xeokit/viewer!ViewObject | ViewObjects} in this View.
*/
view: View;

/**
* Only save BCF viewpoint components if their corresponding {@link @xeokit/viewer!ViewObject | ViewObjects}
* are in {@link @xeokit/viewer!ViewLayer | ViewLayers} that have the given IDs.
* are in {@link @xeokit/viewer!ViewLayer | ViewLayers} that match these IDs.
*
* The {@link @xeokit/bcf!saveBCFViewpoint} function will silently ignore each component state that has no corresponding
* ViewObject in any of these ViewLayers.
Expand Down
20 changes: 10 additions & 10 deletions packages/bcf/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* [![npm version](https://badge.fury.io/js/%40xeokit%2Fbcf.svg)](https://badge.fury.io/js/%40xeokit%2Fbcf)
* [![](https://data.jsdelivr.com/v1/package/npm/@xeokit/bcf/badge)](https://www.jsdelivr.com/package/npm/@xeokit/bcf)
*
*
* <img style="padding:20px; padding-bottom:10px; " src="media://images/xeokit_bcf_logo.png"/>
*
* # xeokit BCF Viewpoint Importer and Exporter
Expand Down Expand Up @@ -48,15 +48,15 @@
* * create a {@link @xeokit/scene!Scene | Scene} and a {@link @xeokit/data!Data | Data},
* * initialize a Viewer with the Scene and a {@link @xeokit/webglrenderer!WebGLRenderer | WebGLRenderer},
* * create a new {@link @xeokit/viewer!View | View}, {@link @xeokit/scene!SceneModel | SceneModel} and {@link @xeokit/data!DataModel | DataModel},
* * load a [DTX](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#dtx) file using the {@link @xeokit/dtx!loadDTX | loadDTX} function, and
* * load a [XKT](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#xkt) file using the {@link @xeokit/xkt!loadXKT | loadXKT} function, and
* * build the Scene and Data models, rendering the 3D model in the web browser.
*
* ````javascript
* import {Scene} from "@xeokit/scene";
* import {Data} from "@xeoki/data";
* import {Viewer} from "@xeokit/viewer";
* import {WebGLRenderer} from "@xeokit/webglrenderer";
* import {loadDTX} from "@xeokit/loadDTX";
* import {loadXKT} from "@xeokit/xkt";
* import {saveBCFViewpoint, loadBCFViewpoint} from "@xeokit/bcf";
* import * as ifcTypes from "@xeokit/ifctypes";
*
Expand All @@ -81,31 +81,31 @@
* id: "myModel"
* });
*
* fetch("myModel.dtx").then(response => {
* fetch("myModel.xkt").then(response => {
* response.arrayBuffer().then(data => {
*
* loadDTX({ data, sceneModel, dataModel });
* loadXKT({ data, sceneModel, dataModel });
*
* sceneModel.build();
* dataModel.build();
* });
* });
* ````
*
* When our [DTX](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#dtx) has loaded, that call to {@link @xeokit/scene!SceneModel.build | SceneModel.build} will finalize our SceneModel
* When our [XKT](https://xeokit.github.io/sdk/docs/pages/GLOSSARY.html#xkt) has loaded, that call to {@link @xeokit/scene!SceneModel.build | SceneModel.build} will finalize our SceneModel
* and cause it to immediately appear in the View's canvas.
*
* That call will also trigger {@link @xeokit/scene!SceneModel.onBuilt | SceneModel.onBuilt} and
* {@link @xeokit/data!DataModel.onBuilt | DataModel.onBuilt} events.
*
* On the DataModel.onBuilt event, we'll customize the View by arranging the {@link @xeokit/viewer!Camera} and applying
* On the SceneModel.onBuilt event, we'll customize the View by arranging the {@link @xeokit/viewer!Camera} and applying
* an X-ray effect tp a couple of objects, then we'll use {@link @xeokit/bcf!saveBCFViewpoint} to save the state of the View to
* a BCF viewpoint.
*
* Once the SceneModel and DataModel have been built, we can no longer add anything to them.
*
* ````javascript
* dataModel.onBuilt.one(()=>{
* sceneModel.onBuilt.one(()=>{
*
* view.camera.eye = [0,0,-33];
* view.camera.look = [0,0,0];
Expand Down Expand Up @@ -174,7 +174,7 @@
* layerId: "foreground"
* });
*
* //...create some objects, load DTX etc
* //...create some objects, load XKT etc
*
* sceneModel.build();
*
Expand All @@ -183,7 +183,7 @@
* layerId: "background"
* });
*
* //...create some objects, load DTX etc
* //...create some objects, load XKT etc
*
* myOtherSceneModel.build();
* ````
Expand Down
2 changes: 1 addition & 1 deletion packages/bcf/src/loadBCFViewpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const tempVec3b = createVec3();
const tempVec3c = createVec3();

/**
* Loads a {@link @xeokit/bcf!BCFViewpoint} into a {@link @xeokit/viewer!View | View} or a {@link @xeokit/viewer!ViewLayer | ViewLayer}.
* Loads a {@link @xeokit/bcf!BCFViewpoint} into a {@link @xeokit/viewer!View | View}.
*
* See {@link "@xeokit/bcf" | @xeokit/bcf} for usage.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/bcf/src/saveBCFViewpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {OrthoProjectionType} from "@xeokit/constants";
import {ViewObject} from "@xeokit/viewer";

/**
* Saves a {@link @xeokit/viewer!View | View} or a {@link @xeokit/viewer!ViewLayer | ViewLayer} to a {@link @xeokit/bcf!BCFViewpoint}.
* Saves a {@link @xeokit/viewer!View | View} to a {@link @xeokit/bcf!BCFViewpoint}.
*
* See {@link "@xeokit/bcf" | @xeokit/bcf} for usage.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/bcf/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
"path": "../viewer"
}
]
}
}
30 changes: 27 additions & 3 deletions packages/scene/src/SceneTile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,34 @@ import {SceneObject} from "./SceneObject";
/**
* A tile in a {@link @xeokit/scene!SceneModel}.
*
*
* * {@link @xeokit/scene!SceneMeshParams.origin | SceneMeshParams.origin}
* * Stored in {@link @xeokit/scene!SceneModel.tiles | SceneModel.tiles}
* * Created with {@link @xeokit/scene!SceneModel.createTile | SceneModel.createTile}
* * Created automatically for each distinct value of {@link @xeokit/scene!SceneMeshParams.origin | SceneMeshParams.origin} given to {@link @xeokit/scene!SceneMeshParams.createMesh | SceneMeshParams.createMesh}
* * Each SceneTile is destroyed as soon all {@link @xeokit/scene!SceneTile | SceneTiles} with that origin heve been destroyed
*
* See {@link "@xeokit/scene" | @xeokit/scene} for usage.
*/
export class SceneTile {

public readonly scene: Scene;
/**
* Unique ID of this SceneTile.
*/
public readonly id: string;

/**
* The Scene that owns this SceneTile.
*/
public readonly scene: Scene;

/**
* The 3D World-space origin of this SceneTile.
*/
public readonly origin: FloatArrayParam;

/**
* The number of {@link @xeokit/scene!SceneMesh | SceneMeshes} associated with this SceneTile.
*/
public numObjects: number;

/**
Expand All @@ -27,13 +45,19 @@ export class SceneTile {
public readonly models: { [key: string]: SceneModel };

/**
* The {@link @xeokit/scene!SceneObject | SceneObjects} in this TiSceneTilele,
* The {@link @xeokit/scene!SceneObject | SceneObjects} in this SceneTile,
* mapped to {@link @xeokit/scene!SceneObject.id | SceneObject.id}.
*
* A SceneObject can belong to more than one SceneTile.
*/
public readonly objects: { [key: string]: SceneObject };

/**
* @private
* @param scene
* @param id
* @param origin
*/
constructor(scene: Scene, id: string, origin: FloatArrayParam) {
this.scene = scene;
this.id = id;
Expand Down
4 changes: 2 additions & 2 deletions packages/scene/src/SceneTransformParams.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {FloatArrayParam} from "@xeokit/math";

/**
* {@link Transform} creation parameters for {@link @xeokit/scene!SceneModel.createTransform | SceneModel.createTransform}.
* Parameters for {@link @xeokit/scene!SceneModel.createTransform | SceneModel.createTransform}.
*/
export interface SceneTransformParams {

Expand All @@ -19,4 +19,4 @@ export interface SceneTransformParams {
* 4x4 matrix that defines the transformation.
*/
matrix: FloatArrayParam,
}
}

0 comments on commit 5f14261

Please sign in to comment.