Skip to content

Conversation

remmel
Copy link
Contributor

@remmel remmel commented Mar 5, 2022

Description

Small HtmlMesh improvement

  • Handle transparent
  • Fix the VR UI when the html size changes (see gif of bug) - my fix seems pretty dirty the problem should be fix at the root? Texture doesn't seem to handle when its source image size change
  • Demo with vanilly/litelement/react (probably won't be commited in dev)
  • Handle shadowRoot (with some limitation as MutationObserver ignores shadowRoot and no shadowRoot attach event (when calling HTMLMesh we cannot easily know if and when dom.shadowRoot will be created)

Peek 2022-03-08 13-56

Demo

The CI fail, because I make myself the screenshot (cannot run make screenshot locally)

  • There is still a bug when using react (adding bubbles : const mouseEventInit = {bubbles: true}; fixes it, but after I get error from Google Translate chrome plugin :s) - I won't fix it
  • When the html size change, the geometry should be resized, otherwise, the UI is wrongly scaled. Don't know how to fix that : Maybe just forget it? Same for the fixed part? Revert it also?

…dd example

- handle transparency : do we lose ms if the texture is transparent for nothing ? (canvas is not)
- dispose the canvasTexture when the canvas size changed. Do not understand why this is needed
- shadow root : finally won't use it to avoid adding not so usefull code : LitElement can stop using shadowRoot (`createRenderRoot() {return this;}`)
- add vanilly/lit/react html for htmlmesh with interactions

- commit the screenshot jpg to not avoid that CI error `Make screenshot for example(s): webxr_vr_htmlmesh` - webxr_vr_htmlmesh.html won't probably be in dev, but that to have a green CI
@remmel remmel force-pushed the htmlmeshinteraction branch from ac71af5 to 4044931 Compare March 8, 2022 12:45
@remmel remmel marked this pull request as ready for review March 8, 2022 13:03
@remmel remmel changed the title [WIP] Improve HTMLMesh (handle interactions and webcomponents) [WIP] Improve HTMLMesh (transparent and html size changes) Mar 8, 2022
…d in the html example not in the HTMLMesh.js (see `lit-updated` event). Because MutationObserver doesn't trigger when shadow changes, not even when it is attached the the dom, thus this is easier and cleaner to handle in Lit
@remmel
Copy link
Contributor Author

remmel commented Mar 8, 2022

Hi! Waiting for your feedbacks. Especially about the Fix the VR UI when the html size changes and the geometry not resized. Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Mar 8, 2022

Hmm, what are your questions exactly?

@remmel
Copy link
Contributor Author

remmel commented Mar 8, 2022

@mrdoob

Hmm, what are your questions exactly?

Is there a cleaner alternative than calling super.dispose(); when canvas changed (cf 4044931) - Do Texture expect the image size to change ? I have the feeling that it should be fixed somewhere in Texture instead.

@remmel remmel changed the title [WIP] Improve HTMLMesh (transparent and html size changes) Improve HTMLMesh (transparent and html size changes) Mar 8, 2022
@vincentfretin
Copy link
Contributor

@remmel I have something working for the canvas size changed, I emit a size-changed event and recreate the mesh in an aframe component, surely we could recreate only the geometry instead of recreating the whole mesh, geometry, material and texture but I didn't succeed to do that. You were close to detect canvas size change, but you needed setting canvas.width and canvas.height out of the condition. See AdaRoseCannon/aframe-htmlmesh#14 (aframe-htmlmesh repo contains a copy of master HTMLMesh.js)

@mrdoob
Copy link
Owner

mrdoob commented Apr 26, 2023

@remmel Do you mind splitting this into multiple PRs? The resize code is blocking the other improvements.

@mrdoob mrdoob added this to the r153 milestone Apr 26, 2023
@Mugen87 Mugen87 modified the milestones: r153, r154 Jun 1, 2023
@mrdoob mrdoob modified the milestones: r154, r155 Jun 29, 2023
@mrdoob mrdoob modified the milestones: r155, r156 Jul 27, 2023
@mrdoob mrdoob modified the milestones: r156, r157 Aug 31, 2023
@mrdoob mrdoob modified the milestones: r157, r158 Sep 28, 2023
remmel referenced this pull request Oct 1, 2023
…24030)

* Add some more input types and support rounded rectangles

* actually perform border check

* remove unneeded code

* s/roundRectPath/buildRectPath/

* range input handler

* Clean up.

* More clean up.

Co-authored-by: mrdoob <[email protected]>
@remmel
Copy link
Contributor Author

remmel commented Oct 1, 2023

Transparency has already been added 3ac055ce6111b5a63cf81c081e3c5f5940fb4e6a
Others feature resize and shadowRoot are less important and might be implemented is seperated layer.
I'm thinking about adding an exemple/webxr_vr_htmlmesh.html to show some HTMLMesh usage, (image load, transparency, etc..) what do you think?

@remmel remmel closed this Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants