[x3d-public] Extensibility > proto extends builtin > how declare/detect type
GPU Group
gpugroup at gmail.com
Sun Nov 9 14:32:37 PST 2025
"extending concrete nodes" good question, yes exactly that's what I meant
by builtin, opposite of abstract, but your term concrete seems better,
thanks.
It seems like what's stopping extensibility of concrete types through
protos, is some way to declare / signal the concrete type being
extended, in such a way the browser code dealing with concrete types can
treat the extended proto the same way as the concrete type it's extending.
Then if the extended proto has extra fields, they can be routed to in the
main scene, or if the proto body has a Script node, it can play with the
regular fields on each frame.
-Doug
On Sun, Nov 9, 2025 at 3:22 PM John Carlson <yottzumm at gmail.com> wrote:
> My perhaps misunderstanding is that only abstract nodes can be extended.
>
> I think OO inheritance has been deprecated except for interfaces, and
> wrapping (delegating) ends up being a better choice for most cases.
>
> Doug, are you considering extending of concrete nodes?
>
> On Sun, Nov 9, 2025 at 8:23 AM GPU Group via x3d-public <
> x3d-public at web3d.org> wrote:
>
>> Builtin - nodes defined in x3d specs
>> Q. how to declare / detect what builtin node type a ProtoDeclare extends?
>> Thanks,
>> -Doug Sanden
>> Normally if we want to change parameters on a builtin node, we tinker
>> directly with the builtin node in the scene with routes and scripts.
>> In theory builtin nodes are extensible -- a ProtoDeclare can wrap a
>> builtin, IS all the fields, and add some spice with a Script node inside
>> the proto that updates some fields on each frame. But how is the x3d
>> browser code supposed to detect what builtin node type is being extended?
>> For example, Shape.appearance.material can take different types of
>> material nodes: UnlitMaterial, Material, PhysicalMaterial. In browser
>> application code there's different handling of each type:
>> if mat.type == UNLIT then
>> ...
>> else if mat.type == MATERIAL then
>> ...
>> else if mat.type == PHYSICAL then
>> ...
>> endif
>> But a ProtoInstance has a ProtoDeclare type which doesn't give a hint as
>> to which builtin type the ProtoDeclare is extending.
>> Q1. How is the code supposed to detect which builtin type to process?
>> Q2. If a ProtoDeclare extends a previous ProtoDeclare, which extends a
>> builtin type, and assuming single-inheritance chain from builtin, how can
>> browser code detect the original bultin being extnded?
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20251109/1c32dc80/attachment.html>
More information about the x3d-public
mailing list