#VRML V2.0 utf8 WorldInfo { title "MMA Assignment II" info ["Aäron Jansen" "Studentnumber: 1262602" "Studying: AI" "ajansen@few.vu.nl"] } DEF NAVIGATION_INFO NavigationInfo { headlight TRUE } Background { skyColor 0.0 0.0 0.0 } EXTERNPROTO logo [ exposedField MFString url exposedField SFVec3f translation exposedField SFVec3f scale ] ["protos.wrl#logo"] EXTERNPROTO clouds [] ["protos.wrl#clouds"] EXTERNPROTO earth [] ["protos.wrl#earth"] EXTERNPROTO glassbox [] ["protos.wrl#glassbox"] EXTERNPROTO foot [] ["protos.wrl#foot"] EXTERNPROTO floor [] ["protos.wrl#floor"] EXTERNPROTO wall [] ["protos.wrl#wall"] EXTERNPROTO infoscreen [] ["protos.wrl#infoscreen"] EXTERNPROTO infoscreen_text [ exposedField MFString string ] ["protos.wrl#infoscreen_text"] EXTERNPROTO colourcube [] ["protos.wrl#colourcube"] EXTERNPROTO pyramid [] ["protos.wrl#pyramid"] # Model the world objects in a group...(without the HUD objects) Group { children [ # Group all the timers together Group { children [ DEF EARTH_ROTATION_TIMER TimeSensor { cycleInterval 40 loop TRUE enabled FALSE } DEF COLOURCUBE_ROTATION_TIMER TimeSensor { cycleInterval 5 loop TRUE enabled FALSE } DEF CLOUDS_ROTATION_TIMER TimeSensor { cycleInterval 20 loop TRUE enabled FALSE } DEF EARTH_TIMER_SPLITPARTS_OPEN TimeSensor { cycleInterval 1 loop FALSE startTime -1 } DEF EARTH_TIMER_SPLITPARTS_CLOSE TimeSensor { cycleInterval 1 loop FALSE startTime -1 } DEF COLOURCUBE_TIMER_SPLITPARTS_OPEN TimeSensor { cycleInterval 1 loop FALSE startTime -1 } DEF COLOURCUBE_TIMER_SPLITPARTS_CLOSE TimeSensor { cycleInterval 1 loop FALSE startTime -1 } ] } # Group all sounds together Group { children [ Sound { minFront 10 minBack 10 maxFront 50 maxBack 50 source DEF OPENSOUND AudioClip { url "shawee.wav" } } Sound { minFront 10 minBack 10 maxFront 50 maxBack 50 source DEF CLICKSOUND AudioClip { url "click.wav" } } ] } # Build a room around the product line Transform { children [ Group { children [ PointLight { location 2 7 5 } Transform { translation -4 -19 -6 children [ floor {} ] } Transform { translation 0 0 0 children [ glassbox {} ] } Transform { scale 1 1 1 translation 0 -17 0 children [ pyramid {} ] } ] } ] } # The Earth part Group { children [ # clouds texture DEF CLOUDSROTATION Transform { children [ clouds {} ] } DEF CLOUDS_ORIENTATIONINTERPOLATOR OrientationInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [ 0 1 0 0, 0 1 0 1.57, 0 1 0 3.14, 0 1 0 4.71, 0 1 0 6.28 ] } DEF EARTHROTATION Transform { children [ DEF EARTHTOUCHSENSOR TouchSensor {} earth {} ] } DEF RED_MARKERS_ROTATION Transform { children [ DEF SAHARA_TOUCHSENSOR TouchSensor {} Transform { translation 0 13 37 rotation 1 0 0 1.3 children [ Shape { appearance Appearance { material Material { diffuseColor 1 0 0 } } geometry Cylinder { radius 1 height 4 } } ] } ] } DEF EARTH_INTERPOLATOR OrientationInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [ 0 1 0 0, 0 1 0 1.57, 0 1 0 3.14, 0 1 0 4.71, 0 1 0 6.28 ] } DEF EARTHPOPUP_SCRIPT Script { eventIn SFBool isOver eventOut SFInt32 output url "javascript: function isOver(value, time) { if (value == true) { output = 2; } else { output = 0; } } " } DEF SAHARA_MARKER_POPUP_SCRIPT Script { eventIn SFBool isOver eventOut SFInt32 output url "javascript: function isOver(value, time) { if (value == true) { output = 1; } else { output = 0; } } " } ] } ] } # Also, we want a HUD(Heads Up Display) for displaying manipulation controls # Source: http://web3d.vapourtech.com/workshop/hud/ # HUD objects DEF SENSOR ProximitySensor { size 10000 10000 10000 center 0 0 10 } DEF HUD Transform { translation 0 0 10 children [ DirectionalLight { direction 0 0 -1 intensity 1 } # HUD geometry will go here Transform { translation 0 -0.073 -0.2 children [ # Display the logo at the bottom left of the screen Billboard { axisOfRotation 0 1 1 # Rotation around y/z axes is possible. children [ logo { url "../index.html" scale 0.007 0.007 0.007 translation -0.124 0.005 0 } ] } # Infoscreen Transform { translation 0.1105 0.06 0.0 children [ infoscreen {} ] } # HUD display at the bottom part of the screen. Transform { translation 0.02 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor 0 0.6 1 emissiveColor 0.1 0.1 0.1 transparency 0.0 } } geometry Box { size 0.24 0.016 0.0025 } } ] } # Switch for the changing of the view Transform { translation 0.12 0 0 children [ DEF BUTTON_STARTTOUR_TOUCHSENSOR TouchSensor {} Shape { appearance Appearance { material Material { diffuseColor 1 0 1 } } geometry Sphere { radius 0.003 } } ] } Transform { translation 0 0.0015 0.01 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string "Start/stop the tour by pressing/releasing the mouse button on the purple sphere" fontStyle FontStyle { size 0.006 family "SANS" style "BOLD" justify "MIDDLE" } length 0.17 } } ] } # Texts for the infoscreen Transform { translation 0.106 0.1 0.01 children [ DEF SWITCHTEXT Switch { whichChoice 0 choice [ # 0: Default text infoscreen_text { string [ "InfoScreen" "" "World Weather" "" "Get the latest" "weather from " "locations all over " "the world" ] } # 1: Text for the glass box infoscreen_text { string [ "InfoScreen" "" "Sahara desert" "" "Sunny, no clouds" "Temp: 40 C. " ] } # 2: Text for the earth part infoscreen_text { string [ "InfoScreen" "" "The earth..." "" "Rotate earth:" "Keep mouse pressed." "" "Weather summary:" "Hover with pointer" "over red spots" "" "Local situation:" "Click red spots" ] } # 3: Text for the foot part infoscreen_text { string [ "InfoScreen" "" "The foot carries" "the object in a" "special way," "such that it" "floats in the air." ] } # 4: Text for the colourcube part infoscreen_text { string [ "InfoScreen" "" "The colourcube shows" "a large spectrum" "colours." "" "Keep mouse pressed" "for rotation of" "the cube" ] } ] } ] } ] } ] } # All viewpoints grouped together Group { children [ DEF HUDVIEW Viewpoint { description "HUD View" position 0 0 120 } DEF top Viewpoint { position 0 120 0 orientation -1 0 0 1.57 description "Top" } DEF side2 Viewpoint { position 0 -100 0 orientation 1 0 0 1.57 description "Side2" } DEF default Viewpoint { position 2 7 10 orientation -0.95 0.30 0.09 0.63 description "Default Entry" } DEF aerial Viewpoint { position 0 5 10 orientation 1 0 0 -0.39 description "Aerial View" } DEF aerial-side Viewpoint { position 5 5 5 orientation -0.59 0.77 0.24 0.99 description "Aerial View: Isometric" } ] } # A short flying tour around the products Group { children [ DEF SHORTTOUR_TIMER TimeSensor { loop TRUE enabled FALSE cycleInterval 60 } DEF SHORTTOUR_VIEWPOINT_ORIENTATIONINTERPOLATOR OrientationInterpolator { key [0, 0.25, 0.5, 0.75, 1] keyValue [ 0 1 0 0, 0 1 0 1.57, 0 1 0 3.14, 0 1 0 4.71, 0 1 0 6.28 ] } DEF SHORTTOUR_TRANSFORM Transform { translation 2 0 0 children [ DEF SHORTTOUR_VIEWPOINT Viewpoint { position 19 19 19 orientation -0.59 0.77 0.24 0.99 } ] } ] } # All script routings... # Note: Toggling method had been copied and adapted from source group 0607. # Routing for earth information pop-up ROUTE EARTHTOUCHSENSOR.isOver TO EARTHPOPUP_SCRIPT.isOver ROUTE EARTHPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice ROUTE SAHARA_TOUCHSENSOR.isOver TO SAHARA_MARKER_POPUP_SCRIPT.isOver ROUTE SAHARA_MARKER_POPUP_SCRIPT.output TO SWITCHTEXT.whichChoice # Routing for glass information pop-up #ROUTE GLASSTOUCHSENSOR.isOver TO GLASSPOPUP_SCRIPT.isOver #ROUTE GLASSPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice #ROUTE COLOURCUBE_GLASSTOUCHSENSOR.isOver TO COLOURCUBE_GLASSPOPUP_SCRIPT.isOver #ROUTE COLOURCUBE_GLASSPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice # Routing for foot information pop-up #ROUTE FOOTTOUCHSENSOR.isOver TO FOOTPOPUP_SCRIPT.isOver #ROUTE FOOTPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice # Routing for colourcube information pop-up #ROUTE COLOURCUBE_TOUCHSENSOR.isOver TO COLOURCUBEPOPUP_SCRIPT.isOver #ROUTE COLOURCUBEPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice # Routing for colourcube foot information pop-up #ROUTE COLOURCUBE_FOOTTOUCHSENSOR.isOver TO COLOURCUBE_FOOTPOPUP_SCRIPT.isOver #ROUTE COLOURCUBE_FOOTPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice # Routing for earth rotation ROUTE EARTH_ROTATION_TIMER.fraction_changed TO EARTH_INTERPOLATOR.set_fraction ROUTE EARTH_INTERPOLATOR.value_changed TO EARTHROTATION.set_rotation ROUTE EARTH_INTERPOLATOR.value_changed TO RED_MARKERS_ROTATION.set_rotation # Routing for cloud rotation ROUTE CLOUDS_ROTATION_TIMER.fraction_changed TO CLOUDS_ORIENTATIONINTERPOLATOR.set_fraction ROUTE CLOUDS_ORIENTATIONINTERPOLATOR.value_changed TO CLOUDSROTATION.set_rotation # Routing for starting and stopping of the earth rotation. ROUTE EARTHTOUCHSENSOR.isActive TO EARTH_ROTATION_TIMER.enabled ROUTE EARTHTOUCHSENSOR.isActive TO CLOUDS_ROTATION_TIMER.enabled # Routing for starting and stopping of the colorcube rotation. #ROUTE COLOURCUBE_TOUCHSENSOR.isActive TO COLOURCUBE_ROTATION_TIMER.enabled #ROUTE COLOURCUBE_ROTATION_TIMER.fraction_changed TO COLOURCUBE_INTERPOLATOR.set_fraction #ROUTE COLOURCUBE_INTERPOLATOR.value_changed TO COLOURCUBE_ROTATION.set_rotation # Routing for the HUD to work ROUTE SENSOR.orientation_changed TO HUD.set_rotation ROUTE SENSOR.position_changed TO HUD.set_translation ROUTE SENSOR.position_changed TO SENSOR.set_center # Routing of the sound accompanying the opening/closing of the box... #ROUTE GLASSTOUCHSENSOR.touchTime TO OPENSOUND.startTime #ROUTE FOOTTOUCHSENSOR.touchTime TO OPENSOUND.startTime #ROUTE COLOURCUBE_GLASSTOUCHSENSOR.touchTime TO OPENSOUND.startTime #ROUTE COLOURCUBE_FOOTTOUCHSENSOR.touchTime TO OPENSOUND.startTime # Routing for letting a clicksound play when the earth is clicked. # However, this event is not properly detected. Sometimes it is, sometimes not. # This seems to be a problem with Cortona 4.2. In group 0607, we can see # that certain event handling has been implemented differently, because they # use the Blaxxun VRML browser. ROUTE EARTHTOUCHSENSOR.touchTime TO CLICKSOUND.startTime # Routing for the opening and closing of the glass boxes # ... for the earth #ROUTE GLASSTOUCHSENSOR.touchTime TO EARTH_TOGGLE_GLASSBOX.toggle #ROUTE FOOTTOUCHSENSOR.touchTime TO EARTH_TOGGLE_GLASSBOX.toggle #ROUTE EARTH_TOGGLE_GLASSBOX.startOpen TO EARTH_TIMER_SPLITPARTS_OPEN.startTime #ROUTE EARTH_TIMER_SPLITPARTS_OPEN.fraction_changed TO GLASSPOSITION_INTERPOLATOR_OPEN.set_fraction #ROUTE GLASSPOSITION_INTERPOLATOR_OPEN.value_changed TO GLASSBOX_TRANSFORM.translation #ROUTE EARTH_TOGGLE_GLASSBOX.startClose TO EARTH_TIMER_SPLITPARTS_CLOSE.startTime #ROUTE EARTH_TIMER_SPLITPARTS_CLOSE.fraction_changed TO GLASSPOSITION_INTERPOLATOR_CLOSE.set_fraction #ROUTE GLASSPOSITION_INTERPOLATOR_CLOSE.value_changed TO GLASSBOX_TRANSFORM.translation # ... for the colourcube #ROUTE COLOURCUBE_GLASSTOUCHSENSOR.touchTime TO COLOURCUBE_TOGGLE_GLASSBOX.toggle #ROUTE COLOURCUBE_FOOTTOUCHSENSOR.touchTime TO COLOURCUBE_TOGGLE_GLASSBOX.toggle #ROUTE COLOURCUBE_TOGGLE_GLASSBOX.startOpen TO COLOURCUBE_TIMER_SPLITPARTS_OPEN.startTime #ROUTE COLOURCUBE_TIMER_SPLITPARTS_OPEN.fraction_changed TO COLOURCUBE_GLASSPOSITION_INTERPOLATOR_OPEN.set_fraction #ROUTE COLOURCUBE_GLASSPOSITION_INTERPOLATOR_OPEN.value_changed TO COLOURCUBE_GLASSBOX_TRANSFORM.translation #ROUTE COLOURCUBE_TOGGLE_GLASSBOX.startClose TO COLOURCUBE_TIMER_SPLITPARTS_CLOSE.startTime #ROUTE COLOURCUBE_TIMER_SPLITPARTS_CLOSE.fraction_changed TO COLOURCUBE_GLASSPOSITION_INTERPOLATOR_CLOSE.set_fraction #ROUTE COLOURCUBE_GLASSPOSITION_INTERPOLATOR_CLOSE.value_changed TO COLOURCUBE_GLASSBOX_TRANSFORM.translation # Routing for the short tour around the products... ROUTE SHORTTOUR_TIMER.fraction_changed TO SHORTTOUR_VIEWPOINT_ORIENTATIONINTERPOLATOR.set_fraction ROUTE SHORTTOUR_VIEWPOINT_ORIENTATIONINTERPOLATOR.value_changed TO SHORTTOUR_TRANSFORM.rotation # ...routing to start/stop the tour ROUTE BUTTON_STARTTOUR_TOUCHSENSOR.isActive TO SHORTTOUR_VIEWPOINT.set_bind ROUTE SAHARA_TOUCHSENSOR.isActive TO SHORTTOUR_VIEWPOINT.set_bind