#X3D V3.0 utf8 # Locking switch prototype that uses just event # utility nodes. # # Three EventUtility nodes are used (BooleanToggle, BooleanFilter, # and IntegerTrigger (twice)) to implement the locking switch. # The BooleanToggle node only reacts on an incoming TRUE event. # Then it negates it's internal value and sends it to BooleanFilter. # BooleanFilter separates TRUE and FALSE events so the correct # 'whichChoice' can be sent as an output event. # # Copyright 2005, Leonard Daly PROFILE Interchange PROTO LockingSwitch [ inputOnly SFBool press # from TouchSensor.isActive outputOnly SFBool on # TRUE when state=1 outputOnly SFBool off # TRUE when state=0 outputOnly SFBool isOn # TRUE when on, FALSE when off outputOnly SFInt32 state # 0|1 indicates state ] { DEF Toogle BooleanToggle { set_boolean IS press } DEF SeparateTF BooleanFilter { inputNegate IS isOn inputFalse IS off inputTrue IS on } DEF TurnOnSphere IntegerTrigger { integerKey 1 triggerValue IS state } DEF TurnOnBox IntegerTrigger { integerKey 0 triggerValue IS state } ROUTE Toogle.toggle TO SeparateTF.set_boolean ROUTE SeparateTF.inputTrue TO TurnOnSphere.set_boolean ROUTE SeparateTF.inputFalse TO TurnOnBox.set_boolean }