Layer3D.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. function Layer3D(layer)
  2. {
  3. this.layer = layer;
  4. this.paint = {
  5. value:null,
  6. beginPaint:false,
  7. currentId:null
  8. };
  9. //模型集合
  10. this.collectMeshes = {
  11. //能够引起碰撞的mesh
  12. collidableMeshes:[],
  13. //软饰
  14. softDecorationMeshes:[],
  15. //门、窗、墙、地板等等
  16. roomWallMeshes:[],
  17. glassBoxMeshes:[],
  18. //编辑模型的时候,出现的箭头
  19. arrowMeshes:[]
  20. };
  21. this.scene3D = new Scene3D();
  22. this.materials;
  23. this.decorate3D;
  24. this.modelLoader;
  25. this.action3D;
  26. };
  27. Layer3D.prototype.clearSymbol=function()
  28. {
  29. for(var i=0;i<this.collectMeshes.collidableMeshes.length;++i)
  30. {
  31. if(this.collectMeshes.collidableMeshes[i].name=="plane")
  32. {
  33. this.collectMeshes.collidableMeshes[i].dispose();
  34. this.collectMeshes.collidableMeshes.splice(i, 1);
  35. --i;
  36. }
  37. }
  38. for(var i=0;i<this.collectMeshes.roomWallMeshes.length;++i)
  39. {
  40. this.collectMeshes.roomWallMeshes[i].dispose();
  41. }
  42. };
  43. Layer3D.prototype.initialize = function ()
  44. {
  45. this.scene3D.createScene();
  46. this.materials = new Material(this);
  47. this.materials.initialize();
  48. this.decorate3D = new decorate3D(this);
  49. this.decorate3D.addSkybox();
  50. this.decorate3D.addGround();
  51. this.modelLoader = new ModelLoader(this);
  52. this.action3D = new Action3D(this);
  53. this.action3D.active();
  54. };