@yschindel/ara3d-webgl 1.3.10 → 1.3.14

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.
@@ -5,4 +5,3 @@ export { DefaultInputScheme, KEYS } from './viewer/inputs/input';
5
5
  export * from './viewer/viewerSettings';
6
6
  export * from './loader/gltfLoader';
7
7
  export * from './loader/bimOpenSchemaLoader';
8
- export { BimGhostController } from './loader/bimGhostController';
@@ -0,0 +1,7 @@
1
+ import { StringIndex } from './bimData';
2
+ export interface BimParameterDescriptors {
3
+ Name: Array<StringIndex>;
4
+ Units: Array<StringIndex>;
5
+ Group: Array<StringIndex>;
6
+ Type: Array<number>;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { EntityIndex, DescriptorIndex } from './bimData';
2
+ export interface BimParameterTable {
3
+ Entity: Array<EntityIndex>;
4
+ Descriptor: Array<DescriptorIndex>;
5
+ Value: Array<number>;
6
+ }
@@ -0,0 +1,39 @@
1
+ import * as THREE from 'three';
2
+ import { BimGeometry } from './bimGeometry';
3
+ import { Instance } from './buildInstances';
4
+ import { BimResolver } from './bimResolver';
5
+ import { BimQuery } from './bimQuery';
6
+ import { BuildGeometryOptions } from './buildGeometryGroup';
7
+ import { BimEntities } from './bimEntities';
8
+ import { BimParameterTable } from './BimParameterTable';
9
+ import { BimParameterDescriptors } from './BimParameterDescriptors';
10
+ export type EntityIndex = number & {
11
+ __brand: "EntityIndex";
12
+ };
13
+ export type StringIndex = number & {
14
+ __brand: "StringIndex";
15
+ };
16
+ export type InstanceIndex = number & {
17
+ __brand: "InstanceIndex";
18
+ };
19
+ export type DescriptorIndex = number & {
20
+ __brand: "InstanceIndex";
21
+ };
22
+ export declare class BimData {
23
+ BimGeometry: BimGeometry;
24
+ Entities: BimEntities;
25
+ Strings: Array<string>;
26
+ ThreeGeometry: THREE.Group;
27
+ Resolver: BimResolver;
28
+ Query: BimQuery;
29
+ Instances: Array<Instance | undefined>;
30
+ Descriptors: BimParameterDescriptors;
31
+ IntegerParameters: BimParameterTable;
32
+ StringParameters: BimParameterTable;
33
+ EntityParameters: BimParameterTable;
34
+ SingleParameters: BimParameterTable;
35
+ PointParameters: BimParameterTable;
36
+ /** Options used when building geometry (stored for rebuildGeometry) */
37
+ geometryOptions: BuildGeometryOptions;
38
+ rebuildGeometry(instances: Array<Instance | undefined>): THREE.Group;
39
+ }
@@ -0,0 +1,9 @@
1
+ import { StringIndex, EntityIndex } from './bimData';
2
+ export interface BimEntities {
3
+ LocalId: Array<number>;
4
+ GlobalId: Array<StringIndex>;
5
+ Document: Array<EntityIndex>;
6
+ Name: Array<StringIndex>;
7
+ Category: Array<EntityIndex>;
8
+ Type: Array<EntityIndex>;
9
+ }
@@ -3,7 +3,7 @@ export interface BimGeometry {
3
3
  InstanceMaterialIndex: Int32Array;
4
4
  InstanceMeshIndex: Int32Array;
5
5
  InstanceTransformIndex: Int32Array;
6
- InstanceGlobalId?: string[];
6
+ InstanceFlags: Uint8Array;
7
7
  VertexX: Int32Array;
8
8
  VertexY: Int32Array;
9
9
  VertexZ: Int32Array;
@@ -1,14 +1,26 @@
1
- import * as THREE from 'three';
2
1
  import JSZip from 'jszip';
3
- import { BimGeometry } from './bimGeometry';
2
+ import { BimData } from './bimData';
3
+ /**
4
+ * Options for loading BOS files
5
+ */
6
+ export interface BosLoaderOptions {
7
+ /**
8
+ * Whether to apply Z-up to Y-up rotation.
9
+ * - true: Apply rotation (for Revit exports which are Z-up)
10
+ * - false: No rotation (for IFC imports which are already Y-up compatible)
11
+ * Default: true (for backwards compatibility with Revit BOS files)
12
+ */
13
+ applyZUpToYUpRotation?: boolean;
14
+ skipDescriptorsAndParameters?: boolean;
15
+ }
4
16
  /**
5
17
  * Loader that takes a URL to a .ZIP or .BOS file containing BIM Open Schema geometry parquet tables:
6
18
  */
7
19
  export declare class BimOpenSchemaLoader {
8
- load(source: string): Promise<THREE.Group>;
20
+ load(source: string, options?: BosLoaderOptions): Promise<BimData>;
9
21
  }
10
22
  /**
11
23
  * Reads the BOS parquet tables from a JSZip archive into a BimGeometry object.
12
24
  * This is the same idea as the previous browser version, just using package imports.
13
25
  */
14
- export declare function loadBimGeometryFromZip(zip: JSZip): Promise<BimGeometry>;
26
+ export declare function loadBimGeometryFromZip(zip: JSZip, options?: BosLoaderOptions): Promise<BimData>;
@@ -0,0 +1,13 @@
1
+ import { BimData } from './bimData';
2
+ import { BimResolver, Parameter } from './bimResolver';
3
+ import { Instance } from './buildInstances';
4
+ export declare class BimQuery {
5
+ readonly Data: BimData;
6
+ constructor(Data: BimData);
7
+ readonly Resolver: BimResolver;
8
+ FuncToInstances(f: (i: Instance) => string): Map<string, Instance[]>;
9
+ CategoryToInstances(): Map<string, Instance[]>;
10
+ GlobalIdToInstances(): Map<string, Instance[]>;
11
+ GetLevelFromParameters(ps: Array<Parameter>): string;
12
+ LevelToInstances(): Map<string, Instance[]>;
13
+ }
@@ -0,0 +1,49 @@
1
+ import { BimData, StringIndex, EntityIndex, InstanceIndex, DescriptorIndex } from './bimData';
2
+ import { BimEntities } from './bimEntities';
3
+ import { BimGeometry } from './bimGeometry';
4
+ import { BimParameterDescriptors } from './BimParameterDescriptors';
5
+ import { BimParameterTable } from './BimParameterTable';
6
+ import { Instance } from './buildInstances';
7
+ import { BosLoaderOptions } from './bimOpenSchemaLoader';
8
+ export type Parameter = {
9
+ Name: string;
10
+ Value: any;
11
+ };
12
+ export declare class BimResolver {
13
+ readonly Data: BimData;
14
+ constructor(Data: BimData, options?: BosLoaderOptions);
15
+ GetVal(rawVal: number, descType: number): any;
16
+ ProcessParameters(table: BimParameterTable): void;
17
+ readonly Descriptors: BimParameterDescriptors;
18
+ readonly Strings: Array<string>;
19
+ readonly Entities: BimEntities;
20
+ readonly InstanceCount: number;
21
+ readonly EntityCount: number;
22
+ readonly BimGeometry: BimGeometry;
23
+ readonly DescriptorCount: number;
24
+ readonly ParameterMap: Map<EntityIndex, Array<Parameter>>;
25
+ GetString(stringIndex: StringIndex): string;
26
+ GetEntityName(i: EntityIndex): string;
27
+ GetEntityCategory(i: EntityIndex): EntityIndex;
28
+ GetEntityCategoryName(i: EntityIndex): string;
29
+ GetEntityType(i: EntityIndex): EntityIndex;
30
+ GetEntityTypeName(i: EntityIndex): string;
31
+ GetEntityDocument(i: EntityIndex): EntityIndex;
32
+ GetEntityDocumentName(i: EntityIndex): string;
33
+ GetEntityParameters(i: EntityIndex): Array<Parameter>;
34
+ GetInstanceName(i: Instance): string;
35
+ GetInstanceCategoryName(i: Instance): string;
36
+ GetInstanceTypeName(i: Instance): string;
37
+ GetInstanceDocumentName(i: Instance): string;
38
+ GetInstanceGlobalId(i: Instance): string;
39
+ GetInstanceParameters(i: Instance): Array<Parameter>;
40
+ GetDescriptorName(i: DescriptorIndex): string;
41
+ GetDescriptorType(i: DescriptorIndex): number;
42
+ GetDescriptorGroup(i: DescriptorIndex): string;
43
+ GetDescriptorUnits(i: DescriptorIndex): string;
44
+ EntityIndices(): Iterable<EntityIndex>;
45
+ InstanceIndices(): Iterable<InstanceIndex>;
46
+ DescriptorIndices(): Iterable<DescriptorIndex>;
47
+ first<T>(iterable: Iterable<T>, predicate: (value: T) => boolean, _default: T): T;
48
+ FindDescriptor(name: string): DescriptorIndex;
49
+ }
@@ -1,14 +1,23 @@
1
1
  import * as THREE from 'three';
2
- import { BimGeometry } from './bimGeometry';
3
- type InstanceGroup = {
4
- meshIndex: number;
5
- materialIndex: number;
6
- instanceIndices: number[];
2
+ import { Instance } from './buildInstances';
3
+ type GroupedInstances = Map<THREE.Material, Map<THREE.BufferGeometry, Instance[]>>;
4
+ type InstanceMaterialGroup = {
5
+ material: THREE.Material;
6
+ instances: Array<Instance>;
7
7
  };
8
- export declare function buildGeometry(bim: BimGeometry): THREE.Group;
9
- export declare function createMergedAndSingleMeshes(bim: BimGeometry, geometries: Array<THREE.BufferGeometry>, materials: Array<THREE.Material>, transforms: Array<THREE.Matrix4>, materialGroups: Map<number, number[]>): Array<THREE.Mesh>;
10
- export declare function computeTransforms(bim: BimGeometry): any[];
11
- export declare function mergeGeometries(geometries: Array<THREE.BufferGeometry>): THREE.BufferGeometry;
12
- export declare function gatherSingleInstancesByMaterial(instanceGroups: Array<InstanceGroup>): Map<number, number[]>;
13
- export declare function createInstances(bim: BimGeometry, geometries: Array<THREE.BufferGeometry>, materials: Array<THREE.Material>, transforms: Array<THREE.Matrix4>, instanceGroups: Array<InstanceGroup>): Array<THREE.InstancedMesh>;
8
+ export interface BuildGeometryOptions {
9
+ /**
10
+ * Whether to apply Z-up to Y-up rotation (-90° around X axis).
11
+ * Default: true
12
+ */
13
+ applyZUpToYUpRotation?: boolean;
14
+ }
15
+ export declare function buildGeometry(instances: Array<Instance | undefined>, options?: BuildGeometryOptions): THREE.Group;
16
+ export declare function createMergedAndSingleMeshes(materialGroups: Array<InstanceMaterialGroup>): Array<THREE.Mesh>;
17
+ export declare function mergeGeometries(geometries: Array<THREE.BufferGeometry>): {
18
+ geometry: THREE.BufferGeometry;
19
+ triToInstanceIndex: Uint32Array;
20
+ };
21
+ export declare function gatherSingleInstancesByMaterial(groups: GroupedInstances): Array<InstanceMaterialGroup>;
22
+ export declare function createInstancedMeshes(instanceGroups: GroupedInstances): Array<THREE.InstancedMesh>;
14
23
  export {};
@@ -0,0 +1,13 @@
1
+ import * as THREE from 'three';
2
+ import { BimGeometry } from './bimGeometry';
3
+ import { EntityIndex, InstanceIndex } from './bimData';
4
+ export type Instance = {
5
+ isIdentity: boolean;
6
+ instance: InstanceIndex;
7
+ entity: EntityIndex;
8
+ geometry: THREE.BufferGeometry;
9
+ material: THREE.Material;
10
+ transform: THREE.Matrix4;
11
+ };
12
+ export declare function buildInstances(bg: BimGeometry): Array<Instance | undefined>;
13
+ export declare function computeTransforms(bim: BimGeometry): Array<THREE.Matrix4>;
@@ -16,14 +16,13 @@ export declare class GroundPlane {
16
16
  }
17
17
  export declare class Environment {
18
18
  skyLight: THREE.HemisphereLight;
19
- ambientLight: THREE.AmbientLight;
20
19
  sunLights: THREE.DirectionalLight[];
21
20
  private _groundPlane;
22
21
  get groundPlane(): THREE.Mesh;
23
22
  constructor(settings: Settings);
24
23
  loadGroundTexture(encoding: TextureEncoding, url: string): void;
25
24
  /**
26
- * Returns all objects composing the environment
25
+ * Returns all three objects composing the environment
27
26
  */
28
27
  getObjects(): THREE.Object3D[];
29
28
  applySettings(settings: Settings): void;
@@ -35,7 +34,6 @@ export declare class Environment {
35
34
  }
36
35
  export interface IEnvironment {
37
36
  skyLight: THREE.HemisphereLight;
38
- ambientLight: THREE.AmbientLight;
39
37
  sunLights: THREE.DirectionalLight[];
40
38
  groundPlane: THREE.Mesh;
41
39
  }
@@ -10,10 +10,9 @@ export declare class Renderer {
10
10
  camera: Camera;
11
11
  needsUpdate: boolean;
12
12
  constructor(scene: THREE.Scene, viewport: Viewport, camera: Camera, settings: Settings);
13
- applyRenderingSettings(settings: Settings): void;
14
13
  dispose(): void;
15
- get background(): THREE.Color | THREE.Texture | null;
16
- set background(color: THREE.Color | THREE.Texture | null);
14
+ get background(): THREE.Color | THREE.Texture;
15
+ set background(color: THREE.Color | THREE.Texture);
17
16
  render(): void;
18
17
  add(target: THREE.Object3D): boolean;
19
18
  remove(target: THREE.Object3D): void;
@@ -23,6 +23,7 @@ export declare class Viewer {
23
23
  stop(): void;
24
24
  private animate;
25
25
  add(obj: THREE.Object3D, frameCamera?: boolean): void;
26
+ remove(obj: THREE.Object3D): void;
26
27
  clear(): void;
27
28
  dispose(): void;
28
29
  }
@@ -1,32 +1,6 @@
1
1
  import * as THREE from 'three';
2
2
  export type TextureEncoding = 'url' | 'base64' | undefined;
3
3
  export { GizmoOptions } from './gizmos/gizmoAxes';
4
- /**
5
- * Example: Neutral lighting setup for color calibration or asset review
6
- *
7
- * ```typescript
8
- * const neutralSettings = {
9
- * skylight: {
10
- * intensity: 0 // Disable hemisphere light for neutral lighting
11
- * },
12
- * ambientLight: {
13
- * color: new THREE.Color(0xffffff),
14
- * intensity: 0.5 // Base level of even illumination
15
- * },
16
- * sunLights: [
17
- * {
18
- * position: new THREE.Vector3(5, 10, 7.5),
19
- * color: new THREE.Color(0xffffff),
20
- * intensity: 1 // Primary directional light
21
- * }
22
- * ],
23
- * rendering: {
24
- * toneMapping: THREE.ACESFilmicToneMapping,
25
- * toneMappingExposure: 1.0
26
- * }
27
- * }
28
- * ```
29
- */
30
4
  /**
31
5
  * Makes all field optional recursively
32
6
  * https://stackoverflow.com/questions/41980195/recursive-partialt-in-typescript
@@ -93,7 +67,7 @@ export type Settings = {
93
67
  * Rendering background options
94
68
  */
95
69
  background: {
96
- color: THREE.Color | null;
70
+ color: THREE.Color;
97
71
  };
98
72
  /**
99
73
  * Plane under scene related options
@@ -113,21 +87,12 @@ export type Settings = {
113
87
  };
114
88
  /**
115
89
  * Skylight (hemisphere light) options
116
- * Used for natural lighting with sky/ground color variation
117
90
  */
118
91
  skylight: {
119
92
  skyColor: THREE.Color;
120
93
  groundColor: THREE.Color;
121
94
  intensity: number;
122
95
  };
123
- /**
124
- * Ambient light options
125
- * Used for neutral lighting setup (even illumination without color casts)
126
- */
127
- ambientLight: {
128
- color: THREE.Color;
129
- intensity: number;
130
- };
131
96
  /**
132
97
  * Sunlight (directional light) options
133
98
  */
@@ -138,19 +103,6 @@ export type Settings = {
138
103
  }[];
139
104
  rendering: {
140
105
  onDemand: boolean;
141
- /**
142
- * Tone mapping mode for the renderer
143
- * ACESFilmicToneMapping is recommended for realistic results and wider dynamic range
144
- */
145
- toneMapping: THREE.ToneMapping;
146
- /**
147
- * Tone mapping exposure value
148
- */
149
- toneMappingExposure: number;
150
- /**
151
- * Output color space for the renderer
152
- */
153
- outputColorSpace: THREE.ColorSpace;
154
106
  };
155
107
  };
156
108
  export type PartialSettings = RecursivePartial<Settings>;
package/package.json CHANGED
@@ -1,74 +1,77 @@
1
- {
2
- "name": "@yschindel/ara3d-webgl",
3
- "version": "1.3.10",
4
- "description": "A 3D viewer designed for large architectural (BIM) models built on top of Three.JS.",
5
- "files": [
6
- "dist"
7
- ],
8
- "types": "./dist/types/index.d.ts",
9
- "module": "dist/ara3d-webgl.mjs",
10
- "homepage": "https://github.com/ara3d/ara3d-webgl.git",
11
- "bugs": {
12
- "url": "https://github.com/ara3d/ara3d-webgl/issues"
13
- },
14
- "license": "MIT",
15
- "author": "Ara 3D <info@ara3d.com>",
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/ara3d/ara3d-webgl.git"
19
- },
20
- "scripts": {
21
- "dev": "vite --config vite.config.docs.js --host",
22
- "build:docs": "vite build --config vite.config.docs.js && npm run gentypes",
23
- "build:lib": "npx vite build --config vite.config.lib.js && npm run gentypes",
24
- "preview:docs": "vite preview --mode github --config vite.config.docs.js --host",
25
- "serve:docs": "http-server ./docs -o --host",
26
- "eslint": "eslint --ext .js,.ts src --fix",
27
- "gentypes": "tsc --declaration --emitDeclarationOnly --outdir ./dist/types",
28
- "prepare": "npm run build:lib"
29
- },
30
- "devDependencies": {
31
- "@types/axios": "^0.14.0",
32
- "@typescript-eslint/eslint-plugin": "^5.45.1",
33
- "@typescript-eslint/parser": "^5.45.1",
34
- "eslint": "^8.29.0",
35
- "eslint-config-prettier": "^8.5.0",
36
- "eslint-config-standard": "^17.0.0",
37
- "eslint-plugin-import": "^2.26.0",
38
- "eslint-plugin-node": "^11.1.0",
39
- "eslint-plugin-prettier": "^4.2.1",
40
- "eslint-plugin-promise": "^6.1.1",
41
- "http-server": "^14",
42
- "opener": "^1.5.2",
43
- "prettier": "^2.8.0",
44
- "typescript": "^5.9.3",
45
- "vite": "^3.2.5"
46
- },
47
- "dependencies": {
48
- "@types/node": "^18.11.11",
49
- "deepmerge": "^4.2.2",
50
- "hyparquet": "^1.23.2",
51
- "hyparquet-compressors": "^1.1.1",
52
- "jszip": "^3.10.1",
53
- "ste-events": "^3.0.7",
54
- "ste-signals": "^3.0.9",
55
- "ste-simple-events": "^3.0.7",
56
- "three": "^0.182.0"
57
- },
58
- "keywords": [
59
- "3d",
60
- "ara3d",
61
- "ara 3d",
62
- "bim",
63
- "viewer",
64
- "three.js",
65
- "model",
66
- "aec",
67
- "BIM Open Schema",
68
- "BIM",
69
- "BOS",
70
- ".bos",
71
- "loader",
72
- "webgl"
73
- ]
74
- }
1
+ {
2
+ "name": "@yschindel/ara3d-webgl",
3
+ "version": "1.3.14",
4
+ "description": "A 3D viewer designed for large architectural (BIM) models built on top of Three.JS.",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "types": "./dist/types/index.d.ts",
9
+ "module": "/dist/ara3d-webgl.mjs",
10
+ "homepage": "https://github.com/yschindel/ara3d-webgl.git",
11
+ "bugs": {
12
+ "url": "https://github.com/yschindel/ara3d-webgl/issues"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Yssentyl Technologies <contact@yssentyl.com>",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/yschindel/ara3d-webgl.git"
22
+ },
23
+ "scripts": {
24
+ "dev": "vite --config vite.config.docs.js --host",
25
+ "build:docs": "vite build --config vite.config.docs.js && npm run gentypes",
26
+ "build:lib": "vite build --config vite.config.lib.js && npm run gentypes",
27
+ "dev:lib-watch": "vite build --config vite.config.lib.js --watch",
28
+ "preview:docs": "vite preview --mode github --config vite.config.docs.js --host",
29
+ "serve:docs": "http-server ./docs -o --host",
30
+ "eslint": "eslint --ext .js,.ts src --fix",
31
+ "gentypes": "tsc --declaration --emitDeclarationOnly --outdir ./dist/types"
32
+ },
33
+ "devDependencies": {
34
+ "@types/axios": "^0.14.0",
35
+ "@typescript-eslint/eslint-plugin": "^5.45.1",
36
+ "@typescript-eslint/parser": "^5.45.1",
37
+ "eslint": "^8.29.0",
38
+ "eslint-config-prettier": "^8.5.0",
39
+ "eslint-config-standard": "^17.0.0",
40
+ "eslint-plugin-import": "^2.26.0",
41
+ "eslint-plugin-node": "^11.1.0",
42
+ "eslint-plugin-prettier": "^4.2.1",
43
+ "eslint-plugin-promise": "^6.1.1",
44
+ "http-server": "^14",
45
+ "opener": "^1.5.2",
46
+ "prettier": "^2.8.0",
47
+ "typescript": "^5.9.3",
48
+ "vite": "^3.2.5"
49
+ },
50
+ "dependencies": {
51
+ "@types/node": "^18.11.11",
52
+ "deepmerge": "^4.2.2",
53
+ "hyparquet": "^1.23.0",
54
+ "hyparquet-compressors": "^1.1.1",
55
+ "jszip": "^3.10.1",
56
+ "ste-events": "^3.0.7",
57
+ "ste-signals": "^3.0.9",
58
+ "ste-simple-events": "^3.0.7",
59
+ "three": "^0.182.0"
60
+ },
61
+ "keywords": [
62
+ "3d",
63
+ "ara3d",
64
+ "ara 3d",
65
+ "bim",
66
+ "viewer",
67
+ "three.js",
68
+ "model",
69
+ "aec",
70
+ "BIM Open Schema",
71
+ "BIM",
72
+ "BOS",
73
+ ".bos",
74
+ "loader",
75
+ "webgl"
76
+ ]
77
+ }
@@ -1,21 +0,0 @@
1
- import * as THREE from 'three';
2
- /**
3
- * Controller for ghosting/isolation of BIM elements by GlobalId.
4
- * Allows focusing on specific elements while ghosting all others.
5
- */
6
- export declare class BimGhostController {
7
- private root;
8
- private globalIdToEntityIndex;
9
- private entityToInstances;
10
- constructor(root: THREE.Group);
11
- /**
12
- * Isolate elements: show these at full opacity, ghost everything else.
13
- * @param globalIds Array of GlobalIds to keep at full opacity
14
- * @param ghostOpacity Opacity for ghosted elements (default 0.1)
15
- */
16
- isolate(globalIds: string[], ghostOpacity?: number): void;
17
- /**
18
- * Clear isolation: show all elements at full opacity.
19
- */
20
- clearIsolation(): void;
21
- }
@@ -1,6 +0,0 @@
1
- import * as THREE from 'three';
2
- /**
3
- * Creates a material that supports per-instance opacity via instanceOpacity attribute.
4
- * This allows ghosting individual instances within an InstancedMesh.
5
- */
6
- export declare function createGhostableMaterial(baseMaterial: THREE.MeshStandardMaterial): THREE.MeshStandardMaterial;