Commit Graph

702 Commits

Author SHA1 Message Date
Alexandru Popovici 7296b37fc4 Alex/webxr (#4291)
* feat(viewer-lib): WIP WebXr stuff

* Working WebXR stuff

* Restored some unrequired changes

* feat(viewer-lib): Implemented WebXrViewer which wraps three's xr functionality

* faet(viewer-lib): Implemented basic webxr functionality via WebXrViewer

* Revert "feat(viewer-lib): Implemented WebXrViewer which wraps three's xr functionality"

This reverts commit 8798f265b7c0d0c654e588e16f0aefd4ecd5508c.

* feat(viewer-lib): Some more small changes

* feat(viewer-lib): Added comments, refined a bit the sample xr extension

* Reverted XR stuff

* Restore yarn lock
2025-04-01 11:21:45 +03:00
Alexandru Popovici 1f40f49140 Measurements Update #1 (#4293)
* feat(viewer-lib): Perpendicular measurement direction now follows mouse

* fix(viewer-lib): Handled WEB-1381. Rogue disc no longer appears

* fix(viewer-lib): Handled WEB-1781. Measurements are no longer selectable by clicking on their line, only the label

* chore(viewer-lib): Added a couple of comments

* fix(viewer-lib): Render is requested after auto lazering
2025-03-31 21:06:49 +03:00
Alexandru Popovici 2f8d75bc67 fix(viewer-lib): Merging indices has been broken for over two years. Fixed now (#4098) 2025-03-28 11:33:00 +02:00
Alexandru Popovici 3e3de6df5b fix(viewer-lib): When resetting the selection, the shadowmap is re-rendered. This allows correct shadows after de-selecting outline only selections. Also re-enabled stream loading in th sandbox (#4280) 2025-03-27 23:36:48 +02:00
Adam Hathcock 975f0e1a51 feat(objectloader): ObjectLoader2: use indexdb as cache and batch download objects (#4172)
* feat(objectloader2): Made objectloader2 to be faster!

---------

Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
Co-authored-by: Kristaps Fabians Geikins <fabis94@live.com>
Co-authored-by: Iain Sproat <68657+iainsproat@users.noreply.github.com>
2025-03-27 10:47:10 +00:00
Alexandru Popovici c0178ac70a fix(viewer-lib): Fixed an issue where the shadowcatcher would not seemingly update unless the scene changed it's size (#4268) 2025-03-26 17:35:16 +02:00
Alexandru Popovici 5348c32cca feat(viewer-lib): Hidden objects are now ignored by default when oribiting around cursor (#4265) 2025-03-26 12:07:46 +02:00
Alexandru Popovici 01cbd46939 chore(viewer-lib): Updates to the export list (#4258)
- Basit pass and pipeline have been renamed to Shaded
- Viewer now exports all implemented passes
- Viewer now exports the pass option types as well as defaults
2025-03-26 10:27:03 +02:00
Alexandru Popovici 4371945b71 DataDog Error Fixes (#4255)
* fix(viewer-lib): Fixed an issue where the section tool inside an empty world would throw off three's clipping plane calculation causing the infamous 'i.toArray is not a function' seen in datadog. Additionally the 'Cannot read properties of undefined (reading 'transparent')' error might also be resolved along side since it seems it was caused by it

* fix(viewer-lib): Fixed another error seen in datadog

* fix(viewer-lib): Fixed another error reported by datadog where diffing materials did not have clipping planes initialized causing exceptions to be thrown in some cases

* fix(viewer-lib): Compiler error
2025-03-25 09:05:40 +02:00
Alexandru Popovici fe7d435d8c fix(viewer-lib): Fixed an issue which caused incorrect zoom to cursor and rotate around cursor behavior on some relative layout pages (#4233) 2025-03-21 09:06:53 +02:00
Alexandru Popovici c962d2c6fa Screen Space Outlines Update (#4185)
* Color hash from object id attribute

* feat(viewer-lib): Implemented screen space outlines based on object id gradients. Still slightly WIP, but the concept seems to be working fine

* Added engine model for testing outlines update

* feat(viewer-lib): Updates to object-id based gradients
- Id gradients now are now binary. If they are greater than 0, they will get updated to 1. This fixes the issue where similar nearby objects that happen to have similar colors would exhibit a fainter gradient
- Fixed an issue with DepthNormalIdPass where linear depth was not being used
- Cleaned up the edge generator shader

* feat(viewer-viewer): Added instancing support for screen space outline from color id gradients
- Instances now generate a correct and unique color hash based off a batch index and gl_InstanceID when running WebGL 2.0. For WebGL1.0 it's currently not supported
- Removed some unneeded non-null assertion left over from a long time ago
- Extended three.js InstancedMesh in order to add a batch index variable to it. Nothing more

* feat(viewer-lib): Added support for WebGL1.0 for both instanced and non instanced rendering of the color id gradients
- Batcher now takes all the webgl caps instead of just mac vert uniforms and float textures
- The depth-normal-id pass shader now works on both WebGL 1.0 and 2.0.
- When running WebGL 1.0 we dynamically add a per instance attribute buffer with the object id in order to compute hash. If we're running WebGL 2.0 we do not do that and instead rely on the builtin gl_InstanceID so we conserve bandwidth
- Fixed small type issue with the edge generation shader when running WebGL 1.0

* feat(viewer-lib): Updated the edged and shaded view modes to use the depth-normal-id pass

* Restored to main version.
2025-03-17 11:07:37 +02:00
Alexandru Popovici f7fd0371b5 feat(viewer-lib): Implemented Region displaying (#4194) 2025-03-14 21:55:09 +02:00
Alexandru Popovici d122873f0e fix(viewer-lib): Fixed the issue where ghosted lines would not appear transparent (#4174) 2025-03-12 17:02:44 +02:00
Kristaps Fabians Geikins 1d2a594f0a chore: upgrade TS 5.2 -> 5.7.3 & ESLint to 9.20.1 (#4032)
* chore: upgrade TS 5.2 -> 5.7.3

* vite dts fix

* lint fix

* resolutions fix

* ui comp build fix

* precommit fix?

* latest eslint version

* autoloader fix

* undo unnecessary viewer change

* eslint fixes fe2 + trying disabled type linting

* lint fixes
2025-02-20 14:18:18 +02:00
Alexandru Popovici cd2fbd657e Fix(viewer-lib): Empty normals array force viewer normal calculation (#4002) 2025-02-18 12:57:40 +02:00
Alexandru Popovici e9997f1c62 feat(viewer-lib): Loader now allows unknown type for resourceData, so each loader can treat it the way it wants (#3981) 2025-02-13 17:32:25 +02:00
Alexandru Popovici 647141cca9 feat(viewer-lib): Added support for custom vertex normals. Moved nnormal computation from batch level to object level, handling WEB-596 in the process (#3944) 2025-02-12 23:25:45 +02:00
Alexandru Popovici 065c242ef5 fix(viewer-lib): Fixes two issues regarding very small scale streams (#3930)
- The orbit controller would not properly report changes in camera movement on a per frame basis becuase of a hardcoded epsilon which was not small enough for very small scenes. Now the epsilon is dynamically computed
- WASD-ing would jitter in very small scenes because of a too large normalization value sent to the position dampers. Now that value is also dynamically computed for small scenes
2025-02-04 17:10:07 +02:00
Alexandru Popovici f367a2ff02 Lines with Both displayStyle and renderMaterial Fix (#3913)
* fix(viewer-lib): Fixed the issue where v2 lines would not display properly when having both displayStyle and renderMaterial. Now displayStyle takes precedence

* chore(viewer-lib): Fixed typo
2025-02-04 13:03:22 +02:00
Alexandru Popovici b50f1fa43d fix(viewer-lib): Updates to WASD and orthographic projection: (#3922)
- Pressing WASDQE while in orthographic mode will no longer work. WASD-ing is disabled while in ortho
- Fixed an issue with toggling to ortho after dropping out of WASD caused by the origin beingvery close to the camera, making the orthographic size to be huge. Now when this happens, we get the minimum distance from the camera to the geometry and use that distance to compute the orthographic size. If no intersection is found, we just take the halfwy between min and max radius
2025-02-04 10:21:18 +02:00
Alexandru Popovici cff48b98c9 Comment Bubbles WASD Fix (#3920)
* feat(viewer-lib): Added  property to PointQueryResult which tells if the requested point is in frustum when projecting and unprojecting

* feat(frontend-2): Updated the comment bubbles screen location computation step to account for their anchor's inclusion in the camera's frustum
2025-02-03 17:10:24 +02:00
Alexandru Popovici 118807139b Billboards Position Fix (#3919)
* fix(viewer-lib): Fixed the issue where billboarded objects from measurements were not getting their position updated properly

* fix(viewer-lib): Disabled orbit sphere frustum culling
2025-01-30 19:19:44 +02:00
Alexandru Popovici a3d1e6adec Orbit WASDEQ Controls (#3875)
* Updated the fly controller to use the z up basis

* Fixed very important compiler error

* Removed the annoying delay when first holding down WASD keys before movement started

* Updated LegacyViewer to use the hybrid camera controls

* Added big baker

* Trying to figure out the essence of this

* Partly works

* Pivotal coordinates now work

* Smoothened out the math abit

* Fixed sandbox error

* Enabled the pivot sphere

* feat(viewer-lib): Fixed some issues with orbiting around cursor

* feat(viewer-lib): Updates to WEB-2313, orbiting around mouse cursor
Orbiting around mouse cursor now works correctly with an orthographic projection as well as when toggling between orthographic and perspective.
Disabled WASD navigation for now.
SmoothOrbitControls now has protected members instead of private allowing extension
Documented the important parts of the pivotal navigation code

* feat(viewer-lib): Mouse orbiting now takes clipping planes into consideration

* chore(viewer-lib): Fixed sandbox build error

* fix(viewer-lib): Handled WEB-2449 and WEB-2450
Additionally fixed an issue where changing the orbit pivot would trigger a hard render, adding the unneeded noise of AO re-convergence

* fix(viewer-lib): Fixed the issue with focusing and other camera animations caused by the introduction on the pivotal CS. Pivot sphere now shows only on orbit

* feat(viewer-lib): Updates on mouse orbiting:
- When clicking outside of the model, oribitig will switch to polar and use the last computed origin (which is still going to be based on the last pivot point)
Made the pivot sphere speckle blue
The pivot sphere now only shows when clicking on objects, when clicking outside of the model it will not show

* feat(viewer-lib): Update for WASD aka fly mode:
- Smoother combined navigation by using the immediate controler position and orientation as opposed the the goal ones
- Pivot sphere properly hides when in fly mode
- The bug where the camera would incorrectly jump when toggling between fly and oribit is now gone (or I cannot reproduce it anymore)

* fix(viewer-lib): Fixed sandbox compile error

* feat(viewer-lib): Added the hybrid fly orbit controller to the legacy viewer

* feat(viewer-lib): Added a slower movement speed to WASD navigation when camera is close to geometry

* fix(viewer-lib): Fixed the issue where opening the context menu while holding down a WASD key would make the camera move indefinetely

* Feat(viewer-lib): Update to WASD controls:
- Disabled cursor orbiting
- Added an option to allow for world space up/down with e/q keys. By default it's enabled
- Fixed the pan speed to work similar to WASD speed in two steps depending how close the camera is to geometry

* chore(viewer-lib): Tidied up a bit

* fix(viewer-lib): Fixed an ugly bug where the camera distance calculataion plane would flip, especially when WASD-ing, and mess up the min distance calculation which led the camera near plane to be way off

* chore(viewer-lib): Swapped E to up and Q to down

* Re-nabled cursor orbiting
2025-01-30 16:05:51 +02:00
Alexandru Popovici 0cd9487040 fix(viewer-lib): Fixed RTE shaders on MacOS and iOS. Hope they don't break it again (#3907) 2025-01-29 11:01:26 +02:00
Alexandru Popovici 2eaaa93adf Intel IrisXe Fix (#3877)
* fix(viewer-lib): Found a working workaround for mangled geometry on intel iris Xe integrated GPUs

* fix(viewer-lib): Added sample stream
2025-01-23 16:08:27 +02:00
Alexandru Popovici 32497eeb5a fix(viewer-lib): Handles WEB-2491. (#3856)
- Section outlines are no longer visible behind other geometry. They are depth tested now for all view modes
- Shaded mode aka BastiMode now properly updates the section planes
2025-01-21 18:20:45 +02:00
Alexandru Popovici a75b89dd67 fix(viewer-lib): Handles WEB-2475. Shaded view mode no longer eats up cpu time on large streams (#3849)
- FilteringExtension now emits the filtering state changed event when reseting the filtering state
- BasitPass no longer applies the per vertex color indices each frame
- ViewModes extension now listens for filtering state changes and have any active BasitPass reset it's color indices on a filtering reset event. Not great, not terrible but it avoids us having to double cache the per vertex color indices.
2025-01-20 14:12:14 +02:00
Alexandru Popovici b4deaded0f PassReader updates for View Modes (#3828)
* feat(viewer-lib): Updates to the PassReader extension along with underlying viewer library updates
Implemented reading framebuffer contents for framebuffers with multiple attachements. The current version of three.js that we are using does not support this. Because we still need to drag along WebGL 1.0 support, only attachement 0 can be read for now, which does not bother us.
DepthNormalPass now specifies it's MRT output target as the outputTarget
PassReader's read function is now overloaded and it can take a pass name as a string or a GPass | GPass[]
Had to add a small type augmentation since the current version of types-three library does a poor job when it comes to WebGLMultipleRenderTargets
Updated PassReader extension in frontend and updated the call to read in order to make sure depth reading works in other view modes that write depth. The only view mode that does not draw to depth is Shaded mode

* fix(viewer-lib): Fixed the classic sandbox compile error

* fix(frontend-2): Updated depth reading to work with MRT depth from our view mode pipelines
2025-01-16 13:59:13 +02:00
Alexandru Popovici 8aadfc9be9 fix(viewer-lib): Fixed an issue where mismatched vertex color counts were still attempted to batch together resulting in errors. (#3809)
Now if the number of vertex colors does not match the number of vertices we just ignore colors alltogether
2025-01-14 12:52:26 +02:00
Alexandru Popovici 58a6795b61 Enabled accurate near plane calculation (#3778) 2025-01-09 15:58:17 +02:00
Alexandru Popovici e1c83d08cf WEB-2417: Shadowcatcher updates when switching versions (#3777)
* chore(viewer-lib): Snow mode is no longer default in the sandbox

* fix(viewer-lib): Handles WEB-2417

Shadowcather now properly updates when adding/removing render trees even if the scene bounds does not change
2025-01-09 13:05:58 +02:00
Alexandru Popovici b337ae348f Measurements Units Fixes (#3741)
* Handles new measurements reverting to meters even if a different unit was previously set. Handles units not changing properly when changing the unit value

* Remove transition to fix select

* Remove unsused import

* Added back snow

---------

Co-authored-by: Mike Tasset <mike.tasset@gmail.com>
2024-12-20 22:33:42 +00:00
Alexandru Popovici 6fc7c06e9c Offline Object Loader (#3717)
* Quick hack to demo how an offline loader would work with as little complication as possible

* Further simplified yielding objects in offline mode

* Commented out the URL thing

* Implemented SpeckleOfflineLoader. JSON parsing is implemented at object-loader level, completely isolated from the rest of the implementation in order to avoid regression

* Isolated ObjectLoader creation in base SpeckleLoader class so any extended classes can overwrite the way the object loader is created and used

* Removed the big json sample file

* Updated version

* Removed unused functions from objectloader

* Restored viewer package version

* Fixed typo

* Renamed and moved the sample offline Speckle JSON

* Replaced the default JSON object sample with a much smaller one since we don't want to increase the sandbox's build size by 10 megs

* Fixed a linting error
2024-12-18 17:21:13 +02:00
andrewwallacespeckle 87221cac88 feature(fe2): View mode FE integration (#3651)
* Improve shortcuts

* WIP

* View Mode menu

* Styling updates

* split activeControls

* Reusable Menu component

* Menu updates

* Sun menu updates

* Tidyups

* CommonAlert

* Updates

* WIP change to currentViewMode

* Serialization

* defineModel

* Tidy up emits

* Remove v-model

* Force close other panels

* Remove transition

* More robust isTypingComment

* activeControl > activePanel

* View menu shortcuts

* Explode menu definemodel

* Small changes from Benjamin

* Add colors view mode

* Fix server problem in data.ts

* Fix build
2024-12-12 17:19:57 +00:00
Alexandru Popovici 60ff23d73d Toggle-able Basit Mode (#3672)
* Some updates to Basit Mode. Added it to the 6 key

* Renamed BasitMode to ColorsMode
2024-12-12 15:42:10 +02:00
Alexandru Popovici 9e0e6a9c0d SpeckleInstancedMeshes now recrete their shadow depth material whenever the instance configuration changes (#3681) 2024-12-12 14:37:39 +02:00
Alexandru Popovici e7613a60d7 Fixed TAS Shapecast (#3661)
* Fixed the issue where TAS only shapecasts were not running properly on all batch objects, missing some of them. Some small updates to BoxSelection

* Improved shapecast travesal time 4X. Only passing batch objects only once to intersectTASRange and also added the builtin CONTAINED acceleration to bounds testing.

* Some critical typescript errors

* Added missing types from export
2024-12-10 11:29:05 +02:00
Alexandru Popovici 0fd5e2b9ef WEB-1611: Zoom to Cursor Fix (#3562)
* Added FilterMaterial and related types to export list

* Handled WEB-1389

* Camera orbit controls now takes the offset position and size when computing zoom to cursor coordinates. Fixes WEB-1611
2024-11-26 20:56:49 +02:00
Alexandru Popovici 003ac46e58 WEB-1683: Selection Extension Fixes (#3559)
* Added FilterMaterial and related types to export list

* Handled WEB-1389

* Handled the issue
2024-11-26 20:56:36 +02:00
Alexandru Popovici e739ee1b27 WEB-2171: Non-Speckle Materials Fix (#3558)
* Added FilterMaterial and related types to export list

* Handled WEB-1389

* Non speckle materials no longer throw an error
2024-11-26 20:56:19 +02:00
Alexandru Popovici 68bbedcd92 WEB-1389 (#3555)
* Added FilterMaterial and related types to export list

* Handled WEB-1389
2024-11-26 20:55:53 +02:00
Dimitrie Stefanescu eab2391353 feat: adds compat for upcoming dui3 changes 2024-11-22 17:36:33 +00:00
Alexandru Popovici a48ec073a1 The bounds to check against when intersecting the scene is now being properly expanded and 0 sized component bounds are being taken care of (#3450) 2024-11-07 09:55:27 +02:00
Dimitrie Stefanescu 60e6354524 Merge pull request #3445 from specklesystems/WEB-2136
fix: adds brepx, extrusionx, subdx support in viewer for real this time
2024-11-06 13:49:06 +00:00
Dimitrie Stefanescu 96d497232d fix: adds brepx, extrusionx, subdx support in viewer for real this time 2024-11-06 13:46:16 +00:00
Alexandru Popovici 11a3a68d86 Added missing exported types (#3418) 2024-11-01 15:06:06 +02:00
Alexandru Popovici 26a103b5c5 Made sure an actual Box3 instances is passed ot the viewwer from hte legacy viewer implementation] (#3428) 2024-11-01 05:29:46 +01:00
Alexandru Popovici 5be9a27945 Fixed an issue with computing a relative offset box where the origin of the input box was not taken into account and the resulting offset box would be whack (#3419) 2024-10-31 09:36:11 +01:00
Alexandru Popovici 31a21f3a9a GeometryPass now updates the section planes automatically for any overriden materials (#3409) 2024-10-30 14:31:30 +02:00
Alexandru Popovici a5cc51040c Added batch material override support for instanced speckle meshes, aka all instances (#3411) 2024-10-29 19:14:23 +02:00