1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
|
3 | <X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'> |
4 | <head> |
5 | <meta name='title' content=' ColorSequencerExample.x3d '/> |
6 | <meta name='description' content='This example shows how to use the ColorSequencer prototype in an animated scenario. ColorSequencer outputs an individual SFColor without interpolation, in response to selecting an array value or simply sequencing next/previous.'/> |
7 | <meta name='creator' content='Don Brutzman'/> |
8 | <meta name='created' content='25 May 2003'/> |
9 | <meta name='modified' content='28 November 2019'/> |
10 | <meta name='reference' content='https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#ScalarInterpolator'/> |
11 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/Basic/development/BooleanSequencerExample.x3d '/> |
12 | <meta name='reference' content=' ColorSequencerPrototype.x3d '/> |
13 | <meta name='subject' content='color sequencer'/> |
14 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerExample.x3d '/> |
15 | <meta name='generator' content='X3D-Edit 3.2, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
16 | <meta name='license' content='../../license.html'/> |
17 | </head> |
18 | <Scene> |
19 | <WorldInfo title='ColorSequencerExample.x3d'/> |
20 | <ExternProtoDeclare name='ColorSequencer' appinfo='ColorSequencer outputs a single color value by selecting an array index or simply sequencing next/previous' url=' "../../../Savage/Tools/Animation/ColorSequencerPrototype.x3d#ColorSequencer" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerPrototype.x3d#ColorSequencer" "../../../Savage/Tools/Animation/ColorSequencerPrototype.wrl#ColorSequencer" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/ColorSequencerPrototype.wrl#ColorSequencer" '> |
21 |
<field name='enabled' type='SFBool' accessType='inputOutput'
appinfo='Whether or not this sequencer is active'/> |
22 |
<field name='index' type='SFInt32' accessType='inputOutput'
appinfo='Initial index is array element 0. Setting index past colors[max] uses final color value setting, while index less than 0 uses colors[0] value.'/> |
23 |
<field name='colors' type='MFColor' accessType='inputOutput'
appinfo='Array of color values that are each the outputs of the sequencer. No interpolation occurs between values.'/> |
24 |
<field name='color_changed' type='SFColor' accessType='outputOnly'
appinfo='Current output color value of the sequencer corresponding to colors[index] value.'/> |
25 |
<field name='previous' type='SFBool' accessType='inputOnly'
appinfo='Trigger previous color value. Wrap around from zeroth color to final color if necessary. Only respond to true inputs.'/> |
26 |
<field name='next' type='SFBool' accessType='inputOnly'
appinfo='Trigger next color value. Wrap around from final color to zeroth color if necessary. Only respond to true inputs.'/> |
27 |
<field name='traceEnabled' type='SFBool' accessType='initializeOnly'
appinfo='Enable tracing of node operation on browser console'/> |
28 | <!-- <field accessType='inputOnly' appinfo='Change colors array' name='set_colors' type='MFColor'/> --> |
29 | <!-- <field accessType='inputOnly' appinfo='Change current colors index must be in range [0 .. colors.length-1]' name='set_index' type='SFInt32'/> --> |
30 | </ExternProtoDeclare> |
31 | <Viewpoint description='ColorSequencer demo'/> |
32 | <Background skyAngle='0.5 0.5 0.5' skyColor='0.5 0.5 0.5'/> |
33 |
<!-- ROUTE information for ColorSequencerInstance node:
[from TouchPrevious.isActive to previous
]
[from TouchNext.isActive to next
]
[from Ticker.value_changed to index
]
[from color_changed to MessageMaterial.diffuseColor
]
[from color_changed to MessageBackgroundMaterial.diffuseColor
]
-->
<ProtoInstance name='ColorSequencer' DEF='ColorSequencerInstance'> |
34 | <!-- ROY G BIV = red orange yellow green blue indigo violet --> |
35 | <fieldValue name='colors' value='1 0 0 1 0.5 0 1 1 0 0 1 0 0 0 1 0.2 0.2 0.2 0.4 0 0.4'/> |
36 | <fieldValue name='enabled' value='true'/> |
37 | <fieldValue name='index' value='2'/> |
38 | <fieldValue name='traceEnabled' value='true'/> |
39 | </ProtoInstance> |
40 | <Transform translation='0 1.5 0'> |
41 | <Shape> |
42 | <Text string='"ColorSequencer" "Example"'> |
43 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='1.3'/> |
44 | </Text> |
45 | <Appearance> |
46 |
<!-- ROUTE information for MessageMaterial node:
[from ColorSequencerInstance.color_changed to diffuseColor
]
-->
<Material DEF='MessageMaterial' diffuseColor='0 1 1'/> |
47 | </Appearance> |
48 | </Shape> |
49 | <Transform translation='0 -0.25 0'> |
50 | <Shape> |
51 | <Box size='10.0 4.0 0.1'/> |
52 | <Appearance> |
53 |
<!-- ROUTE information for MessageBackgroundMaterial node:
[from ColorSequencerInstance.color_changed to diffuseColor
]
-->
<Material DEF='MessageBackgroundMaterial' transparency='0.8'/> |
54 | </Appearance> |
55 | </Shape> |
56 | </Transform> |
57 | < ROUTE fromNode='ColorSequencerInstance' fromField='color_changed' toNode='MessageMaterial' toField='diffuseColor'/> |
58 | < ROUTE fromNode='ColorSequencerInstance' fromField='color_changed' toNode='MessageBackgroundMaterial' toField='diffuseColor'/> |
59 | </Transform> |
60 | <Transform translation='-2.4 -2 0'> |
61 | <Shape> |
62 | <Appearance> |
63 | <Material diffuseColor='1 0 0'/> |
64 | </Appearance> |
65 | <Text string='"previous"'> |
66 | <FontStyle justify='"MIDDLE" "MIDDLE"' style='BOLD'/> |
67 | </Text> |
68 | </Shape> |
69 |
<!-- ROUTE information for TouchPrevious node:
[from isActive to ColorSequencerInstance.previous
]
[from isActive to TogglerStop.set_boolean
]
-->
<TouchSensor DEF='TouchPrevious' description='Select this text to see previous color'/> |
70 | < ROUTE fromNode='TouchPrevious' fromField='isActive' toNode='ColorSequencerInstance' toField='previous'/> |
71 | <Shape> |
72 | <Box size='3.4 0.8 0.1'/> |
73 |
<!-- Appearance
AppearanceTransparent is a DEF node that has 2 USE nodes: USE_1, USE_2 -->
<Appearance DEF='AppearanceTransparent'> |
74 | <Material transparency='1'/> |
75 | </Appearance> |
76 | </Shape> |
77 | </Transform> |
78 | <Transform translation='0.8 -2 0'> |
79 | <Shape> |
80 | <Appearance> |
81 | <Material diffuseColor='1 1 0'/> |
82 | </Appearance> |
83 | <Text string='"cycle"'> |
84 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
85 | </Text> |
86 | </Shape> |
87 | <Shape> |
88 | <Box size='2 0.8 0.1'/> |
89 | <Appearance USE='AppearanceTransparent'/> |
90 | </Shape> |
91 |
<!-- ROUTE information for TouchCycle node:
[from isActive to Toggler.set_boolean
]
-->
<TouchSensor DEF='TouchCycle' description='Select this text to cycle through all colors'/> |
92 | </Transform> |
93 | <Transform translation='3.2 -2 0'> |
94 | <Shape> |
95 | <Appearance> |
96 | <Material diffuseColor='0 1 0'/> |
97 | </Appearance> |
98 | <Text string='"next"'> |
99 | <FontStyle justify='"MIDDLE" "MIDDLE"'/> |
100 | </Text> |
101 | </Shape> |
102 | <Shape> |
103 | <Box size='1.8 0.8 0.1'/> |
104 | <Appearance USE='AppearanceTransparent'/> |
105 | </Shape> |
106 |
<!-- ROUTE information for TouchNext node:
[from isActive to ColorSequencerInstance.next
]
[from isActive to TogglerStop.set_boolean
]
-->
<TouchSensor DEF='TouchNext' description='Select this text to see next color'/> |
107 | < ROUTE fromNode='TouchNext' fromField='isActive' toNode='ColorSequencerInstance' toField='next'/> |
108 | </Transform> |
109 | <!-- cycle toggler logic --> |
110 |
<!-- ROUTE information for Ticker node:
[from Clock.fraction_changed to set_fraction
]
[from value_changed to ColorSequencerInstance.index
]
-->
<IntegerSequencer DEF='Ticker' key='0 0.125 0.25 0.375 0.5 0.625 0.75' keyValue='0 1 2 3 4 5 6'/> |
111 |
<!-- ROUTE information for Clock node:
[from Toggler.toggle_changed to enabled
]
[from fraction_changed to Ticker.set_fraction
]
-->
<TimeSensor DEF='Clock' cycleInterval='8' enabled='false' loop='true'/> |
112 |
<!-- ROUTE information for Toggler node:
[from TouchCycle.isActive to set_boolean
]
[from TogglerStop.inputFalse to toggle
]
[from toggle_changed to Clock.enabled
]
-->
<BooleanToggle DEF='Toggler' containerField='children'/> |
113 | < ROUTE fromNode='Ticker' fromField='value_changed' toNode='ColorSequencerInstance' toField='index'/> |
114 | < ROUTE fromNode='Clock' fromField='fraction_changed' toNode='Ticker' toField='set_fraction'/> |
115 | < ROUTE fromNode='Toggler' fromField='toggle_changed' toNode='Clock' toField='enabled'/> |
116 | < ROUTE fromNode='TouchCycle' fromField='isActive' toNode='Toggler' toField='set_boolean'/> |
117 | <!-- Ensure that next, previous selection events also turn off the color cycle --> |
118 |
<!-- ROUTE information for TogglerStop node:
[from TouchPrevious.isActive to set_boolean
]
[from TouchNext.isActive to set_boolean
]
[from inputFalse to Toggler.toggle
]
-->
<BooleanFilter DEF='TogglerStop'/> |
119 | < ROUTE fromNode='TogglerStop' fromField='inputFalse' toNode='Toggler' toField='toggle'/> |
120 | < ROUTE fromNode='TouchPrevious' fromField='isActive' toNode='TogglerStop' toField='set_boolean'/> |
121 | < ROUTE fromNode='TouchNext' fromField='isActive' toNode='TogglerStop' toField='set_boolean'/> |
122 | </Scene> |
123 | </X3D> |
Event Graph ROUTE Table entries with 11 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
TouchCycle
TouchSensor isActive SFBool |
Toggler
BooleanToggle set_boolean SFBool |
then
|
Toggler
BooleanToggle toggle_changed SFBool |
Clock
TimeSensor enabled SFBool |
then
|
Clock
TimeSensor fraction_changed SFFloat |
Ticker
IntegerSequencer set_fraction SFFloat |
then
|
Ticker
IntegerSequencer value_changed SFInt32 |
ColorSequencerInstance
ProtoInstance index SFInt32 |
then
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageMaterial
Material diffuseColor SFColor |
|||||
then
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageBackgroundMaterial
Material diffuseColor SFColor |
TouchNext
TouchSensor isActive SFBool |
ColorSequencerInstance
ProtoInstance next SFBool |
then
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageMaterial
Material diffuseColor SFColor |
||||||||||||||||||
then
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageBackgroundMaterial
Material diffuseColor SFColor |
||||||||||||||||||||
TouchNext
TouchSensor isActive SFBool |
TogglerStop
BooleanFilter set_boolean SFBool |
then
|
TogglerStop
BooleanFilter inputFalse SFBool |
Toggler
BooleanToggle toggle SFBool |
then
|
Toggler
BooleanToggle toggle_changed SFBool |
Clock
TimeSensor enabled SFBool |
then
|
Clock
TimeSensor fraction_changed SFFloat |
Ticker
IntegerSequencer set_fraction SFFloat |
then
|
Ticker
IntegerSequencer value_changed SFInt32 |
ColorSequencerInstance
ProtoInstance index SFInt32 |
then
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageMaterial
Material diffuseColor SFColor |
||||||
then
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageBackgroundMaterial
Material diffuseColor SFColor |
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageMaterial
Material diffuseColor SFColor |
|
ColorSequencerInstance
ProtoInstance color_changed SFColor |
MessageBackgroundMaterial
Material diffuseColor SFColor |
<!--
Color-coding legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoInstance name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->