#VRML v2.0 utf8 ## ##:@+ product with logo ##@ (extern) proto EXTERNPROTO aelogo [ exposedField SFVec3f translation exposedField SFVec3f scale ][ "@vr-web3d-logo.wrl#logo" ] ##@ monitor proto PROTO monitor [ exposedField SFVec3f translation 0 0 0 exposedField SFVec3f scale 1 1 1 eventIn MFString string ]{ Transform { translation IS translation scale IS scale children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry DEF group Group { children [ DEF text Text { string [ "click me!" ] } ] } } ] } ##@ script Script { directOutput TRUE eventIn MFString string IS string field SFNode group USE group field MFNode node [] field MFNode old USE text url "vrmlscript: function string(value,time) { group.removeChildren = old; node = Browser.createVrmlFromString('Text { string ' + value.toString() + '}'); group.addChildren = node; old = node; }" }## end script } ## end monitor ##@ proto product PROTO product [ exposedField SFVec3f translation 0 0 0 ] { DEF product Transform { translation IS translation children [ DEF touch TouchSensor { } Transform { translation -3 0 0 children [ Inline { url "@vr-box.wrl" } ] } DEF monitor monitor { translation 3 3 0 } ] } ##@ script DEF script Script { directOutput TRUE eventIn SFTime touch field SFNode text USE monitor field SFInt32 toggle 0 field MFString string1 [ "message 1:" "this is a cube" ] field MFString string2 [ "message 2:" "it rotates" ] field MFString string3 [ "message 3:" "more information?" ] url "vrmlscript: function touch(value) { toggle += 1; if (toggle == 1) text.string = string1; else if (toggle == 2) text.set_string = string2; else if (toggle == 3) text.set_string = string3; if (toggle == 3) toggle=0; }" } ## end script ##@ event routing ROUTE touch.touchTime TO script.touch } ## end proto ##@ instance product { } ##@ logo aelogo { translation 6 -3 0 scale 0.5 0.5 0.5 } ##@ background and viewpoint Viewpoint { position 0 0 10 } Background { skyColor 1 0.2 0.2 } ## NavigationInfo { type"NONE" } ##