Skip to content

Commit

Permalink
Refactorings
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Nov 25, 2024
1 parent d9cbdbd commit b5bf156
Show file tree
Hide file tree
Showing 190 changed files with 93,807 additions and 724 deletions.
28 changes: 28 additions & 0 deletions ABOUT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
xeokit SDK V3 is built on the insights gained from V2 and previous WebGL-based libraries developed by xeolabs.

## Model-View Separation

In xeokit V2, the renderer and the scene are intertwined within the same classes, lacking a clear separation between
model and view.

In xeokit V3, this separation is established, making the scene model independent of the viewer that renders it. This
allows the scene model to be used for purposes other than rendering, such as serving as an intermediate document model
in tools that convert between file formats.

Additionally, this separation enables various rendering implementations. The viewer is further modularized, with its use
of the underlying graphics API (e.g., WebGL) implemented as a pluggable strategy. This strategy can be adapted for
WebGL, WebGPU, or other technologies.

## Less Convenience Logic

### Single responsibility hueristic

In xeokit V3, we avoid adding convenience logic to classes. For instance, while a Mesh in V2 had a matrix property along
with rotation, translation, and scale properties, in V3, a Mesh has only a matrix property. In V2, the scale,
translation, and Euler rotation properties were combined in a specific order to construct the matrix. Although this
approach is less convenient for the application developer, it offers greater flexibility by allowing the developer to
define the matrix in various ways, such as using a quaternion instead of Euler angles.

## TypeScript


5 changes: 5 additions & 0 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Glossary
---

## AABB

37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ Work in progress;

* [Live Demos](https://xeokit.github.io/sdk/packages/demos/galleries/)

# Features

- Built for viewing large AECO models in the browser
- Written natively in TypeScript
-

# Modules

## Scene Graph

The SDK represents models in a scene graph that include the model's objects, geometries, and materials. This scene graph works on
both the browser and NodeJS platforms and can be used to create models, convert between model formats, and provide content for the
SDK's model viewer.


| Package | Modules | Description |
|--------------------------------------------------------------------------|-----------------------------------------------------------------------|------------------------------------------------------------------------------|
Expand All @@ -63,7 +68,6 @@ The SDK employs a generic entity-relationship data graph to manage model semanti
relationships. This data graph is compatible with both the browser and NodeJS and facilitates model generation, format conversion,
and content navigation within the SDK's model viewer.


| Package | Modules | Description |
|--------------------------------------------------------------------------|-----------------------------------------------------------------------|------------------------------------------------------------------------------|
| [`@xeokit/data`](https://www.npmjs.com/package/@xeokit/data) | [`@xeokit/data`](https://xeokit.github.io/sdk/docs/modules/_xeokit_data.html) | Entity-relationship graph that contains model semantic data. |
Expand All @@ -78,7 +82,6 @@ the viewer can be extended to utilize various browser graphics APIs, including W
simultaneously, and the viewer allows for the creation of separate canvases, featuring lights, section planes, annotations,
and other elements, to display multiple views of our models.


| Package | Modules | Description |
|--------------------------------------------------------------------------|-----------------------------------------------------------------------|------------------------------------------------------|
| [`@xeokit/viewer`](https://www.npmjs.com/package/@xeokit/viewer) | [`@xeokit/viewer`](https://xeokit.github.io/sdk/docs/modules/_xeokit_viewer.html) | Browser-based model viewer |
Expand All @@ -95,13 +98,14 @@ The SDK provides functions for importing and exporting its model representations
AECO file formats. These functions can be used in NodeJS scripts for file format conversion or in the browser to load
various file formats into the viewer.

| Package | Modules | Description |
|----------------------------------------------------------------------|---------------------------------------------------------------------------------------|----------------------------|
| [`@xeokit/dtx`](https://www.npmjs.com/package/@xeokit/dtx) | [`@xeokit/dtx`](https://xeokit.github.io/sdk/docs/modules/_xeokit_dtx.html) | Import and export XKT files |
| [`@xeokit/gltf`](https://www.npmjs.com/package/@xeokit/gltf) | [`@xeokit/gltf`](https://xeokit.github.io/sdk/docs/modules/_xeokit_gltf.html) | Import glTF files |
| Package | Modules | Description |
|----------------------------------------------------------------------|---------------------------------------------------------------------------------------|-----------------------------|
| [`@xeokit/xgf`](https://www.npmjs.com/package/@xeokit/xgf) | [`@xeokit/xgf`](https://xeokit.github.io/sdk/docs/modules/_xeokit_xgf.html) | Import and export XKT files |
| [`@xeokit/gltf`](https://www.npmjs.com/package/@xeokit/gltf) | [`@xeokit/gltf`](https://xeokit.github.io/sdk/docs/modules/_xeokit_gltf.html) | Import glTF files |
| [`@xeokit/las`](https://www.npmjs.com/package/@xeokit/las) | [`@xeokit/las`](https://xeokit.github.io/sdk/docs/modules/_xeokit_las.html) | Import LAS pointcloud scans |
| [`@xeokit/cityjson`](https://www.npmjs.com/package/@xeokit/cityjson) | [`@xeokit/cityjson`](https://xeokit.github.io/sdk/docs/modules/_xeokit_cityjson.html) | Import CityJSON files |
| [`@xeokit/webifc`](https://www.npmjs.com/package/@xeokit/webifc) | [`@xeokit/webifc`](https://xeokit.github.io/sdk/docs/modules/_xeokit_webifc.html) | Import IFC files |
| [`@xeokit/cityjson`](https://www.npmjs.com/package/@xeokit/cityjson) | [`@xeokit/cityjson`](https://xeokit.github.io/sdk/docs/modules/_xeokit_cityjson.html) | Import CityJSON files |
| [`@xeokit/webifc`](https://www.npmjs.com/package/@xeokit/webifc) | [`@xeokit/webifc`](https://xeokit.github.io/sdk/docs/modules/_xeokit_webifc.html) | Import IFC files |
| [`@xeokit/xkt`](https://www.npmjs.com/package/@xeokit/xkt) | [`@xeokit/xkt`](https://xeokit.github.io/sdk/docs/modules/_xeokit_xkt.html) | Import XKT files |

## Interoperating with BIM Software

Expand All @@ -121,7 +125,7 @@ The SDK's internal and lower-level functionalities are mostly available as utili
| [`@xeokit/core`](https://www.npmjs.com/package/@xeokit/core) | [`@xeokit/core`](https://xeokit.github.io/sdk/docs/modules/_xeokit_core_components.html) | Basic component types used throughout the xeokit SDK |
| | [`@xeokit/core/constants`](https://xeokit.github.io/sdk/docs/modules/_xeokit_core_constants.html) | Constants used throughout the xeokit SDK |
| | [`@xeokit/core/utils`](https://xeokit.github.io/sdk/docs/modules/_xeokit_core_utils.html) | Core utilities used throughout the xeokit SDK |
| [`@xeokit/basictypes`](https://www.npmjs.com/package/@xeokit/basictypes) | [`@xeokit/basictypes/basicTypes`](https://xeokit.github.io/sdk/docs/modules/_xeokit_datatypes_basicTypes.html) | Basic semantic data type constants |
| [`@xeokit/basictypes`](https://www.npmjs.com/package/@xeokit/basictypes) | [`@xeokit/basictypes/basicTypes`](https://xeokit.github.io/sdk/docs/modules/_xeokit_datatypes_basicTypes.html) | Basic semantic data type constants |
| | [`@xeokit/ifctypes`](https://xeokit.github.io/sdk/docs/modules/_xeokit_datatypes_ifcTypes.html) | IFC data type constants |
| [`@xeokit/math`](https://www.npmjs.com/package/@xeokit/math) | [`@xeokit/math/math`](https://xeokit.github.io/sdk/docs/modules/_xeokit_math_math.html) | General math definitions and constants |
| | [`@xeokit/math/boundaries`](https://xeokit.github.io/sdk/docs/modules/_xeokit_math_boundaries.html) | Boundaries math library |
Expand Down Expand Up @@ -322,7 +326,7 @@ First import the npm modules we need from the SDK. Note that we don't need the v
npm install @xeokit/scene
npm install @xeokit/core/constants
npm install @xeokit/gltf
npm install @xeokit/dtx
npm install @xeokit/xgf
````

Here's the JavaScript for our converter script.
Expand All @@ -332,15 +336,15 @@ import {Scene} from "@xeokit/scene";
import {Data} from "@xeokit/data";
import {TrianglesPrimitive, LinearEncoding, LinearFilter} from "@xeokit/core/constants";
import {loadGLTF} from "@xeokit/gltf";
import {saveXKT} from "packages/dtx";
import {saveXKT} from "packages/xgf";

const fs = require('fs');

const scene = new Scene(); // Scene graph
const sceneModel = scene.createModel({ id: "myModel" }); // Start building the scene graph
const sceneModel = scene.createModel({id: "myModel"}); // Start building the scene graph

const data = new Data();
const dataModel = data.createModel({ id: "myModel" }); // Will model the glTF scene hierarchy
const dataModel = data.createModel({id: "myModel"}); // Will model the glTF scene hierarchy

fs.readFile("./tests/assets/HousePlan.glb", (err, buffer) => {
const arraybuffer = toArrayBuffer(buffer);
Expand All @@ -350,8 +354,9 @@ fs.readFile("./tests/assets/HousePlan.glb", (err, buffer) => {
dataModel
}).then(() => {
sceneModel.build().then(() => { // Compresses textures, geometries etc.
const arrayBuffer = saveXKT({ sceneModel, dataModel });
fs.writeFile('myModel.dtx', arrayBuffer, err => {});
const arrayBuffer = saveXKT({sceneModel, dataModel});
fs.writeFile('myModel.xgf', arrayBuffer, err => {
});
});
})
});
Expand Down
157 changes: 157 additions & 0 deletions glossary.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
[
{
"key": "AABB",
"title": "Axis-Aligned Bounding Box",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "LAS",
"title": "",
"desc": ""
},
{
"key": "LAZ",
"title": "",
"desc": ""
},
{
"key": "XKT",
"title": "",
"desc": ""
},
{
"key": "XGF",
"title": "",
"desc": ""
},
{
"key": "IFC",
"title": "",
"desc": ""
},
{
"key": "glTF",
"title": "",
"desc": ""
},
{
"key": "DotBIM",
"title": "",
"desc": ""
},
{
"key": "OBJ",
"title": "",
"desc": ""
},
{
"key": "ifc2gltf",
"title": "",
"desc": ""
},
{
"key": "ifc2gltf2xgf",
"title": "",
"desc": ""
},
{
"key": "datatex",
"title": "",
"desc": ""
},
{
"key": "SDK",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
},
{
"key": "",
"title": "",
"desc": ""
}
]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
},
"license": "SEE LICENSE IN LICENSE.md",
"scripts": {
"convert-demo-models": "turbo run convert-demo-models",
"dev": "turbo run dev",
"build": "turbo run build",
"dist": "turbo run dist --concurrency 100",
"lint": "turbo run lint --concurrency 100",
"test": "turbo run test --concurrency 100 --continue || node scripts/test-html-report/index.mjs",
"docs-build": "rimraf docs && turbo run docs-build --filter=docs && pnpm typedoc-gen",
"docs-build": "rimraf docs && mkdir docs && turbo run docs-build --filter=docs && pnpm typedoc-gen",
"typedoc-gen": "turbo run docs --concurrency 100 && typedoc --entryPointStrategy merge \"docs/json/*.json\" --tsconfig packages/config/tsconfig.typedoc.json",
"docs-serve": "http-server ./docs --port 8080",
"publish-packages": "turbo run build lint test && changeset version && changeset publish"
Expand Down
4 changes: 4 additions & 0 deletions packages/book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
/node_modules
/book/_book
/build
5 changes: 5 additions & 0 deletions packages/book/.tm_properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
excludeInFileChooser = "{$excludeInFileChooser,_book,node_modules}"
excludeInFolderSearch = "{$excludeInFolderSearch,_book,node_modules}"

fileBrowserGlob = "{$fileBrowserGlob,.bookignore}"
include = "{$include,.bookignore}"
3 changes: 3 additions & 0 deletions packages/book/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'aws-sdk', '~>1.53'
gem 'git', '~>1.2'
20 changes: 20 additions & 0 deletions packages/book/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
GEM
remote: https://rubygems.org/
specs:
aws-sdk (1.63.0)
aws-sdk-v1 (= 1.63.0)
aws-sdk-v1 (1.63.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
git (1.2.9.1)
json (1.8.2)
mini_portile (0.6.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)

PLATFORMS
ruby

DEPENDENCIES
aws-sdk (~> 1.53)
git (~> 1.2)
Loading

0 comments on commit b5bf156

Please sign in to comment.