Add diegetic NPC dialogue demo — interactive HTML in a Three.js scene (#71)#113
Open
Twynzen wants to merge 1 commit into
Open
Add diegetic NPC dialogue demo — interactive HTML in a Three.js scene (#71)#113Twynzen wants to merge 1 commit into
Twynzen wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an interactive HTML dialogue panel rendered as a texture on a 3D billboard plane in a Three.js scene, using the new
texElementImage2DAPI. Addresses #71 by providing an interactivealternative to the existing webGL cube demo.
What it showcases
<select>,<input>, and<button>with full keyboard andscreen-reader access, painted into the 3D scene.
while all controls remain responsive, including
<input>focus and typing.texElementImage2D(spec'd liketexImage2D) and Three.js' defaulttexStorage2Dimmutablestorage, by creating the GL handle manually and injecting it into the library's texture cache.
How to test
chrome://flags/#canvas-draw-elementenabled.Examples/diegetic-npc-dialogue.html.should remain stable in any viewing angle.
Notes on integration friction (feedback for #94)
While building the demo I hit three issues worth documenting — I can open a separate comment on #94 with the full analysis, but briefly:
texStorage2D), which failstexElementImage2D.Workaround: bypass the library's allocation via
renderer.properties.get(tex).__webglTexture.getBoundingClientRect()is self-referential anddrifts. Measuring a natural-position anchor once and computing absolute transforms fixes it.
interactive DOM descendants —
stopPropagation()on the panel is required.Happy to expand on any of these if helpful.