[x3d-public] Improve my example? No scripts? (John Carlson)

Andreas Plesch andreasplesch at gmail.com
Mon Oct 7 10:00:47 PDT 2024


It would be difficult to do without a script.

But one way may be to have one ColorInterpolator per color (only way
to generate SFColor out events), and one Timesensor per color (to
generate fraction events to trigger the color events), all disabled
initially. (Actually, one set of such pairs for each Cylinder).

Then enable the Timesensor which corresponds to the selected color on
the color bar, and disable all others. Probably via Touchsensor on
each color square and routing isActive and negated isActive through
BooleanFilter to the Timesensors (lots of Routes, colors squared or
so.)

Then route touchTime from the cylinder Touchsensors to startTime (and
perhaps stopTime, for one-time triggering) to all Timesensors for the
Cylinder. Only the enabled Timesensor would trigger SFColor out from
the associated ColorInterpolator.

Then route all ColorInterpolators (for the specific Cylinder) to all
Materials. To make this idea work, actually separate sets of
ColorInterpolator/Timesensor pairs would be needed per individual
Cylinder.

So this might work but needs very many nodes and routes. On the other
hand the scripts also need lots of functions.


There may be another way based on Switch nodes, and having predefined
Shapes per color. So given n colors, each Cylinder is a Switch with n
Shapes. Then touching a cylinder, selects a color based on a
IntegerTrigger node (per Switch).

The IntegerTrigger nodes are reconfigured (set_integerKey) when a
color square is selected. I think this can be done via a
IntegerSequencer which gets a fraction from a ScalarInterpolator (per
color) with a single keyValue, which is fed from a Timesensor which
can be triggered from a Touchsensor on the color square.

The piece missing is that reconfiguration also generates triggerValue
out which would be routed to the Switch nodes which is not wanted
then. Not sure how to solve this, I could not think of a way.

Some ideas, -Andreas


> Message: 1
> Date: Fri, 4 Oct 2024 14:08:10 -0500
> From: John Carlson <yottzumm at gmail.com>
> To: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: [x3d-public] Improve my example? No scripts?
> Message-ID:
>         <CAGC3UEmtY=6GjARK+TaQy3HU9FCJrHZgbhe7Zn0mdVafEUoKYQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Can this be done without scripts so i can use castle-model-viewer?
>
> https://github.com/coderextreme/JSONverse/blob/main/public/x3d/symbols3d.x3d
>
> If not, can we extend the standard?
>
> Thanks!
>
> John


-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list