| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 | class MaterialManager {  constructor(t, e) {    (this.textureAssetManager = t),      (this.scene = e),      (this.materials = []),      (this.matFullTransparent = new BABYLON.StandardMaterial(        "matFullTransparent",        e      )),      (this.matFullTransparent.alpha = 0),      this.materials.push(this.matFullTransparent),      (this.matHighLight = new BABYLON.HighlightLayer("highlight", e)),      (this.matHighLight.outerGlow = !0),      (this.matHighLight.innerGlow = !0),      (this.skyboxMaterial = new BABYLON.StandardMaterial(        "skyBox",        this.scene      ));    const a = this.textureAssetManager.addCubeTextureTask(        "skyboxTextureTask",        g_AssetPath + "environment/skybox/sunny/TropicalSunnyDay"      ),      r =        ((a.onSuccess = t => {          (this.skyboxMaterial.reflectionTexture = t.texture),            (this.skyboxMaterial.reflectionTexture.coordinatesMode =              BABYLON.Texture.SKYBOX_MODE),            (this.skyboxMaterial.disableLighting = !0),            (this.skyboxMaterial.backFaceCulling = !1);        }),        (this.floorMaterial = this.createMaterial("floor", {          roughness: 1,        })),        (this.floorMaterial.environmentIntensity = 0),        t.addTextureTask(          "floorTextureTask",          g_AssetPath + "environment/tile.jpg"        )),      l =        ((r.onSuccess = t => {          (this.floorMaterial.albedoTexture = t.texture),            (this.floorMaterial.albedoTexture.uScale = 50),            (this.floorMaterial.albedoTexture.vScale = 50);        }),        (this.groundMaterial = this.createMaterial("ground", {          albedoColor: new BABYLON.Color3(1, 1, 0.6),          roughness: 1,        })),        (this.matAlu_blue = this.createMaterial("matAlu_blue", {          albedoColor: new BABYLON.Color3(30 / 256, 30 / 256, 0.921875),          metallic: 0.9,        })),        this.materials.push(this.matAlu_blue),        (this.matAlu_yellow = this.createMaterial("matAlu_yellow", {          albedoColor: new BABYLON.Color3(0.921875, 0.921875, 30 / 256),          metallic: 0.2,        })),        this.materials.push(this.matAlu_yellow),        (this.matAlu_gray = this.createMaterial("matAlu_gray", {          albedoColor: new BABYLON.Color3(0.425, 0.5, 0.425),          metallic: 0.2,        })),        this.materials.push(this.matAlu_gray),        (this.matAlu_green = this.createMaterial("matAlu_green", {          albedoColor: new BABYLON.Color3(30 / 256, 230 / 256, 30 / 256),          metallic: 0.2,        })),        this.materials.push(this.matAlu_green),        (this.matAlu_green2 = this.createMaterial("matAlu_green2", {          albedoColor: new BABYLON.Color3(5 / 256, 255 / 256, 5 / 256),          metallic: 0.2,        })),        this.materials.push(this.matAlu_green2),        (this.matAlu_black = this.createMaterial("matAlu_black", {          albedoColor: new BABYLON.Color3(0.125, 0.125, 0.125),          metallic: 0.2,        })),        this.materials.push(this.matAlu_black),        (this.matAlu_white = this.createMaterial("matAlu_white", {          albedoColor: new BABYLON.Color3(0.975, 0.975, 0.975),          metallic: 0.2,        })),        this.materials.push(this.matAlu_white),        (this.matAlu_pink = this.createMaterial("matAlu_pink", {          albedoColor: new BABYLON.Color3(99 / 256, 0, 31 / 256),        })),        this.materials.push(this.matAlu_pink),        (this.matAlu_rail = this.createMaterial("matAlu_rail", {          metallic: 1,        })),        this.materials.push(this.matAlu_rail),        (this.matAlu_xtrack_mesh = this.createMaterial("matAlu_xtrack_mesh", {          albedoColor: new BABYLON.Color3(0.725, 0.725, 0.725),          metallic: 0.2,          roughness: 0.2,        })),        t.addTextureTask(          "xtrackMeshTextureTask",          g_AssetPath + "items/img/xtrack_mesh_alpha.jpg"        )),      i =        ((l.onSuccess = t => {          (this.matAlu_xtrack_mesh.opacityTexture = t.texture),            (this.matAlu_xtrack_mesh.opacityTexture.getAlphaFromRGB = !0);        }),        (this.matAlu_xtrack_mesh.backFaceCulling = !1),        this.materials.push(this.matAlu_xtrack_mesh),        (this.matContour = this.createMaterial("matContour", {          albedoColor: new BABYLON.Color3(0.4, 0, 0.2),          metallic: 0.5,          roughness: 0.5,        })),        (this.matContour.backFaceCulling = !1),        this.materials.push(this.matContour),        (this.matFence = this.createMaterial("matFence", {          albedoColor: new BABYLON.Color3(0, 0, 0),          metallic: 0.5,          roughness: 0.5,        })),        t.addTextureTask(          "matFenceTextureTask",          g_AssetPath + "items/img/texture-safety-fence.png"        )),      s =        ((i.onSuccess = t => {          (this.matFence.opacityTexture = t.texture),            (this.matContour.opacityTexture = t.texture);        }),        (this.matFence.backFaceCulling = !1),        this.materials.push(this.matFence),        (this.matWarehouse = this.createMaterial("matWarehouse", {          albedoColor: new BABYLON.Color3(0.4, 0.4, 0.4),          roughness: 1,        })),        (this.matPortArrow = this.createMaterial("matPortArrow", {          albedoColor: new BABYLON.Color3(0.2, 0.9, 0.2),          roughness: 1,        })),        this.materials.push(this.matPortArrow),        (this.matLiftCarrier_yellow_plastic = this.createMaterial(          "matLiftCarrier_yellow_plastic",          {            albedoColor: new BABYLON.Color3(230 / 256, 0.921875, 210 / 256),            metallic: 0.2,          }        )),        this.materials.push(this.matLiftCarrier_yellow_plastic),        (this.matLiftCarrier_belt = this.createMaterial("matLiftCarrier_belt", {          albedoColor: new BABYLON.Color3(36 / 256, 36 / 256, 36 / 256),          metallic: 0.2,        })),        this.materials.push(this.matLiftCarrier_belt),        (this.matConveyor_belt = this.createMaterial("matConveyor_belt", {          albedoColor: new BABYLON.Color3(1, 36 / 256, 36 / 256),          metallic: 0.4,        })),        this.materials.push(this.matConveyor_belt),        (this.matLiftCarrier_blue_plastic = this.createMaterial(          "matLiftCarrier_blue_plastic",          {            albedoColor: new BABYLON.Color3(0, 158 / 256, 213 / 256),            metallic: 0.2,          }        )),        this.materials.push(this.matLiftCarrier_blue_plastic),        (this.matCarrier_aluminium = this.createMaterial(          "matCarrier_aluminium",          {            albedoColor: new BABYLON.Color3(137 / 256, 137 / 256, 137 / 256),            metallic: 0.7,            roughness: 0.2,          }        )),        this.materials.push(this.matCarrier_aluminium),        (this.matCarrier_yellow = this.createMaterial("matCarrier_yellow", {          albedoColor: new BABYLON.Color3(274 / 256, 173 / 256, 8 / 256),        })),        this.materials.push(this.matCarrier_yellow),        (this.matCarrier_black = this.createMaterial("matCarrier_black", {          albedoColor: new BABYLON.Color3(0.0625, 0.0625, 0.0625),        })),        this.materials.push(this.matCarrier_black),        (this.matCarrier_blue = this.createMaterial("matCarrier_blue", {          albedoColor: new BABYLON.Color3(0, 158 / 256, 213 / 256),        })),        this.materials.push(this.matCarrier_blue),        (this.matPallet = this.createMaterial("matPallet", {          roughness: 1,        })),        t.addTextureTask(          "palletTextureTask",          g_AssetPath + "items/img/pallet.jpg"        )),      o =        ((s.onSuccess = t => {          this.matPallet.albedoTexture = t.texture;        }),        this.materials.push(this.matPallet),        (this.matIcubeFloor = this.createMaterial("matIcubeFloor", {          albedoColor: BABYLON.Color3.FromHexString("#92d145"),          alpha: 0.5,        })),        (this.matIcubeFloorSelect = this.createMaterial("matIcubeFloorSelect", {          albedoColor: BABYLON.Color3.FromHexString("#379022"),          alpha: 0.5,        })),        (this.matSelector = this.createMaterial("matSelector", {          albedoColor: new BABYLON.Color3(0.9, 0, 0),          roughness: 1,        })),        (this.matActiveSelector = this.createMaterial("matActiveSelector", {          albedoColor: new BABYLON.Color3(0, 0.9, 0),          roughness: 1,        })),        (this.matWarehouseFloor = this.createMaterial("matWarehouseFloor", {          albedoColor: new BABYLON.Color3(0.5, 0.5, 0.5),          roughness: 1,        })),        (this.matWarehouseFloor.zOffset = -1),        this.matWarehouseFloor.unfreeze(),        (this.matWatermarkG = this.createMaterial("matWatermarkG", {          roughness: 1,          alpha: 0.9,        })),        t.addTextureTask("watermarkTask", g_AssetPath + "watermarker.png")),      h =        ((o.onSuccess = t => {          (t.texture.level = 2),            (this.matWatermarkG.albedoTexture = t.texture),            (this.matWatermarkG.opacityTexture = t.texture);        }),        (this.mat_nathan = this.createMaterial("mat_nathan", {          roughness: 1,          metallic: 0,        })),        t.addTextureTask(          "matNathanDTextureTask",          g_AssetPath + "items/img/ch01_diffuse.png"        )),      m =        ((h.onSuccess = t => {          this.mat_nathan.albedoTexture = t.texture;        }),        t.addTextureTask(          "matNathanBTextureTask",          g_AssetPath + "items/img/ch01_normal.png"        ));    (m.onSuccess = t => {      this.mat_nathan.normalTexture = t.texture;    }),      this.materials.push(this.mat_nathan),      (this.allRowsMat = this.createMaterial("allRowsMat", {        roughness: 1,        alpha: 0.8,      })),      (this.allRowsMat.albedoTexture = new BABYLON.DynamicTexture(        "DynamicTexture",        50,        this.scene,        !0      )),      this.allRowsMat.albedoTexture.drawText(        "All",        5,        40,        "bold 36px Arial",        "#ffffff",        "#bc0000",        !0      ),      (this.matPiller = this.createMaterial("matPiller", {        roughness: 1,      })),      (this.matPiller.albedoTexture = new BABYLON.DynamicTexture(        "matPillerTexture",        50,        this.scene,        !0      )),      this.matPiller.albedoTexture.drawText(        "X",        10,        40,        "bold 44px Arial",        "#bc0000",        "#ffffff",        !0      ),      (this.matPiller.albedoTexture.hasAlpha = !0);  }  createMaterial(t, e) {    const a = new BABYLON.PBRMaterial(t, this.scene);    return (      (a.albedoColor = e.albedoColor || BABYLON.Color3.White()),      (a.metallic = e.metallic || 0),      (a.roughness = e.roughness || 0),      (a.alpha = e.alpha || 1),      a.freeze(),      a    );  }}
 |