[x3d-public] X3DJSAIL: Many DEFs with same value
John Carlson
yottzumm at gmail.com
Thu Apr 30 04:02:20 PDT 2026
Gemini’s response on how to patch X3DJSAIL:
https://aistudio.google.com/app/prompts?state=%7B%22ids%22:%5B%221BXu0Kisposz09uPwE3BVWQBIGzD3IMUw%22%5D,%22action%22:%22open%22,%22userId%22:%22103290302001906699037%22,%22resourceKeys%22:%7B%7D%7D&usp=sharing
Review at your convenience!
John
On Thu, Apr 30, 2026 at 5:24 AM John Carlson <yottzumm at gmail.com> wrote:
> Summary: to employ multiple DEFs with same value, employ a table per name
> scope of DEF information in per Java thread java.lang.ThreadLocal memory
> for encoded output with one DEF per DEF/USE value. See bolded table
> description below.
>
> Feel free to forward.
>
> Is many DEFs with same value for a scenegraph node being considered in
> discussions? Say I want to addChild() the same Shape node several times to
> different Transforms, and the Shape node or descendants have DEFs in
> them. In X3DJSAIL, of course. This is easily done in an SAI binding
> like X3DJSAIL, just use the same variable passed to several addChild()
> methods.
>
> If it is allowed, what comes out in XML? I am hoping one leading DEF and
> several USEs for backwards compatibility. I think Castle has shown that
> this is doable.
>
> I am not saying VRML, XML, DOM, or HTML should have multiple parents of a
> child node. If a browser wants to implement a proxy when a DEF/USE appears
> more than once, they should be free to do that. (Hint: JavaScript’s Proxy
> class.) Maybe each mention of a DEF value (second or following) or USE
> value (any natural number of them) should create a Proxy on setting or
> adding?
>
> I do think the encodings are doing the right thing, no changes there. How
> can we achieve that output and support multiple parents (references or
> proxies to children) in X3DJSAIL with one DEF node per DEF value output?
>
> I’m particularly wondering for X3DJSAIL.
>
> Do we need proxies, or will table(s) also solve the issue of multiple
> DEFs, and replace all but the first with USE on output? Also perhaps
> assuming there’s a DEF table per name scope. How does X3DJSAIL support
> name scopes? (I’m clueless, currently). *I’m imagining a table with
> DEF_value, DEF_found, reference_count, DEF_nodes and USE_nodes columns.
> Maybe a name_scope and node_type_name as well.* These table(s) would be
> initialized when output begins potentially when a name scope is entered,
> and filled out as the XML is created. Multiple threads? The table can be
> stored in ThreadLocal memory. Bingo, if it’s still a thing.
>
> Please let me know if such a thing is already available.
>
> Someone else can solve for X3DPSAIL?
>
> Will this also handle USE before DEF?
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20260430/e09316a7/attachment.html>
More information about the x3d-public
mailing list