#VRML V2.0 utf8 # # World with PROTO interfaces and Behaviors # # fbm0.wrl - world with one function (change transparency) # EXTERNPROTO FBM [ eventIn SFFloat set_clock field SFVec3f position field MFNode functions field MFNode traces ] "fbm0proto.wrl#FBM" EXTERNPROTO FBM_FUNCTION [ eventIn SFFloat set_clock eventIn SFTime clock_tick field MFString name field SFVec3f text_position field SFVec3f function_position eventIn SFBool activate eventIn SFFloat float_data1_in field SFBool process field SFFloat transparency_value field SFFloat min_value eventOut SFFloat new_transparency eventOut SFFloat float_data1_out eventOut SFBool done ] "fbm0proto.wrl#FBM_FUNCTION" EXTERNPROTO FBM_TRACE [ exposedField MFNode geometry ] "fbm0proto.wrl#FBM_TRACE" EXTERNPROTO FBMPATH [ field SFVec3f position field SFVec3f translation ] "fbm0proto.wrl#FBMPATH" EXTERNPROTO SWITCH [ eventIn SFTime touched field SFVec3f position field SFBool state field MFNode behavior eventOut SFBool enabled eventOut SFBool isActive eventOut SFBool state_changed eventOut SFFloat float_data_out ] "switch.wrl#SWITCH" EXTERNPROTO LABEL [ field SFVec3f trn field MFString stg field SFColor txtColor eventIn SFString setStg ] "label.wrl#LABEL" # # World # DEF B1 Background { skyColor [ 0.3 0.5 1, 0.3 0.5 1] } NavigationInfo { headlight TRUE type [ "EXAMINE", "ANY" ]} DEF Clock TimeSensor { loop TRUE cycleInterval 0.1 enabled TRUE stopTime -1 } #DEF Touch TouchSensor {enabled TRUE} DEF Assembly-Line FBM { position 0 2 -12 functions [ DEF Machine1 FBM_FUNCTION { name "Transparency Function" text_position 0 1.3 0 function_position 0 0 0 transparency_value 0.9 } #DEF Machine2 ] #functions traces [ DEF Path1 FBM_TRACE { geometry FBMPATH { position -2 0 0 translation 0 0 0 } } #DEF Path1 DEF Path2 FBM_TRACE { geometry FBMPATH { position 1.6 0 0 translation 0.5 0 0 } } #DEF Path2 ] #traces }#DEF Assembly-Line DEF Txt1 LABEL {stg "" trn -7 1.8 -12 txtColor 1 1 1} DEF Txt2 LABEL {stg "" trn 7.2 1.8 -12 txtColor 1 1 1} DEF Switch SWITCH { position 0.0 -2.5 -12 } #DEF Switch DEF cont Script { eventIn SFBool aSignalFromButton eventOut SFString stgToTxt1 eventIn SFBool aSignalFromM1 eventOut SFString stgToTxt2 url [ "javascript: function aSignalFromButton(value) { stgToTxt1 = 'Input Value = 0.9'; } function aSignalFromM1(value) { stgToTxt2 = 'Output Value = 0.0 '; } " ] # end url } # end script # # Routes # #ROUTE Clock.fraction_changed TO Assembly-Line.set_clock ROUTE Clock.cycleTime TO Machine1.clock_tick ROUTE Switch.float_data_out TO Machine1.float_data1_in # Show the text "Input Value = 0.9" when button is clicked ROUTE Switch.state_changed TO cont.aSignalFromButton ROUTE cont.stgToTxt1 TO Txt1.setStg # Start the FBM when when button is clicked ROUTE Switch.state_changed TO Machine1.activate ROUTE Machine1.done TO cont.aSignalFromM1 ROUTE cont.stgToTxt2 TO Txt2.setStg