123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- function Material(layer3D)
- {
- this.scene=layer3D.scene3D.scene;
- this.parameter=layer3D.layer.parameter;
- this.groundMaterial;
- this.skyboxMaterial;
- this.wallmaterial;
- this.floormaterial;
- this.frameMaterial;
- this.doorknobMaterial;
- this.doorMaterial;
- this.windowframeMaterial;
- this.selectMaterial;
- this.selectRotatorMaterial;
- this.measureTextPlaneMaterial;
- };
- Material.prototype.initialize= function ()
- {
- this.groundMaterial=this.setground();
- this.skyboxMaterial=this.setskybox();
- this.wallmaterial=this.setwall();
- this.floormaterial=this.setfloor();
- this.frameMaterial=this.setframe();
- this.doorMaterial=this.setdoor();
- this.doorknobMaterial=this.setdoorknob();
- this.windowframeMaterial=this.setwindowframe();
- this.selectMaterial=this.setselect();
- this.selectRotatorMaterial=this.setselectRotator();
- this.measureTextPlaneMaterial=this.setMeasureTextPlane();
- };
- Material.prototype.setselectRotator= function ()
- {
- var material = new BABYLON.StandardMaterial("buttons", this.scene);
- material.diffuseTexture = new BABYLON.Texture(this.parameter.selectRotator.img, this.scene);
- material.diffuseTexture.hasAlpha = !0;
- material.backFaceCulling = !1;
- return material;
- };
- Material.prototype.setselect= function ()
- {
- var material=new BABYLON.StandardMaterial("selectMat", this.scene);
- material.alpha = 1.0;
- material.diffuseColor = new BABYLON.Color3.Green();
- material.backFaceCulling = false;
- return material;
- };
- Material.prototype.getwallmaterial = function (id) {
- var wallmaterial = new BABYLON.StandardMaterial("wall"+id, this.scene);
- //wallmaterial.emissiveColor = new BABYLON.Color3(0.8,0.8,0.8);
- wallmaterial.diffuseColor = new BABYLON.Color3(0.5,0.5,0.5);
- wallmaterial.specularColor = new BABYLON.Color3(.6,.6,.6);
- wallmaterial.useSpecularOverAlpha=false;
- wallmaterial.backFaceCulling = false;
- return wallmaterial;
- };
- Material.prototype.setwall = function ()
- {
- var material = new BABYLON.StandardMaterial("wallmaterial", this.scene);
- material.backFaceCulling = false;
- material.diffuseColor = new BABYLON.Color3(0.5,0.5,0.5);
- material.specularColor = new BABYLON.Color3(.6,.6,.6);
- material.useSpecularOverAlpha=false;
- return material;
- };
- Material.prototype.getwall = function (id)
- {
- var wallmaterial = new BABYLON.StandardMaterial("wall"+id, this.scene);
- wallmaterial.diffuseColor = new BABYLON.Color3(0.5,0.5,0.5);
- wallmaterial.specularColor = new BABYLON.Color3(.6,.6,.6);
- wallmaterial.useSpecularOverAlpha=false;
- wallmaterial.backFaceCulling = false;
- return wallmaterial;
- };
- Material.prototype.setground= function ()
- {
- var material = new BABYLON.StandardMaterial("groundmaterial", this.scene);
- material.diffuseTexture = new BABYLON.Texture(this.parameter.groundImgUrl, this.scene);
- material.diffuseTexture.uScale = 5.0; //Repeat 5 times on the Vertical Axes
- material.diffuseTexture.vScale = 5.0; //Repeat 5 times on the Horizont
- return material;
- };
- Material.prototype.setskybox= function ()
- {
- var material = new BABYLON.StandardMaterial("skyBox", this.scene);
- material.backFaceCulling = false;
- material.reflectionTexture = new BABYLON.CubeTexture(this.parameter.skyImgUrl, this.scene);
- material.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
- material.diffuseColor = new BABYLON.Color3(0, 0, 0);
- material.specularColor = new BABYLON.Color3(0, 0, 0);
- material.disableLighting = true;
- return material;
- };
- //ÃÅ¿ò
- Material.prototype.setframe= function ()
- {
- var material = new BABYLON.StandardMaterial("frameMaterial", this.scene);
- material.alpha = 1.0;
- material.emissiveColor = new BABYLON.Color3(0.7,0.7,0.7);
- material.backFaceCulling = true;
- return material;
- };
- //´°»§¿ò
- Material.prototype.setwindowframe= function ()
- {
- var material = new BABYLON.StandardMaterial("windowframeMaterial", this.scene);
- material.alpha = 1.0;
- material.emissiveColor = new BABYLON.Color3(0.5,0.5,0.5);
- material.backFaceCulling = true;
- return material;
- };
- Material.prototype.setdoorknob= function ()
- {
- var material = new BABYLON.StandardMaterial("doorknobMaterial", this.scene);
- material.alpha = 1.0;
- material.emissiveColor = new BABYLON.Color3(0.1,0.1,0.1);
- material.backFaceCulling = true;
- return material;
- };
- Material.prototype.setdoor= function ()
- {
- var material = new BABYLON.StandardMaterial("doormaterial", this.scene);
- material.diffuseTexture = new BABYLON.Texture("images/door.png", this.scene);
- material.backFaceCulling = false;
- return material;
- };
- Material.prototype.setfloor = function ()
- {
- var material = new BABYLON.StandardMaterial("floormaterial", this.scene);
- material.diffuseTexture = new BABYLON.Texture(this.parameter.floorImgUrl, this.scene);
- material.bumpTexture = new BABYLON.Texture("images/floor1.png", this.scene);
- material.specularColor=new BABYLON.Color3(0.2,0.2,0.2);
- return material;
- };
- Material.prototype.setMeasureTextPlane = function ()
- {
- var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", 50, this.scene, true);
- dynamicTexture.hasAlpha = true;
-
- var material = new BABYLON.StandardMaterial("TextPlaneMaterial", this.scene);
- material.backFaceCulling = false;
- material.specularColor = new BABYLON.Color3(0, 0, 0);
- material.diffuseTexture = dynamicTexture;
-
- return material;
- };
|