1. /**
  2. * ...
  3. * @author Matthew Casperson
  4. */
  5.  
  6. package ;
  7.  
  8. import sandy.core.scenegraph.Shape3D;
  9. import sandy.materials.Appearance;
  10. import sandy.materials.Material;
  11. import sandy.materials.BitmapMaterial;
  12. import sandy.primitive.SkyBox;
  13.  
  14. class SkyBoxObject extends NodeObject
  15. {
  16. public function new(engineManager:EngineManager)
  17. {
  18. var model:SkyBox = new SkyBox(null, 200, 10, 10);
  19.  
  20. model.top.appearance = new Appearance(new BitmapMaterial(engineManager.resourceManager.skyboxUpBitmapData));
  21. model.bottom.appearance = new Appearance(new BitmapMaterial(engineManager.resourceManager.skyboxDownBitmapData));
  22. model.back.appearance = new Appearance(new BitmapMaterial(engineManager.resourceManager.skyboxBackBitmapData));
  23. model.front.appearance = new Appearance(new BitmapMaterial(engineManager.resourceManager.skyboxFrontBitmapData));
  24. model.left.appearance = new Appearance(new BitmapMaterial(engineManager.resourceManager.skyboxLeftBitmapData));
  25. model.right.appearance = new Appearance(new BitmapMaterial(engineManager.resourceManager.skyboxRightBitmapData));
  26.  
  27. model.top.scaleX = 1.01;
  28. model.top.scaleZ = 1.01;
  29. model.bottom.scaleX = 1.01;
  30. model.bottom.scaleZ = 1.01;
  31. model.back.scaleX = 1.01;
  32. model.back.scaleY = 1.01;
  33. model.front.scaleX = 1.01;
  34. model.front.scaleY = 1.01;
  35. model.left.scaleY = 1.01;
  36. model.left.scaleZ = 1.01;
  37. model.right.scaleY = 1.01;
  38. model.right.scaleZ = 1.01;
  39.  
  40. model.top.enableClipping = true;
  41. model.bottom.enableClipping = true;
  42. model.back.enableClipping = true;
  43. model.front.enableClipping = true;
  44. model.left.enableClipping = true;
  45. model.right.enableClipping = true;
  46.  
  47. super(engineManager, model);
  48. }
  49.  
  50. override public function enterFrame(dt:Float) : Void
  51. {
  52. this.node.x = this.engineManager.camera.x;
  53. this.node.y = this.engineManager.camera.y;
  54. this.node.z = this.engineManager.camera.z;
  55.  
  56. engineManager.camera.rotateY += 10 * dt;
  57. engineManager.camera.rotateX += 15 * dt;
  58. }
  59.  
  60. }