Scene.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. var game = Atomic.game;
  2. var node = self.node;
  3. function start() {
  4. var scene = game.scene;
  5. var cache = game.cache;
  6. // zone
  7. var zoneNode = scene.createChild("Zone")
  8. var zone = zoneNode.createComponent("Zone");
  9. zone.boundingBox = [-1000, -1000, -1000, 1000, 1000 , 1000];
  10. zone.ambientColor = [0.15, 0.15, 0.15];
  11. zone.fogColor = [0.5, 0.5, 0.7, 1.0];
  12. zone.fogStart = 10;
  13. zone.fogEnd = 100;
  14. var lightNode = scene.createChild("Directional Light");
  15. lightNode.direction = [0.6, -1.0, 0.8];
  16. var light = lightNode.createComponent("Light")
  17. light.lightType = Atomic.LIGHT_DIRECTIONAL;
  18. light.castShadows = true;
  19. light.setShadowCascade(10.0, 50.0, 200.0, 0.0, 0.8);
  20. light.setShadowBias(0.00025, 0.5);
  21. light.specularIntensity = 8;
  22. // create the grid plane
  23. var planeNode = scene.createChild("Plane");
  24. planeNode.scale = [100.0, 1.0, 100.0];
  25. var planeObject = planeNode.createComponent("StaticModel");
  26. var model = cache.getResource("Model", "Models/Plane.mdl");
  27. var material = cache.getResource("Material", "Materials/BlueGrid.xml");
  28. planeObject.model = model;
  29. planeObject.material = material;
  30. // add the roboman
  31. var roboman = node.createChild("TheRoboMan");
  32. roboman.createJSComponent("RoboMan");
  33. }
  34. // we need an update or it doesn't run the start, fix in JSVM
  35. function update(timeStep) {
  36. }