@yschindel/ara3d-webgl 1.3.9 → 1.3.11

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.
@@ -0,0 +1,25 @@
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 { BimEntities } from './bimEntities';
7
+ export type EntityIndex = number & {
8
+ __brand: "EntityIndex";
9
+ };
10
+ export type StringIndex = number & {
11
+ __brand: "StringIndex";
12
+ };
13
+ export type InstanceIndex = number & {
14
+ __brand: "InstanceIndex";
15
+ };
16
+ export declare class BimData {
17
+ BimGeometry: BimGeometry;
18
+ Entities: BimEntities;
19
+ Strings: Array<string>;
20
+ ThreeGeometry: THREE.Group;
21
+ Resolver: BimResolver;
22
+ Query: BimQuery;
23
+ Instances: Array<Instance>;
24
+ rebuildGeometry(instances: Instance[]): THREE.Group;
25
+ }
@@ -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
+ }
@@ -1,14 +1,13 @@
1
- import * as THREE from 'three';
2
1
  import JSZip from 'jszip';
3
- import { BimGeometry } from './bimGeometry';
2
+ import { BimData } from './bimData';
4
3
  /**
5
4
  * Loader that takes a URL to a .ZIP or .BOS file containing BIM Open Schema geometry parquet tables:
6
5
  */
7
6
  export declare class BimOpenSchemaLoader {
8
- load(source: string): Promise<THREE.Group>;
7
+ load(source: string): Promise<BimData>;
9
8
  }
10
9
  /**
11
10
  * Reads the BOS parquet tables from a JSZip archive into a BimGeometry object.
12
11
  * This is the same idea as the previous browser version, just using package imports.
13
12
  */
14
- export declare function loadBimGeometryFromZip(zip: JSZip): Promise<BimGeometry>;
13
+ export declare function loadBimGeometryFromZip(zip: JSZip): Promise<BimData>;
@@ -0,0 +1,11 @@
1
+ import { BimData } from './bimData';
2
+ import { BimResolver } 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
+ }
@@ -0,0 +1,27 @@
1
+ import { BimData, StringIndex, EntityIndex } from './bimData';
2
+ import { BimEntities } from './bimEntities';
3
+ import { BimGeometry } from './bimGeometry';
4
+ import { Instance } from './buildInstances';
5
+ export declare class BimResolver {
6
+ readonly Data: BimData;
7
+ constructor(Data: BimData);
8
+ readonly Strings: Array<string>;
9
+ readonly Entities: BimEntities;
10
+ readonly InstanceCount: number;
11
+ readonly EntityCount: number;
12
+ readonly BimGeometry: BimGeometry;
13
+ GetString(stringIndex: StringIndex): string;
14
+ GetEntityName(i: EntityIndex): string;
15
+ GetEntityCategory(i: EntityIndex): EntityIndex;
16
+ GetEntityCategoryName(i: EntityIndex): string;
17
+ GetEntityType(i: EntityIndex): EntityIndex;
18
+ GetEntityTypeName(i: EntityIndex): string;
19
+ GetEntityDocument(i: EntityIndex): EntityIndex;
20
+ GetEntityDocumentName(i: EntityIndex): string;
21
+ GetInstanceName(i: Instance): string;
22
+ GetInstanceCategoryName(i: Instance): string;
23
+ GetInstanceTypeName(i: Instance): string;
24
+ GetInstanceDocumentName(i: Instance): string;
25
+ GetInstanceGlobalId(i: Instance): string;
26
+ EntityIndices(): Iterable<EntityIndex>;
27
+ }
@@ -1,14 +1,16 @@
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 declare function buildGeometry(instances: Instance[]): THREE.Group;
9
+ export declare function createMergedAndSingleMeshes(materialGroups: Array<InstanceMaterialGroup>): Array<THREE.Mesh>;
10
+ export declare function mergeGeometries(geometries: Array<THREE.BufferGeometry>): {
11
+ geometry: THREE.BufferGeometry;
12
+ triToInstanceIndex: Uint32Array;
13
+ };
14
+ export declare function gatherSingleInstancesByMaterial(groups: GroupedInstances): Array<InstanceMaterialGroup>;
15
+ export declare function createInstancedMeshes(instanceGroups: GroupedInstances): Array<THREE.InstancedMesh>;
14
16
  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>;
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,74 @@
1
- {
2
- "name": "@yschindel/ara3d-webgl",
3
- "version": "1.3.9",
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.11",
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": "Ara 3D <info@ara3d.com>",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/yschindel/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": "vite build --config vite.config.lib.js && npm run gentypes",
24
+ "dev:lib-watch": "vite build --config vite.config.lib.js --watch",
25
+ "preview:docs": "vite preview --mode github --config vite.config.docs.js --host",
26
+ "serve:docs": "http-server ./docs -o --host",
27
+ "eslint": "eslint --ext .js,.ts src --fix",
28
+ "gentypes": "tsc --declaration --emitDeclarationOnly --outdir ./dist/types"
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.0",
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
+ }