3D机房系统是最近用户的需求,通过相关了解最后使用Three.js,也发现最近有东西可以写出来分享:

分步实现3D效果
一 . 初始化3D模型参数
//参数处理
this.option = new Object();
this.option.antialias = option.antialias || true;
this.option.clearCoolr = option.clearCoolr || 0x1b7ace;
this.option.showHelpGrid = option.showHelpGrid || false;
//对象
this.id = id;
this.width = width();
this.height = height();
this.renderer = null;//渲染器
this.scene = null;//场景
this.camera = null;//摄像机
this.selected=null;
this.objects = [];
this.mouseClick = new THREE.Vector2();
this.raycaster = new THREE.Raycaster();
this.controls = null;//鼠标控制器
this.trsnaformControls = null;//鼠标控制器
this.dragcontrols = null;
this.objList = json.objects;//对象列表
this.eventList = json.events;//事件对象列表
this.dragList = [];
this.objectStatusList = {};
this.clickList = [];
var that = this;