#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 Transform { translation IS translation scale IS scale children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry ## Group { corrected by: Willem van Willigen (vr0711) ## children [ DEF text Text { string [ "click me!" ] } ## ] } see http://www.cs.vu.nl/~eliens/archive/avr/ch2-26.htm#2.6.3 } ] } ##: script Script { directOutput TRUE eventIn MFString string IS string field SFNode text USE text url "vrmlscript: function string(value,time) { text.string = value; } " }## end script } ## end monitor ##@ proto product PROTO product [ exposedField SFVec3f translation 0 0 0 ]{ ##: transform DEF product Transform { translation IS translation children [ DEF touch TouchSensor { } Transform { translation -3 0 0 children [ Inline { url "@vr-web3d-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?" ] field SFInt32 damage 1 field SFString temp "damage: " ##: url 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; else if (toggle == 4) { //temp += ' '; temp += damage.toString(); //temp += ' '; text.set_string = new MFString(temp); } if (toggle == 4) 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" } ##