#VRML V2.0 utf8 WorldInfo { title "MMA Assignment 3" info ["Aäron Jansen" "Studentnumber: 1262602" "Studying: AI" "ajansen@few.vu.nl"] } PROTO logo [ exposedField MFString url [ "index.html" ] exposedField SFVec3f translation 0 0 0 exposedField SFVec3f scale 1 1 1 ] { Transform { scale IS scale translation IS translation children [ Anchor { url IS url children [ Shape { appearance Appearance { texture ImageTexture { url "earth1-texture.jpg" } } geometry Sphere { radius 0.75 } } Shape { appearance Appearance { material Material { diffuseColor 0.5 0.5 0.5 emissiveColor 0.5 0.5 0.5 transparency 0.9 } } geometry Box { size 2 2 2 } } ] description "Back to Home" } Transform { translation 0 -1.2 2.01 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string "World in a Box" fontStyle FontStyle { size 0.5 family "SANS" style "BOLD" justify "MIDDLE" } } } ] } ] } } NavigationInfo { headlight FALSE } DirectionalLight { ambientIntensity 0.25 color 1 1 1 direction 0 0 -1 intensity 1 on TRUE } Group { children [ DEF TIMER TimeSensor { cycleInterval 20 loop TRUE } DEF TIMER_SPLITPARTS TimeSensor { cycleInterval 2 loop FALSE } # The Earth part Group { children [ DEF EARTHTOUCHSENSOR TouchSensor {} DEF EARTHROTATION Transform { children [ Shape { appearance Appearance { texture ImageTexture { url "earth1-texture.jpg" } } geometry Sphere { radius 0.75 } } ] } 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; } } " } # The glass box part Group { children [ DEF GLASSPOSITION_INTERPOLATOR PositionInterpolator { key [ 0, 0.6, 1 ] keyValue [ 0 0 0, 0 1.5 0, 0 3 0 ] } DEF GLASSTOUCHSENSOR TouchSensor {} DEF GLASSBOX_TRANSFORM Transform { translation 0 0 0 children [ Shape { appearance Appearance { material Material { diffuseColor 0.5 0.5 0.5 emissiveColor 0.5 0.5 0.5 transparency 0.9 } } geometry Box { size 2 2 2 } } ] } ] } DEF GLASSPOPUP_SCRIPT Script { eventIn SFBool isOver eventOut SFInt32 output url "javascript: function isOver(value, time){ if (value == true) { output = 1; } else { output = 0; } } " } # The foot of the world in a box Group { children [ DEF FOOTTOUCHSENSOR TouchSensor {} DEF FOOTPOSITION_INTERPOLATOR PositionInterpolator { key [ 0, 0.6, 1 ] keyValue [ 0 -1 0, 0 -1.75 0, 0 -2.50 0 ] } DEF FOOT_TRANSFORM Transform { translation 0 -1 0 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 emissiveColor 0.1 0.1 0.1 transparency 0.0 } } geometry Box { size 2 0.5 2 } } ] } ] } DEF FOOTPOPUP_SCRIPT Script { eventIn SFBool isOver eventOut SFInt32 output url "javascript: function isOver(value, time){ if (value == true) { output = 3; } else { output = 0; } } " } # Also use a billboard for the info screen, so it always faces the user. Billboard { axisOfRotation 0 0 0 # Rotation around all axes is possible. children [ # Infoscreen Transform { translation 4 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 4 6 0.1 } } ] } # Texts for the infoscreen DEF SWITCHTEXT Switch { whichChoice 0 choice [ # Default text Transform { translation 4 2.5 0.1 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string [ "InfoScreen" "" "'Your own virtual" "world in a" "glass box'" "" "Move the mouse" "over seperate" "parts for info" ] fontStyle FontStyle { size 0.5 family "SANS" style "BOLD" justify "MIDDLE" } length [3] } } ] } # Text for the glass box Transform { translation 4 2.5 0.1 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string [ "InfoScreen" "" "The glass box" "protects the" "earth part" ] fontStyle FontStyle { size 0.5 family "SANS" style "BOLD" justify "MIDDLE" } length [3] } } ] } # Text for the earth part Transform { translation 4 2.5 0.1 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string [ "InfoScreen" "" "Earth part" "" "Your own virtual" "earth, just 4 you." ] fontStyle FontStyle { size 0.5 family "SANS" style "BOLD" justify "MIDDLE" } length [3] } } ] } # Text for the foot part Transform { translation 4 2.5 0.1 children [ Shape { appearance Appearance { material Material { diffuseColor 1 1 1 } } geometry Text { string [ "InfoScreen" "" "The foot carries" "the earth in a" "special way," "such that it" "floats in the air." ] fontStyle FontStyle { size 0.5 family "SANS" style "BOLD" justify "MIDDLE" } length [3] } } ] } ] } ] } ]} # Also, we want 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 [ # HUD geometry will go here Transform { translation 0 -0.073 -0.2 children [ Billboard { axisOfRotation 0 1 1 # Rotation around all axes is possible. children [ logo { url "../index.html" scale 0.007 0.007 0.007 translation -0.124 0.005 0 } ] } 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 } } ] } ] } ] } # All viewpoints grouped together Group { children [ DEF HUDVIEW Viewpoint { description "HUD View" position 0 0 10 } 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" } ] } Background { skyColor 0.2 0.2 0.2 } # All script routings... # Routing for earth information pop-up ROUTE EARTHTOUCHSENSOR.isOver TO EARTHPOPUP_SCRIPT.isOver ROUTE EARTHPOPUP_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 # Routing for foot information pop-up ROUTE FOOTTOUCHSENSOR.isOver TO FOOTPOPUP_SCRIPT.isOver ROUTE FOOTPOPUP_SCRIPT.output TO SWITCHTEXT.whichChoice # Routing for earth rotation ROUTE TIMER.fraction_changed TO EARTH_INTERPOLATOR.set_fraction ROUTE EARTH_INTERPOLATOR.value_changed TO EARTHROTATION.set_rotation # Routing for starting and stopping of the earth 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 for the splitting of parts... ROUTE GLASSTOUCHSENSOR.touchTime TO TIMER_SPLITPARTS.set_startTime ROUTE TIMER_SPLITPARTS.fraction_changed TO GLASSPOSITION_INTERPOLATOR.set_fraction ROUTE GLASSPOSITION_INTERPOLATOR.value_changed TO GLASSBOX_TRANSFORM.set_translation ROUTE FOOTTOUCHSENSOR.touchTime TO TIMER_SPLITPARTS.set_startTime ROUTE TIMER_SPLITPARTS.fraction_changed TO FOOTPOSITION_INTERPOLATOR.set_fraction ROUTE FOOTPOSITION_INTERPOLATOR.value_changed TO FOOT_TRANSFORM.set_translation