Commit Graph

24 Commits

Author SHA1 Message Date
Kristaps Fabians Geikins 8f0af9efbd fix(viewer): fixed three.js imports to hopefully fix fe2 (#1660)
* fix(viewer): fixed three.js imports to hopefully fix fe2

* undoing viewer changes that break preview service
2023-06-28 16:04:29 +03:00
Alexandru Popovici 5844280e35 Alex/measurements (#1639)
* WIP on measurements. Got some basic functionalities going

* New update for measurements. We're no showing multiple lines towards the measurement endpoint for better reference. Added dotted lines. Added text. Added measurement end and start points. Added the possibility to add multiple measurements.

* When double clicking, Input will not ignore the second click and will not send a click event. It will send the first click event, then a double click event. Implemented auto perpendicular measurement by using double click

* Added the option to have fixed sized measurement gizmos. As in, the are the same size regardless of the camera zoom. Implemented gizmo styles which lets us control and change at runtime the way the gizmos look. Currently they're only programatic, but I'll add controls for them in the sandbox next

* Implemented measurement management. Added picking, cancelling, removing and highlighting of measurements. Measurements are all now on their special ObjectLayer

* Added frame lock, so mouse events do not trigger intersection tests more than once per frame for the measurements. Added opacity options in the measurement gizmos. Made the end gizmo line transparent by default. Added preprocessor macro in the line shader which enables opacity as a uniform as opposed to attribute only like we had it before

* Point is now fixed size when style imposes it

* WIP on text aligning with the line. Still needs some things to be clarified since it can get complicated. Fixed some color issues. Added a maximum constraint to the screen space gizmo sizes. It's empirical, but seems to be workign decently for the all the various stream sizes I've trid

* Measurement gizmo now flashes red a few times if requrested to auto-lazer and no intersection was found

* Added unit conversion to measurment text, unit display and precision

* Implemented proper billboarding (fixed size and non fixed size) in the text and basic vertex programs as well as support for them in the text and basic speckle materials. Overhauled how the measurements look based on the forge reference

* Split measurements by type and added an abstract superclass. Point to point measurement has it's own implementation now

* Implemented screen space snapping for point to point measurements. Text background now gets dyanamically resized when needed

* End point gizmo is now only shown when required

* Added clamp guard to acos since dot can return outside of [-1,1] due to fp precision issues. Fixed an issue where existing measurements could be selected in the process of creating another measurement

* Added function for adding measurements programatically. Currently only start and end point make sense as measuremetn data

* Added an 100nm offset from the original point along the surface normal for auto-lazer function because sometimes it would intersect itself and report incorrect length

* Separated all measurement related rendering into a separate 'Overlay' pass. We now have better control over the rendering order of the individal elements of the measurement gizmos. This fixed the issue of having the measurement line overlap the end points

* Billboarded shaders now also work correctly with section planes

* Measurement tool no longer considers surfaces clipped by the section box

* Implemented correct raycasting for billboarded and fixed sized bibboarded objects, like the measurement's text

* Implemented zooming in to measurements when double clicking

* Big update to measurements which addresses most if not all requirements regarding UX/UI, API, and generaly functionalities. Additionally, a fix or an ancient issue in Units where kilometers were incorrectly calculated, and added automatically resolution updates to the SpeckleLineMaterial

* Added dpr factor into billboard size calculations. Fixed an issue with the round rect geometry generation function which would fail on macos. Added the billboard text background size into the text's style so it's configurable

* Text can now be updated for perpendicular measurements also when in it's complete state

* Fixed an exception which was thorwn when double clicking on another measurement while measuring

* When changing the measurement type while the measurement is still in it's dangling start state, the measurement gets cancelled and a new one with the new type gets started. If the measurement is in it's dangling end state, then it does not. This is now forge viewer does it

* Implemented screen space surface normal indicator line

* Measurements now work on visible and non-ghosted objects. Removed the surface normal indicator from the point to point measurement

* Fixed an issue with orthogrtaphic camera and NDC normal computation. Implemented fixed sized gizmo disc for orthographic camera

* Fixed an issue where the pipeline would not get properly reset after zooming in orthographic mode

* Fixed some regressions with the pre-existing application measurements functionalit and text. Fixed an issue where auto-lazer measurements were not vertically centered.
2023-06-27 15:13:39 +03:00
Alexandru Popovici b9d68efc55 #1408 - Separate Object Layers by Geometry Type (#1422)
* Extended the ObjectLayers on a per geometry type basis. We can now restrict intersections and rendering based on geometry type (mesh, line, point)

* Disabled geometry type based filtering of opaque/transparent/stencil objects in the batcher, since we're using separate object layers for the geometry types now

* Fixed and issue with OR-ing layers
2023-02-27 16:20:42 +02:00
Alexandru Popovici 96b3a4923b Viewer queries (#1331)
* Added the concept of queries with a minimalistic implementation. Implemented PointQuerySolver which handles occlusion, projection and unprojection of points

* Added and tested the 'Pick' PointQuery operations which works just like an onclick viewer event

* Small fixes and changes to query and point query.

* Better approach on the occlusion query solving by using our universal scene intersection routine

* Tested and fixed occlusion testing for points

* Added optional custom width and height to NDC<->Screen helper functions

* Integrated queries in the frontend. Projection queries replace projecting by hand, and also added occlusion queries as a demonstration

* Added refactor comment
2023-01-20 18:59:01 +02:00
Alexandru Popovici de2bce89a5 Alex/verbosity and mouse event (#1275)
* Added a verbose flag in the viewer params. Default is false and it's equivalent to the ERROR level

* Piggybacked the original pointer event into the SelectionEvent
2023-01-02 16:23:52 +02:00
AlexandruPopovici 9fd98f6ed7 Fix for #1203 2022-11-15 18:08:17 +02:00
AlexandruPopovici 3779a6895c Fixed an issue with BVH building for uint16 indices. Removed some logs 2022-11-15 17:26:42 +02:00
AlexandruPopovici 10771db1aa Integrated three-mesh-bvh's bvh with the viewer's raycast picking. Using a simple workaround for the library's need of re-sorting the index buffer. Implemented a new way of retrieving the objects from the batch based on the raycast hit result index which does not depend on the order inside the index buffer 2022-11-03 22:10:19 +02:00
AlexandruPopovici 80ac7af6d2 fix: support for picking hit chain
The ViewerEvent now haw two (currently optional) members. hitChain which contains the ordered list
of speckle objects that were hit and hitPoints which holds the hit locations for all hit objects.

#995
2022-09-08 16:26:58 +03:00
AlexandruPopovici 20d15dd859 Fix #989 2022-09-07 12:55:01 +03:00
AlexandruPopovici 1a0fc5556b Added dynamic line threshold calculation based on an emipirical model. Extened three's Raycaster class so we can have more controls on raycasting 2022-08-23 13:58:12 +03:00
AlexandruPopovici d3163bff2f Fixed the issue where you could select objects clipped by thesection planes 2022-08-17 15:32:54 +03:00
AlexandruPopovici bdd51cfcf5 #827 Fixed an issue with raycaster not having a null check. Removed massive redundancy in applyin filters. Now filters apply 30-40 times faster. More improvement can be done, but this was a low hanging fruit 2022-08-02 13:12:16 +03:00
AlexandruPopovici 4955e16b6e #827 Fixed some issues with line materials not correctly initialised 2022-07-29 18:29:50 +03:00
AlexandruPopovici 33fc450377 #827 Fixed an issue with block transformation and displayValues. 2022-07-29 12:27:10 +03:00
AlexandruPopovici f73384e66f #811 Integrated double-click to zoom, and zoom extents with the new viewer. Currently I'm using old existing code just for the sake of less regression, but will revisit it in the future 2022-06-21 15:47:24 +03:00
AlexandruPopovici 499653d983 #811 Started taking the axe on a lot of legacy code which became obsolete after redux Stage 2. Turned ViewerObjectLoader to typescript and started moving a lot of stuff from viewer to a new class, SpeckleRenderer, which will centralize and handle a lot of stuff 2022-06-21 00:58:20 +03:00
AlexandruPopovici 11a429f9ca #783 Implemented Point and PointCloud speckle type support for batching and everything else. 2022-06-20 16:39:51 +03:00
AlexandruPopovici 60536592a4 #783 Implemented visible range for batches. Required when wanting to isolate/hide/don't show stuff. Only implemented it for the mesh batch type for now. Line batch is next 2022-06-17 19:07:10 +03:00
AlexandruPopovici c7a2390bf3 #783 Implemented multi selection via multiple draw range with automatic fill of groups. Implemented selection of multiple objects when clicking something in the world, if that object is part of a whole and it needs to be selected together with others. It's not perfect yet, I;ve seen some bad selections, but will fix that soon 2022-06-17 17:28:39 +03:00
AlexandruPopovici d508eb6d5b #783. Implemented separate materal draw ranges for the line batches. Added the Batch common interface and separate the MeshBatch from the LineBatch, both implementing the Batch interface. Selection now works properly for both meshes and lines 2022-06-16 19:40:32 +03:00
AlexandruPopovici 4d764c166c #783 Implemented line batch colouring using an additional InstancedBufferAttribute where each line segment can have it's own color. This way we can know which subset to color differently. Transparency is also supported in theory, but will get to that later on. Also started to split the mesh batch from the line batch since they will be conceptualyl different, but share a common contract 2022-06-16 17:19:41 +03:00
AlexandruPopovici 6084a4849c #783 Implemented picking for the batched meshes 2022-06-15 17:30:04 +03:00
AlexandruPopovici 1846554778 #783 Working on picking and fixing some issues which arose a few days ago regarding some types of lines when I switched to full-tree represenation 2022-06-15 11:13:25 +03:00