##:@* snow ## ##@ HUD Transform { translation 0 0 15 children [ Transform { translation 0 4 -35 scale 3 3 3 children [ # 1 shape as child node Shape { appearance Appearance { material Material { diffuseColor 1 1 1 emissiveColor 1 1 1 } } geometry PointSet { # declare some points (x,y,z) coord DEF PointBoxCoords Coordinate { point [ ] } } } ] } DEF AnimationTimer TimeSensor { startTime 0 # Start immediately cycleInterval 20 # One timing loop takes 20 seconds loop TRUE # Keep on generating timing events } # Script for initializing the box with points at startup # and animating them like stars DEF PointBoxScript Script { eventOut MFVec3f point_changed eventIn SFFloat set_fraction # The array of points field MFVec3f point 0.0 0.0 0.0 # Number of points to generate field SFInt32 PointCount 600 url "javascript: function initialize() { // Number of points point.length = PointCount; for (i=0; i < PointCount; i++) { point[i].x = (Math.random() - 0.5)*16; point[i].y = Math.random() * 8; point[i].z = Math.random() * 10; } // Send the points to the empty geometry point_changed = point; } function set_fraction(value) { for (i=0; i < PointCount; i++) { point[i].y = point[i].y - 0.1; if (point[i].y < 0) point[i].y = point[i].y + 8; } // Send the points to the empty geometry point_changed = point; } " } ROUTE PointBoxScript.point_changed TO PointBoxCoords.set_point ROUTE AnimationTimer.fraction_changed TO PointBoxScript.set_fraction ] } ##