Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEB-695 Batching Maintenance #2182

Merged
merged 30 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
08a16b2
Starting to tackle WBX-397 by taking a different approach on computin…
AlexandruPopovici Mar 22, 2024
0d8d956
WIP
AlexandruPopovici Mar 23, 2024
6ccd468
Range computation is more or less done. Material indices still need a…
AlexandruPopovici Mar 24, 2024
4bb55ae
Range material indices figured out mostly by trating them as edges in…
AlexandruPopovici Mar 24, 2024
3597be7
Added forward and backwards material index edges in order to be able …
AlexandruPopovici Mar 25, 2024
e4b0d31
Extended the new draw range integration approach to instanced batches
AlexandruPopovici Mar 25, 2024
5d41669
Added vitest and wrote a first test for the DrawRange integration app…
AlexandruPopovici Mar 25, 2024
076f433
A bunch of more tests
AlexandruPopovici Mar 26, 2024
95ebfe0
Removed unused dep
AlexandruPopovici Mar 26, 2024
c366a05
Merged
AlexandruPopovici Mar 26, 2024
c466eb9
ci(viewer): test the viewer in CircleCI
iainsproat Mar 26, 2024
2cabf8c
Include test-viewer as a dependency of later jobs
iainsproat Mar 26, 2024
6411bff
Small updates
AlexandruPopovici Mar 27, 2024
043c2ed
Removed old range integration from all three batches
AlexandruPopovici Mar 27, 2024
c90a386
Working on making the range update integration work on an array at a …
AlexandruPopovici Mar 28, 2024
894b83a
Update range integration now works on entire arrays at a time. Almost…
AlexandruPopovici Mar 28, 2024
895cf5e
DrawRanges now also flattens the computed draw ranges, so we got rid …
AlexandruPopovici Mar 28, 2024
9357a67
More adjustment to point batch
AlexandruPopovici Mar 28, 2024
32bb15f
Merge branch 'main' into alex/smarter-draw-ranges
AlexandruPopovici Mar 28, 2024
f638bdd
Implemented a common PrimitiveBatch which can be used for any typical…
AlexandruPopovici Mar 28, 2024
6406fa0
Updated PointBatch to extend PrimitiveBatch
AlexandruPopovici Mar 29, 2024
b083652
Tried making the instaned mesh batch extend the primitive batch but t…
AlexandruPopovici Mar 29, 2024
ced3b02
Merge branch 'main' into alex/smarter-draw-ranges
AlexandruPopovici Apr 1, 2024
af9a599
Merged Iain's PR hopefully fixed the conflicts correctly
AlexandruPopovici Apr 1, 2024
11f754a
fixed viewer build
fabis94 Apr 1, 2024
4a26a89
Removed unused code and execution time measurements
AlexandruPopovici Apr 1, 2024
cee08c6
Merge branch 'alex/smarter-draw-ranges' of github.com:specklesystems/…
AlexandruPopovici Apr 1, 2024
00cf704
Merge branch 'main' into iain/circleci-test-viewer
iainsproat Apr 2, 2024
a651c1c
Merged
AlexandruPopovici Apr 2, 2024
b7d76ee
Merge branch 'main' into alex/smarter-draw-ranges
AlexandruPopovici Apr 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ workflows:
- test-frontend-2:
filters: *filters-allow-all

- test-viewer:
filters: *filters-allow-all

## TODO: Re-enable when dui3 gets further into development
AlexandruPopovici marked this conversation as resolved.
Show resolved Hide resolved
# - test-dui-3:
# filters: *filters-allow-all

- test-ui-components:
filters: *filters-allow-all

Expand Down Expand Up @@ -54,6 +61,7 @@ workflows:
- pre-commit
- deployment-testing-approval
- test-frontend-2
- test-viewer
- test-server
- docker-build-server
- docker-build-frontend
Expand All @@ -72,6 +80,7 @@ workflows:
- pre-commit
- deployment-testing-approval
- test-frontend-2
- test-viewer
- test-server
- docker-build-server
- docker-build-frontend
Expand Down Expand Up @@ -163,6 +172,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-frontend:
Expand All @@ -174,6 +184,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-frontend-2:
Expand All @@ -185,6 +196,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-webhooks:
Expand All @@ -196,6 +208,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-file-imports:
Expand All @@ -207,6 +220,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-previews:
Expand All @@ -218,6 +232,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-test-container:
Expand All @@ -229,6 +244,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-monitor-container:
Expand All @@ -240,6 +256,7 @@ workflows:
- pre-commit
- publish-approval
- test-frontend-2
- test-viewer
- test-server

- docker-publish-docker-compose-ingress:
Expand Down Expand Up @@ -290,6 +307,7 @@ workflows:
- test-server
- test-ui-components
- test-frontend-2
- test-viewer

jobs:
get-version:
Expand Down Expand Up @@ -496,6 +514,75 @@ jobs:
command: yarn lint
working_directory: 'packages/frontend-2'

test-viewer:
docker: &docker-node-browsers-image
- image: cimg/node:18.19.0-browsers
resource_class: large
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-server-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn

- run:
name: Install Dependencies v2 (.node files missing bug)
command: yarn

- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-server-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- .yarn/unplugged

- run:
name: Build public packages
command: yarn build:public

- run:
name: Lint everything
command: yarn lint
working_directory: 'packages/viewer'

- run:
name: Run tests
command: yarn test
working_directory: 'packages/viewer'

test-dui-3:
AlexandruPopovici marked this conversation as resolved.
Show resolved Hide resolved
docker: &docker-node-image
- image: cimg/node:18.19.0
resource_class: medium+
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-server-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn

- run:
name: Install Dependencies v2 (.node files missing bug)
command: yarn

- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-server-{{ checksum "yarn.lock" }}
paths:
- .yarn/cache
- .yarn/unplugged

- run:
name: Lint everything
command: yarn lint
working_directory: 'packages/dui3'

test-ui-components:
docker: *docker-node-browsers-image
resource_class: xlarge
Expand Down
118 changes: 114 additions & 4 deletions packages/viewer-sandbox/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import {
SelectionEvent,
ViewerEvent,
DebugViewer,
Viewer
Viewer,
Batch,
DrawRanges,
SpeckleBasicMaterial
} from '@speckle/viewer'

import './style.css'
Expand All @@ -20,6 +23,10 @@ import {
} from '@speckle/viewer'
import { SectionTool } from '@speckle/viewer'
import { SectionOutlines } from '@speckle/viewer'
import { BoxSelection } from './Extensions/BoxSelection'
import { GeometryType } from '@speckle/viewer'
import { SpeckleStandardMaterial } from '@speckle/viewer'
import { Color, FrontSide } from 'three'

const createViewer = async (containerName: string, stream: string) => {
const container = document.querySelector<HTMLElement>(containerName)
Expand Down Expand Up @@ -51,7 +58,7 @@ const createViewer = async (containerName: string, stream: string) => {
const filtering = viewer.createExtension(FilteringExtension)
const explode = viewer.createExtension(ExplodeExtension)
const diff = viewer.createExtension(DiffExtension)
// const boxSelect = viewer.createExtension(BoxSelection)
const boxSelect = viewer.createExtension(BoxSelection)
// const rotateCamera = viewer.createExtension(RotateCamera)
cameraController // use it
selection // use it
Expand Down Expand Up @@ -91,6 +98,97 @@ const createViewer = async (containerName: string, stream: string) => {
Object.assign(sandbox.sceneParams.worldSize, viewer.World.worldSize)
Object.assign(sandbox.sceneParams.worldOrigin, viewer.World.worldOrigin)
sandbox.refresh()

const meshBatch = viewer
.getRenderer()
.batcher.getBatches(undefined, GeometryType.MESH)
.find((batch: Batch) => batch.renderViews.length > 2)
// const geom = meshBatch.mesh.geometry
// geom.groups.length = 0
// geom.addGroup(0, 216, 0)
// geom.addGroup(216, 1323, 0)
// geom.addGroup(1539, 540, 0)
// geom.addGroup(2079, 32268, 0)

// const material = new SpeckleStandardMaterial(
// {
// color: new Color('#00ff00'),
// emissive: 0x0,
// roughness: 1,
// metalness: 0,
// opacity: 1,
// side: FrontSide
// },
// ['USE_RTE']
// )
// meshBatch.setDrawRanges(
// {
// offset: 36,
// count: 36,
// material
// }
// {
// offset: 180,
// count: 1395,
// material
// },
// {
// offset: 1581,
// count: 32766,
// material
// }
// )
// const material = new SpeckleStandardMaterial(
// {
// color: new Color('#00ff00'),
// emissive: 0x0,
// roughness: 1,
// metalness: 0,
// opacity: 1,
// side: FrontSide
// },
// ['USE_RTE']
// )
// meshBatch.setDrawRanges(
// {
// offset: 9018,
// count: 36,
// material
// },
// {
// offset: 13878,
// count: 36,
// material
// }
// )
// const material0 = new SpeckleBasicMaterial({ color: 0xff0000 })
// const material1 = new SpeckleBasicMaterial({ color: 0x00ff00 })
// let groups = [
// {
// start: 0,
// count: 1350,
// materialIndex: 0
// }
// ]

// const drawRange = new DrawRanges()

// groups = drawRange.integrateRanges(
// groups,
// [material0, material1],
// [
// {
// offset: 0,
// count: 258,
// material: material1
// },
// {
// offset: 258,
// count: 1032,
// material: material1
// }
// ]
// )
})

viewer.on(ViewerEvent.UnloadComplete, () => {
Expand Down Expand Up @@ -249,7 +347,7 @@ const getStream = () => {
// 'https://latest.speckle.dev/streams/f92e060177/commits/038a587267'
// 'https://latest.speckle.dev/streams/3f895e614f/commits/8a3e424997'
// 'https://latest.speckle.dev/streams/f92e060177/commits/f51ee777d5'
// 'https://latest.speckle.dev/streams/f92e060177/commits/bbd821e3a1'
'https://latest.speckle.dev/streams/f92e060177/commits/bbd821e3a1'
// Big curves
// 'https://latest.speckle.dev/streams/c1faab5c62/commits/49dad07ae2'
// 'https://speckle.xyz/streams/7ce9010d71/commits/afda4ffdf8'
Expand Down Expand Up @@ -296,6 +394,7 @@ const getStream = () => {
// 'https://speckle.xyz/streams/88307505eb/objects/a232d760059046b81ff97e6c4530c985'
// Airport
// 'https://latest.speckle.dev/streams/92b620fb17/commits/dfb9ca025d'
// 'https://latest.speckle.dev/streams/92b620fb17/objects/cf8838025d9963b342b09da8de0f8b6b'
// 'Blocks with elements
// 'https://latest.speckle.dev/streams/e258b0e8db/commits/00e165cc1c'
// 'https://latest.speckle.dev/streams/e258b0e8db/commits/e48cf53add'
Expand Down Expand Up @@ -372,7 +471,18 @@ const getStream = () => {

// Rebar
// 'https://speckle.xyz/streams/b4086833f8/commits/94df4c6d16?overlay=c5b9c260ea,e3dc287d61,eaedd7d0a5,7f126ce0dd,02fee34ce3,9bda31611f,110282c4db,533c311e29,bf6814d779,1ba52affcf,cc4e75125e,3fd628e4e3'
'http://127.0.0.1:3000/streams/30b75f0dea/objects/db765ed44ae10176c0bf8ba60d1ce67d'
// Nice towers
// 'https://latest.speckle.dev/streams/f4efe4bd7f/objects/5083dffc2ce54ce64c1fc4fab48ca877'
// 'http://127.0.0.1:3000/streams/30b75f0dea/objects/db765ed44ae10176c0bf8ba60d1ce67d'

// 'https://speckle.xyz/streams/7b253e5c4c/commits/025fcbb9cf'
// BIG railway
// 'https://latest.speckle.dev/streams/a64b432b34/commits/cf7725e404'
// 'https://latest.speckle.dev/streams/a64b432b34/objects/1806cb8082a4202b01d97601b6e19af8'
// 'https://latest.speckle.dev/streams/a64b432b34/objects/a7ab2388948594e89f838f3026b89839'
// 'https://latest.speckle.dev/streams/a64b432b34/commits/99d809460a'
// Bunch a doors
// 'https://latest.speckle.dev/streams/a64b432b34/commits/c184ba7d88'
)
}

Expand Down
10 changes: 8 additions & 2 deletions packages/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
"build:dev": "rollup --config",
"dev": "rollup --config --watch",
"prepack": "yarn build",
"lint": "eslint . --ext .js,.ts"
"lint": "eslint . --ext .js,.ts",
"test": "vitest",
"test:ui": "vitest --ui",
"test:run": "vitest run"
},
"author": "AEC Systems",
"license": "Apache-2.0",
Expand Down Expand Up @@ -74,16 +77,19 @@
"@types/three": "^0.136.0",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"@vitest/ui": "^1.4.0",
"core-js": "^3.21.1",
"eslint": "^8.11.0",
"eslint-config-prettier": "^8.5.0",
"jsdom": "^24.0.0",
"prettier": "^2.5.1",
"regenerator-runtime": "^0.13.7",
"rollup": "^2.70.1",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"typescript": "^4.5.4"
"typescript": "^4.5.4",
"vitest": "^1.4.0"
},
"gitHead": "5627e490f9a3ecadf19cc4686ad15f344d9ad2d3"
}
3 changes: 2 additions & 1 deletion packages/viewer/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const config = {
typescript2({
tsconfigOverride: {
sourceMap: sourcemap
}
},
tsconfig: './tsconfig.build.json'
}),
babel({
extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
Expand Down
Loading