Scene.js 533 B

12345678910111213141516171819202122
  1. "atomic component";
  2. //Define a Scene component
  3. exports.component = function(self) {
  4. //we are attaching that component to the Scene, so we are sure that ours node is a scene
  5. var scene = self.node;
  6. var time = 12;
  7. self.start = function() {
  8. // create the procedural sky
  9. var pnode = scene.createChild();
  10. self.procSky = pnode.createComponent("ProcSky");
  11. self.procSky.setDayTime(time);
  12. };
  13. self.update = function(timeStep) {
  14. time += timeStep * .08;
  15. self.procSky.setDayTime(time);
  16. };
  17. };