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

Annotation plugin custom z-index for markers & labels #1017

Merged
merged 1 commit into from
May 2, 2023
Merged

Annotation plugin custom z-index for markers & labels #1017

merged 1 commit into from
May 2, 2023

Conversation

christophe77
Copy link

Added custom z-index for Markers & Labels of Annotation plugin.

@ghost
Copy link

ghost commented Apr 1, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@xeolabs xeolabs merged commit e58d3ba into xeokit:master May 2, 2023
@xeolabs xeolabs self-requested a review May 2, 2023 18:37
@xeolabs xeolabs added the enhancement New feature or request label May 2, 2023
@xeolabs xeolabs added this to the 2.4.0 milestone May 2, 2023
xeolabs added a commit that referenced this pull request May 4, 2023
@xeolabs
Copy link
Member

xeolabs commented May 4, 2023

I needed to roll this one back because it introduced a syntax error and would not compile.
Screenshot from 2023-05-04 14-14-05

Uncaught TypeError: Cannot read properties of undefined (reading '2')
at new AnnotationsPlugin (@xeokit_xeokit-sdk.js?v=73278906:7005:58)
at createAnnotationPlugin (annotations.ts:6:10)
at ifc-player.tsx:137:32
at commitAttachRef (chunk-AXG4LW7R.js?v=09bc691a:15314:15)
at commitLayoutEffects (chunk-AXG4LW7R.js?v=09bc691a:16915:17)
at HTMLUnknownElement.callCallback2 (chunk-AXG4LW7R.js?v=09bc691a:3801:22)
at Object.invokeGuardedCallbackDev (chunk-AXG4LW7R.js?v=09bc691a:3826:24)
at invokeGuardedCallback (chunk-AXG4LW7R.js?v=09bc691a:3860:39)
at commitRootImpl (chunk-AXG4LW7R.js?v=09bc691a:16733:17)
at unstable_runWithPriority (chunk-AXG4LW7R.js?v=09bc691a:348:20)

in this line:
const randomZIndex = 90005 + Math.floor(this._viewPos[2]) + 1;
this._viewPos is not initialized

Kurtil added a commit to Amoki/xeokit-sdk that referenced this pull request May 16, 2023
* Install the CodeSee workflow. Learn more at https://docs.codesee.io

* Support federated metamodels xeokit#991

* Fix Angle and Distance measurement failure to set second point xeokit#998

* Skip inactive section planes in BCF getViewpoint

* Support federated metamodels xeokit#991

* Support federated metamodels xeokit#991

* Support federated metamodels xeokit#991

* npm bump

* Support federated metamodels xeokit#991

* fi typo in LineBatchingLayer

* fix imports to make them ES valid

* Fix loaders.gl import

* Fix imports

* more fixes

* fix las loader import

* z-index

* Optimization: avoid unneeded DOM layout calculations due to the obtention of Client Bounding Rect.

* Optimization: avoid to create 1 anonymous function instance every time a scene render happens.

* Optimization: avoid to bind same texture to same texture unit if was already bound.

* Improved WebGL2 compatibility.

(this does not make all xeokit code compatible with WebGL2)

* Introducing `DataTexturePeformanceModel`

This is a variation of `PeformanceModel` where all the GPU data is stored in data textures.

GPU memory savings are bigger than 80% (both with instanced and non-instanced geometries) when using the `DataTexturePerformanceModel`.

It requires WebGL2 to run properly.

* GPU-Optimised support for per-Entity Offsets.

* Fix management of deferred-flags in data-textures model

* Add GPU-optimized support for per-object coloring.

Plus minor refactors to make to code more readable.

* Bugfix: take into account `transparent` flag for entities in `TrianglesDataTextureLayer`.

* Introduce a toggle-able LOD mechanism.

This will keep hiding the most complex objects in the scene to be able to keep up with a `target frame rate`.

This is an extension to the `DataTexturesPerformanceModel`.

* Introduce a toggle-able View Frustum Culling mechanism.

This will cull the objects outside of the camera frustum, by making use of an `r*tree` data structure to speed up containement queries.

This is an extension to the `DataTexturesPerformanceModel`.

* Fix shader normal calculation in `data-textures Renderers.

* Fix normal picking in `TrianglesDataTexturePickNormalsRenderer`

* Fix in `ViewFrustumCullingManager.js` when there is no geometry in the AABB tree

* Increase the precision of per-object matrices from HALF_FLOAT to FLOAT.

* Avoid to draw triangles if the object `alpha` is zero.

* Replace wrong usage of `Float16` textures with `Float32` textures

* When finalizing data-texture Models, make sure to update flags for portion in batched mode,

This saves 1/3rd of model load time.

* Update data-textures initializtion with latest changes in `master`

Fix after rebase

data-textures: fix initialization of AABB's

* data-textures: avoid the need to store entity-normal matrices

* data-textures: register number of created data-textures in DataTextureRamStats

* data-textures: Increase max geometry texture size to 4096x4096 indices and vertices

* data-textures: Increase max colors texture size to 512 objects per row

* data-textures: remove temporary log

* data-textures: Increase positions+entity matrices texture size to 512 objects per row

* data-textures: Increase offsets texture size to 512 objects per row

* data-textures: raise the limit from 4096 objects/layer to 65536

* data-texture: add support for double-sided gometry

This introduces a novel way of doing it when geometries are non-solid.

In the Vertex Shader, non-geometries' triangles will have its winding flipped in case they would be culled.

* data-textures: more efficient double-side management

This is done by transforming the camera=>polygon vector to quantized space instead of transforming the normal to de-quantized space.

* data-textures: fix shading

This is done by taking into account the portion positioning matrix (entity * positions-decode) when obtaining the view-normal

* data-textures: add support for arbitrary ray-picking

(both for `ortho` and `perspective` camera modes)

* data-textures: use WebGLv2 syntax for section plane clipping code

* data-texture: add support for `TrianglesDataTextureSilhouetteRenderer`

* data-textures: add support for `TrianglesDataTextureEdgesRenderer`

* data-textures: clean-up temporary debug code

* data-textures: use `instanceof` instead of string comparison for `drawable.constructor.name`

* data-textures: temporarily disable shaders related to SAO

* data-textures: protect access to the update of pick-view-matrix

* data-textures: split initialization of camera-matrix and pick-camera-matrix in data-tex-perf-model

* Refactorings xeokit#824

* Refactorings xeokit#824

* Improvements in the LOD mechanism

* Fix missing DistanceMeasurement "measurementEnd" event for touch xeokit#1019

* npm bump

* xeokit#1022

* npm bump

* Make Frustum class public

* Added examples

* Fix unwanted SAO depth render for DataTextureSceneModel xeokit#824

* Add examples

* npm bump

* Make `VFC` mechanism support `model.worldMatrix` != ' identity'

This fixes a problem where View Frustum Culling would not work well for models loaded with e.g. the `cfg.position` parameter different from the zero vector.

This fix is based on the fact that it is the same (during `VFC`):

- to pre-process the AABB's so they include the `model.worldMatrix` and this the culling considers final world-AABB's. Then the clipping happens in world-space.
- to instead transform the camera `eye`/`look` with the inverse transform, so the AABB's are kept the same. Then the clipping happens in model-space.

* Add `useDataTextures.disableVertexWelding` option to the `XKTLoaderPlugin`

This allows to disable welding geometry vertices when loading the data into the GPU.

* Add `useDataTextures.disableIndexRebucketing` option to the `XKTLoaderPlugin`

This allows to disable adaptive demotion of triangles indices' bitness.

* Implement Depth Renderer for data-textures

* Allow SAO in `DataTextureSceneModel`

* Mitigation for what looks like a bug in Chrome for Mac

When using data-textures, unless those `Unit8Array`'s are converted to `Unit16Array`'s, the geometry is corrupted in Chrome for Mac after using the SAO renderers for the 1st time.

* When SAO-rendering triangles in data-textures, use a GL texture unit different from 0

This prevents additional texture re-binds as texture unit 0 is used frequently to update camera matrices, and portion flags.

* SAO-rendering for data-textures triangles: make sure the renderer is WebGLv2-compatible

* Chrome-for-Mac mitigation for data-textures when SAO enabled

Improvement over a previous mitigation where models containing objects with > 2^16 triangles, when using data-textures, got corrupted in Chrome for Mac when enabling SAO.

* Fix sticky DistanceMeasurementsControl xeokit#1030

* Enable masking in datatex depth vert shader & tweaks xeokit#811

* Removed redundant ScratchMemory from DataTextureSceneModel xeokit#811

* Rename some internal classes xeokit#811

* npm bump

* npm bump

* Fix broken TreeViewPlugin checkbox synchronization xeokit#1031

* npm bump

* add properties for nav cube to be able to turn on/off the usage of project north / true north,
and set the offset angle to align the nav cube to the used north. the default is using true north, and when setting the project north offset angle - it will rotate the nav cube to align it.

* remove duplicated line in Component.js

The removed line is identical to the line `170` which is always executed.

* [data-textures]: implement a smart deferred flags update mechanism

If the number of updated per-object properties in a frame is less than a threshold, they will be updated directly.

If the number of updates is instead bigger than a threshold (by default 10), the ones above the threshold will be batched, and the batch flushed just before rendering the frame.

This completely solves xeokit#1033

* Enable SAO rendering in Safari.

* npm bump

* Fix broken TreeViewPlugin checkbox synchronization xeokit#1031

* npm bump

* Unmerge PR with syntax errors
xeokit#1017

* npm bump

* Added examples

* Fix broken TreeViewPlugin checkbox synchronization xeokit#1031

* Fix Viewer.getSnapshot custom width and height params xeokit#1040

* npm bump

* Make annotation dots and labels ignore mouse wheel events xeokit#1041

* npm bump

* Add NavCubePlugin option to align with project/true North xeokit#1042

* npm bump

* Add NavCubePlugin option to align with project/true North - fix top & bottom clicks xeokit#1042

* npm bump

* Add NavCubePlugin option to align with project/true North - customize example xeokit#1042

* Enable mouse wheel zooming while hovering over measurements xeokit#1043

* npm bump

* Fix stuck pan/rotate/dolly keypresses over annotations and measurements xeokit#965

* npm bump

* [fix]: make sure to restore `gl.pixelStatei` changes in `Texture2D` class

---------

Co-authored-by: codesee-maps[bot] <86324825+codesee-maps[bot]@users.noreply.github.com>
Co-authored-by: lindsay <lindsay.kay@xeolabs.com>
Co-authored-by: Hugo Duroux <hugo@bimdata.io>
Co-authored-by: Hugo Duroux <hugo.duroux@gmail.com>
Co-authored-by: Christophe B <christophe.bellec@kwarto.immo>
Co-authored-by: Toni Martí <toni.marti.coll@tribia.com>
Co-authored-by: Elyran Kogan <elyran.kogan@versatile.ai>
@assaad97
Copy link
Contributor

assaad97 commented Mar 28, 2024

@xeolabs regarding z-index on annotation marker and label, i noticed that they still exist on the function Annotation::_updatePosition, where a z-index greater than 90005 is enforced.

is this forced z-index is related to a specific use case ?

xeokit v 2.5.2-beta-4

image

@xeolabs
Copy link
Member

xeolabs commented Mar 28, 2024

@xeolabs regarding z-index on annotation marker and label, i noticed that they still exist on the function Annotation::_updatePosition, where a z-index greater than 90005 is enforced.

is this forced z-index is related to a specific use case ?

No not really - it's just a hack to ensure that annotations always float about things like HTML elements used to represent measurements, a guess at a large enough z-index value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants