xushiting 3 年之前
父節點
當前提交
37362ee86e

+ 0 - 550
dist/assets/component_list.json

@@ -1,550 +0,0 @@
-{
-    "components": {
-        "thumbnail": "",
-        "url": "meshes/body_man.glb",
-        "url_lod2": "meshes/body_man_lod2.glb",
-        "url_lod4": "meshes/body_man_lod4.glb"
-    },
-    "animations": [
-{
-            "thumbnail": "",
-            "id":"1",
-            "name":"Dance01",
-            "sex":"woman",
-            "url":"animations/Dance01.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"2",
-            "name":"Dance01c",
-            "sex":"woman",
-            "url":"animations/Dance01c.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"3",
-            "name":"Dance01b",
-            "sex":"woman",
-            "url":"animations/Dance01b.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"4",
-            "name":"Waving",
-            "sex":"woman",
-            "url":"animations/Waving.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"5",
-            "name":"WaveHipHopDance",
-            "sex":"woman",
-            "url":"animations/WaveHipHopDance.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"6",
-            "name":"TurnBack",
-            "sex":"woman",
-            "url":"animations/TurnBack.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"7",
-            "name":"Thankful",
-            "sex":"woman",
-            "url":"animations/Thankful.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"8",
-            "name":"Talking",
-            "sex":"woman",
-            "url":"animations/Talking.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"9",
-            "name":"Yaotou",
-            "sex":"woman",
-            "url":"animations/Yaotou.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"10",
-            "name":"Walking",
-            "sex":"woman",
-            "url":"animations/Walking.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"11",
-            "name":"Dance02",
-            "sex":"woman",
-            "url":"animations/Dance02.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"12",
-            "name":"GiftClap",
-            "sex":"woman",
-            "url":"animations/GiftClap.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"13",
-            "name":"Qiangtui",
-            "sex":"woman",
-            "url":"animations/Qiangtui.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"14",
-            "name":"Hallo",
-            "sex":"woman",
-            "url":"animations/Hallo.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"15",
-            "name":"StopWalking",
-            "sex":"woman",
-            "url":"animations/StopWalking.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"16",
-            "name":"StartWalking",
-            "sex":"woman",
-            "url":"animations/StartWalking.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"17",
-            "name":"Singing",
-            "sex":"woman",
-            "url":"animations/Singing.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"18",
-            "name":"Running",
-            "sex":"woman",
-            "url":"animations/Running.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"19",
-            "name":"RumbaDancing",
-            "sex":"woman",
-            "url":"animations/RumbaDancing.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"20",
-            "name":"PHOTO_9",
-            "sex":"woman",
-            "url":"animations/PHOTO_9.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"21",
-            "name":"PHOTO_8",
-            "sex":"woman",
-            "url":"animations/PHOTO_8.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"22",
-            "name":"PHOTO_7",
-            "sex":"woman",
-            "url":"animations/PHOTO_7.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"23",
-            "name":"PHOTO_5",
-            "sex":"woman",
-            "url":"animations/PHOTO_5.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"24",
-            "name":"PHOTO_3",
-            "sex":"woman",
-            "url":"animations/PHOTO_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"25",
-            "name":"PHOTO_2",
-            "sex":"woman",
-            "url":"animations/PHOTO_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"26",
-            "name":"PHOTO_1",
-            "sex":"woman",
-            "url":"animations/PHOTO_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"27",
-            "name":"PHOTO_12",
-            "sex":"woman",
-            "url":"animations/PHOTO_12.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"28",
-            "name":"PHOTO_11",
-            "sex":"woman",
-            "url":"animations/PHOTO_11.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"29",
-            "name":"PHOTO_10",
-            "sex":"woman",
-            "url":"animations/PHOTO_10.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"30",
-            "name":"JumpPart2",
-            "sex":"woman",
-            "url":"animations/JumpPart2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"31",
-            "name":"JumpPart1",
-            "sex":"woman",
-            "url":"animations/JumpPart1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"32",
-            "name":"Jump_all",
-            "sex":"woman",
-            "url":"animations/Jump_all.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"33",
-            "name":"Idle",
-            "sex":"woman",
-            "url":"animations/Idle.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"34",
-            "name":"HappyIdle",
-            "sex":"woman",
-            "url":"animations/HappyIdle.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"35",
-            "name":"Dance04",
-            "sex":"woman",
-            "url":"animations/Dance04.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"36",
-            "name":"Dance05",
-            "sex":"woman",
-            "url":"animations/Dance05.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"37",
-            "name":"Dance03",
-            "sex":"woman",
-            "url":"animations/Dance03.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"38",
-            "name":"Cheering",
-            "sex":"woman",
-            "url":"animations/Cheering.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"39",
-            "name":"BlowAKiss",
-            "sex":"woman",
-            "url":"animations/BlowAKiss.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"40",
-            "name":"LockingHipHopDance",
-            "sex":"woman",
-            "url":"animations/LockingHipHopDance.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"41",
-            "name":"YaotouLoop",
-            "sex":"woman",
-            "url":"animations/YaotouLoop.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"42",
-            "name":"QiangtuiLoop",
-            "sex":"woman",
-            "url":"animations/QiangtuiLoop.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"43",
-            "name":"HalloLoop",
-            "sex":"woman",
-            "url":"animations/HalloLoop.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"44",
-            "name":"JumpLoop",
-            "sex":"woman",
-            "url":"animations/JumpLoop.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"45",
-            "name":"LeftTurn",
-            "sex":"woman",
-            "url":"animations/LeftTurn.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"46",
-            "name":"Song01_1",
-            "sex":"woman",
-            "url":"animations/Song01_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"47",
-            "name":"Song01_2",
-            "sex":"woman",
-            "url":"animations/Song01_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"48",
-            "name":"Song01_3",
-            "sex":"woman",
-            "url":"animations/Song01_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"49",
-            "name":"Song02_1",
-            "sex":"woman",
-            "url":"animations/Song02_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"50",
-            "name":"Song02_2",
-            "sex":"woman",
-            "url":"animations/Song02_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"51",
-            "name":"Song02_3",
-            "sex":"woman",
-            "url":"animations/Song02_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"52",
-            "name":"Song03_1",
-            "sex":"woman",
-            "url":"animations/Song03_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"53",
-            "name":"Song03_2",
-            "sex":"woman",
-            "url":"animations/Song03_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"54",
-            "name":"Song03_3",
-            "sex":"woman",
-            "url":"animations/Song03_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"55",
-            "name":"Song04_1",
-            "sex":"woman",
-            "url":"animations/Song04_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"56",
-            "name":"Song04_2",
-            "sex":"woman",
-            "url":"animations/Song04_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"57",
-            "name":"Song04_3",
-            "sex":"woman",
-            "url":"animations/Song04_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"58",
-            "name":"Song05_1",
-            "sex":"woman",
-            "url":"animations/Song05_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"59",
-            "name":"Song05_2",
-            "sex":"woman",
-            "url":"animations/Song05_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"60",
-            "name":"Song05_3",
-            "sex":"woman",
-            "url":"animations/Song05_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"61",
-            "name":"Song06_1",
-            "sex":"woman",
-            "url":"animations/Song06_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"62",
-            "name":"Song06_2",
-            "sex":"woman",
-            "url":"animations/Song06_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"63",
-            "name":"Song06_3",
-            "sex":"woman",
-            "url":"animations/Song06_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"64",
-            "name":"Song07_1",
-            "sex":"woman",
-            "url":"animations/Song07_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"65",
-            "name":"Song07_2",
-            "sex":"woman",
-            "url":"animations/Song07_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"66",
-            "name":"Song07_3",
-            "sex":"woman",
-            "url":"animations/Song07_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"67",
-            "name":"Song08_1",
-            "sex":"woman",
-            "url":"animations/Song08_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"68",
-            "name":"Song08_2",
-            "sex":"woman",
-            "url":"animations/Song08_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"69",
-            "name":"Song08_3",
-            "sex":"woman",
-            "url":"animations/Song08_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"70",
-            "name":"Song09_1",
-            "sex":"woman",
-            "url":"animations/Song09_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"71",
-            "name":"Song09_2",
-            "sex":"woman",
-            "url":"animations/Song09_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"72",
-            "name":"Song09_3",
-            "sex":"woman",
-            "url":"animations/Song09_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"73",
-            "name":"Song10_1",
-            "sex":"woman",
-            "url":"animations/Song10_1.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"74",
-            "name":"Song10_2",
-            "sex":"woman",
-            "url":"animations/Song10_2.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"75",
-            "name":"Song10_3",
-            "sex":"woman",
-            "url":"animations/Song10_3.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"76",
-            "name":"animations_dance",
-            "sex":"woman",
-            "url":"animations/animations_dance.glb"
-        },
-        {
-            "thumbnail": "",
-            "id":"77",
-            "name":"animations_woman",
-            "sex":"woman",
-            "url":"animations/animations_woman.glb"
-        }
-],
-    "textures": []
-}

+ 11 - 11
dist/assets/config.json

@@ -380,20 +380,20 @@
 			}],
 			"skins": [{
 				"id": "10092",
-				"name": "默认分支",
+				"name": "榛樿�鍒嗘敮",
 				"versionId": "00001",
 				"isEnable": true,
 				"fov": "90",
 				"assetList": [{
 					"typeName": "MODEL",
-					"className": "粗模",
+					"className": "绮楁ā",
 					"assetId": "",
 					"name": "Ground_LV01_xverse.glb",
 					"url": "https://app-mgt-resource-1258211750.file.myqcloud.com/model/407033cdaf0d4159bfd9c783b72f90ab/Ground_LV01_xverse.glb",
 					"thumbnailUrl": ""
 				}, {
 					"typeName": "CONFIG",
-					"className": "环境光",
+					"className": "环境光",
 					"assetId": "",
 					"name": "environment_musicfesti.env",
 					"url": "https://app-mgt-resource-1258211750.file.myqcloud.com/config/bb2a84319db3457a8de58165d037ee19/environment_musicfesti.env",
@@ -2022,56 +2022,56 @@
 				"url": "https://app-mgt-resource-1258211750.file.myqcloud.com/model/407033cdaf0d4159bfd9c783b72f90ab/Ground_LV01_xverse.glb",
 				"packName": "",
 				"typeName": "MODEL",
-				"className": "粗模",
+				"className": "绮楁ā",
 				"skinId": "10092",
 				"size": 14316
 			}, {
 				"url": "https://app-mgt-resource-1258211750.file.myqcloud.com/config/bb2a84319db3457a8de58165d037ee19/environment_musicfesti.env",
 				"packName": "",
 				"typeName": "CONFIG",
-				"className": "环境光",
+				"className": "环境光",
 				"skinId": "10092",
 				"size": 2723658
 			}, {
 				"url": "https://app-asset-1258211750.file.myqcloud.com/1/textures/Point_Light.png",
 				"packName": "",
 				"typeName": "TEXTURES",
-				"className": "贴图",
+				"className": "璐村浘",
 				"skinId": "",
 				"size": 8463
 			}, {
 				"url": "https://app-asset-1258211750.file.myqcloud.com/1/textures/Light_tex0.png",
 				"packName": "",
 				"typeName": "TEXTURES",
-				"className": "贴图",
+				"className": "璐村浘",
 				"skinId": "",
 				"size": 7478
 			}, {
 				"url": "https://app-asset-1258211750.file.myqcloud.com/1/textures/Light_tex1.png",
 				"packName": "",
 				"typeName": "TEXTURES",
-				"className": "贴图",
+				"className": "璐村浘",
 				"skinId": "",
 				"size": 26724
 			}, {
 				"url": "https://app-asset-1258211750.file.myqcloud.com/1/textures/Light_tex2.png",
 				"packName": "",
 				"typeName": "TEXTURES",
-				"className": "贴图",
+				"className": "璐村浘",
 				"skinId": "",
 				"size": 28517
 			}, {
 				"url": "https://app-asset-1258211750.file.myqcloud.com/1/textures/VS_Disco.png",
 				"packName": "",
 				"typeName": "TEXTURES",
-				"className": "贴图",
+				"className": "璐村浘",
 				"skinId": "",
 				"size": 8842
 			}, {
 				"url": "https://app-asset-1258211750.file.myqcloud.com/1/textures/NM_Door.png",
 				"packName": "",
 				"typeName": "TEXTURES",
-				"className": "贴图",
+				"className": "璐村浘",
 				"skinId": "",
 				"size": 271090
 			}],

+ 3 - 2
dist/index.html

@@ -34,8 +34,9 @@
     <script src="./libs/axios.min.js"></script>
     <script src="./libs/VisibilityChangeHandler.js"></script>
     <script src="./libs/decoder.js"></script>
+    <script src="./libs/decoder.js"></script>
+    <script src="./shader.js"></script>
 
-    
     <!-- <script src="./webrtc//adapter-7.4.0.min.js"></script>
     <script src="./webrtc/srs.sdk.js"></script> -->
     <link rel="stylesheet" href="./css/index.cb1a6e05.css" />
@@ -67,7 +68,7 @@
     const VERSION$1 = "1.0.75"
     , ENV = "production";
   
-    const COMPONENT_LIST_PREFIX = "./assets/component_list.json";
+    const COMPONENT_LIST_PREFIX = "/component_list.json";
     const isFunction = i=>typeof i == "function";
 
     const blobToDataURI = async i=>new Promise((e,t)=>{

文件差異過大導致無法顯示
+ 3837 - 324
dist/js/index.js


文件差異過大導致無法顯示
+ 1 - 1
dist/js/index.js.map


src/shader.js → dist/shader.js


+ 6 - 13
src/EngineProxy.js

@@ -5,11 +5,14 @@ import AssetTypeName from "./enum/AssetTypeName.js"
 import AssetClassName from "./enum/AssetClassName.js"
 import LoggerLevels from "./enum/LoggerLevels.js"
 import EShaderMode from "./enum/EShaderMode.js"
+import EFitMode from "./enum/EFitMode.js"
 import Http from "./Http.js"
 import XSceneManager from "./XSceneManager.js"
+import XBillboardManager from "./XBillboardManager.js"
+import ModelManager from "./ModelManager.js"
+import InitEngineTimeoutError from "./error/InitEngineTimeoutError.js"
 
 const http = new Http
-  , isIndexedDbSupported = ()=>(window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB) !== void 0
   , blobToDataURI = async i=>new Promise((e,t)=>{
     const r = new FileReader;
     r.readAsDataURL(i),
@@ -23,18 +26,8 @@ const http = new Http
     }
 }
 )
-  , dataURItoBlob = i=>{
-    let e;
-    i.split(",")[0].indexOf("base64") >= 0 ? e = atob(i.split(",")[1]) : e = unescape(i.split(",")[1]);
-    const t = i.split(",")[0].split(":")[1].split(";")[0]
-      , r = new Uint8Array(e.length);
-    for (let o = 0; o < e.length; o++)
-        r[o] = e.charCodeAt(o);
-    return new Blob([r],{
-        type: t
-    })
-}
-  , urlMap = new Map
+
+const urlMap = new Map
   , urlTransformer = async(i,e=!1)=>typeof i != "string" ? (console.warn("url transformer error", i),
 i) : i.startsWith("blob:") ? i : e ? http.get({
     url: i,

+ 13 - 0
src/Http.js

@@ -3,6 +3,19 @@ import {logger} from "./Logger.js"
 import Xverse from "./Xverse.js"
 import {modelTable} from "./ModelTable.js"
 
+const isIndexedDbSupported = ()=>(window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB) !== void 0
+const dataURItoBlob = i=>{
+    let e;
+    i.split(",")[0].indexOf("base64") >= 0 ? e = atob(i.split(",")[1]) : e = unescape(i.split(",")[1]);
+    const t = i.split(",")[0].split(":")[1].split(";")[0]
+      , r = new Uint8Array(e.length);
+    for (let o = 0; o < e.length; o++)
+        r[o] = e.charCodeAt(o);
+    return new Blob([r],{
+        type: t
+    })
+}
+
 export default class Http extends EventEmitter {
     async get({url: e, useIndexedDb: t=!1, timeout: r=15e3, key: n, isOutPutObjectURL: o=!0}) {
         if (Xverse.NO_CACHE !== void 0 && (t = !Xverse.NO_CACHE),

+ 2 - 0
src/Pool.js

@@ -1,3 +1,5 @@
+import PoolObject from "./PoolObject.js"
+
 export default class Pool {
     constructor(e, t, r, n, ...o) {
         this.lastFree = null

+ 1 - 1
src/PoolObject.js

@@ -1,4 +1,4 @@
-class PoolObject {
+export default class PoolObject {
     constructor(e, t, r, n=!0) {
         E(this, "data");
         E(this, "nextFree");

+ 1 - 1
src/RunTimeArray.js

@@ -1,4 +1,4 @@
-class RunTimeArray {
+export default class RunTimeArray {
     constructor() {
         E(this, "circularData");
         this.circularData = []

+ 4 - 1
src/StaticMeshEvent.js

@@ -1,5 +1,8 @@
+
+import EMeshType from "./enum/EMeshType.js"
+
 const LongPressMesh = [EMeshType.XAvatar];
-class StaticMeshEvent extends EventEmitter {
+export default class StaticMeshEvent extends EventEmitter {
     constructor(e) {
         super();
         E(this, "scene");

+ 3 - 1
src/TV.js

@@ -1,4 +1,6 @@
-class TV extends XTelevision {
+import XDecalManager from "./XDecalManager.js"
+
+export default class TV extends XTelevision {
     constructor(e, t, r, n) {
         super(r.scene, t, r.sceneManager, n);
         E(this, "decal");

+ 8 - 5
src/XAnimationController.js

@@ -1,6 +1,9 @@
-const avatarLoader = new XAvatarLoader
-  , log$J = new Logger$1("AnimationController");
-class XAnimationController {
+//const avatarLoader = new XAvatarLoader
+// log$J = new Logger$1("AnimationController");
+import {avatarLoader} from "./XAvatarLoader.js"
+import AvatarAnimationError from "./error/AvatarAnimationError.js"
+
+export default class XAnimationController {
     constructor(e) {
         E(this, "iBodyAnim");
         E(this, "animations", []);
@@ -234,11 +237,11 @@ class XAnimationController {
     }
     _prerocess(e, t) {
         this._avatar.isRayCastEnable && this._setPosition(e, t),
-        this._avatar.priority === 0 && log$J.info(`start play animation: ${e} on avatar ${this._avatar.id}`)
+        this._avatar.priority === 0 && logger.info(`start play animation: ${e} on avatar ${this._avatar.id}`)
     }
     _playEffect() {
         this.animationExtras.indexOf(this.iBodyAnim.name) != -1 && action.Cheering.attachPair.forEach(t=>{
-            this._avatar.attachExtraProp(t.obj, t.bone, new Vector3(t.offset.x,t.offset.y,t.offset.z), new Vector3(t.rotate.x,t.rotate.y,t.rotate.z)),
+            this._avatar.attachExtraProp(t.obj, t.bone, new BABYLON.Vector3(t.offset.x,t.offset.y,t.offset.z), new BABYLON.Vector3(t.rotate.x,t.rotate.y,t.rotate.z)),
             this._avatar.showExtra(t.obj)
         }
         )

+ 14 - 9
src/XAvatar.js

@@ -1,7 +1,12 @@
-const log$E = new Logger$1("Avatar")
-  , castRayOffsetY = .01
-  , castRayTeleportationOffset = 10;
-class XAvatar {
+//const log$E = new Logger$1("Avatar")
+
+import BillboardStatus from "./enum/BillboardStatus.js"
+import {avatarLoader} from "./XAvatarLoader.js"
+
+const castRayOffsetY = .01;
+const castRayTeleportationOffset = 10;
+
+export default class XAvatar {
     constructor({id: e, avatarType: t, priority: r, avatarManager: n, assets: o, status: a}) {
         E(this, "id", "-1");
         E(this, "priority", 0);
@@ -17,7 +22,7 @@ class XAvatar {
         E(this, "clothesList", []);
         E(this, "isSelected", !1);
         E(this, "pendingLod", !1);
-        E(this, "_previousReceivedPosition", new Vector3(0,1e4,0));
+        E(this, "_previousReceivedPosition", new BABYLON.Vector3(0,1e4,0));
         E(this, "_avatarPosition");
         E(this, "_avatarRotation");
         E(this, "_avatarScale");
@@ -247,7 +252,7 @@ class XAvatar {
     }
     setScale(e) {
         this._avatarScale = e,
-        this.rootNode && (this.rootNode.scaling = new Vector3(e,e,e)),
+        this.rootNode && (this.rootNode.scaling = new BABYLON.Vector3(e,e,e)),
         this.bbComponent.bbox && this.getBbox()
     }
     _removeAvatarFromScene() {
@@ -271,15 +276,15 @@ class XAvatar {
         return new Promise((t,r)=>{
             var d;
             const n = ue4Position2Xverse(e)
-              , o = new Vector3(0,-1,0)
+              , o = new BABYLON.Vector3(0,-1,0)
               , a = 1.5 * this.scale
               , s = 100 * a
               , l = a
-              , u = new Vector3(n.x,n.y + l,+n.z)
+              , u = new BABYLON.Vector3(n.x,n.y + l,+n.z)
               , c = new Ray(u,o,s)
               , h = (d = this.avatarManager.sceneManager) == null ? void 0 : d.getGround(e);
             if (!h || h.length <= 0)
-                return log$E.warn(`\u89D2\u8272 id= ${this.id} \u627E\u4E0D\u5230\u5730\u9762\uFF0C\u5F53\u524D\u9AD8\u5EA6\u4E3A\u4E0B\u53D1\u9AD8\u5EA6`),
+                return logger.warn(`\u89D2\u8272 id= ${this.id} \u627E\u4E0D\u5230\u5730\u9762\uFF0C\u5F53\u524D\u9AD8\u5EA6\u4E3A\u4E0B\u53D1\u9AD8\u5EA6`),
                 t(0);
             let f = c.intersectsMeshes(h);
             if (f.length > 0)

+ 18 - 13
src/XAvatarBillboardComponent.js

@@ -1,5 +1,10 @@
-const log$F = new Logger$1("XAvatarBillboardComponent");
-class XAvatarBillboardComponent {
+//const log$F = new Logger$1("XAvatarBillboardComponent");
+
+import EMeshType from "./enum/EMeshType.js"
+import BillboardStatus from "./enum/BillboardStatus.js"
+import {logger} from "./Logger.js"
+
+export default class XAvatarBillboardComponent {
     constructor(e) {
         E(this, "_nickName", "");
         E(this, "_words", "");
@@ -41,7 +46,7 @@ class XAvatarBillboardComponent {
                     s ? (f = e.rootNode.rotation.y / Math.PI * 180 + 90,
                     e.rootNode.rotation.y && (t.rotation.y = e.rootNode.rotation.y)) : f = e.avatarManager.sceneManager.cameraComponent.getCameraPose().rotation.yaw,
                     f || (f = 0);
-                    const d = new Vector3(0,this._height,0);
+                    const d = new BABYLON.Vector3(0,this._height,0);
                     e.controller && e.controller.activeAnimation() && e.controller.activeAnimation().animatables[0] && (this._height = d.y = (e.controller.activeAnimation().animatables[0].target.position.y * .01 - .66) * e.scale),
                     d.y < .07 * e.scale && (d.y = 0),
                     t.position.x = l.position.x + h.x * Math.sin(f * Math.PI / 180) + h.z * Math.cos(f * Math.PI / 180),
@@ -51,7 +56,7 @@ class XAvatarBillboardComponent {
                 ),
                 this._attachmentObservers.set(u, c))
             } else
-                log$F.error("avatar or attachment not found!")
+                logger.error("avatar or attachment not found!")
         }
         );
         E(this, "detachFromAvatar", (e,t,r=!1)=>{
@@ -59,7 +64,7 @@ class XAvatarBillboardComponent {
             n && this._scene.onBeforeRenderObservable.remove(n),
             e.rootNode ? (t.setEnabled(!1),
             t.parent = null,
-            r && t.dispose()) : log$F.error("avatar not found!")
+            r && t.dispose()) : logger.error("avatar not found!")
         }
         );
         E(this, "getBbox", (e,t={})=>{
@@ -81,14 +86,14 @@ class XAvatarBillboardComponent {
                 l *= u
             }
             if (e.rootNode) {
-                let u = new Vector3(0,0,0)
-                  , c = new Vector3(0,0,0);
+                let u = new BABYLON.Vector3(0,0,0)
+                  , c = new BABYLON.Vector3(0,0,0);
                 if (r) {
                     const f = ue4Position2Xverse(o);
-                    u = u.add(f.add(new Vector3(-a / 2,-s / 2,-l / 2))),
-                    c = c.add(f.add(new Vector3(a / 2,s / 2,l / 2)))
-                } else if (u = u.add(new Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)),
-                c = c.add(new Vector3(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY)),
+                    u = u.add(f.add(new BABYLON.Vector3(-a / 2,-s / 2,-l / 2))),
+                    c = c.add(f.add(new BABYLON.Vector3(a / 2,s / 2,l / 2)))
+                } else if (u = u.add(new BABYLON.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)),
+                c = c.add(new BABYLON.Vector3(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY)),
                 e.isRender) {
                     e.rootNode.getChildMeshes().forEach(_=>{
                         const g = _.getBoundingInfo().boundingBox.minimum
@@ -129,7 +134,7 @@ class XAvatarBillboardComponent {
                     this._pickBbox = f
                 }
             } else
-                log$F.error("avatar not found!")
+                logger.error("avatar not found!")
         }
         );
         this._scene = e
@@ -220,7 +225,7 @@ class XAvatarBillboardComponent {
         this._pickBbox = null)
     }
     setPickBoxScale(e) {
-        this._pickBbox && this._pickBbox.data && (this._pickBbox.data.scaling = new Vector3(e,e,e))
+        this._pickBbox && this._pickBbox.data && (this._pickBbox.data.scaling = new BABYLON.Vector3(e,e,e))
     }
     setIsPickable(e, t) {
         e.rootNode && e.rootNode.getChildMeshes().forEach(r=>{

+ 8 - 4
src/XAvatarComopnent.js

@@ -1,5 +1,9 @@
-const log$H = new Logger$1("XAvatarComopnent");
-class XAvatarComopnent {
+//const log$H = new Logger$1("XAvatarComopnent");
+
+import EMeshType from "./enum/EMeshType.js"
+import {logger} from "./Logger.js"
+
+export default class XAvatarComopnent {
     constructor() {
         E(this, "resourceIdList", []);
         E(this, "skeleton");
@@ -70,7 +74,7 @@ class XAvatarComopnent {
         this.body.root.dispose(),
         this.body = void 0,
         this.skeleton && (this.skeleton.dispose(),
-        this.skeleton = void 0)) : log$H.warn("[Engine] no body to dispose")
+        this.skeleton = void 0)) : logger.warn("[Engine] no body to dispose")
     }
     changeClothesComp(e, t, r, n, o) {
         return new Promise(a=>{
@@ -137,7 +141,7 @@ class XAvatarComopnent {
             const a = e.avatarManager.extraComps.get(t)
               , s = a == null ? void 0 : a.clone(t, void 0);
             if (!a) {
-                log$H.error("\u6CA1\u6709\u5BF9\u5E94\u7684\u7EC4\u4EF6");
+                logger.error("\u6CA1\u6709\u5BF9\u5E94\u7684\u7EC4\u4EF6");
                 return
             }
             this.extras.push(s);

+ 16 - 11
src/XAvatarLoader.js

@@ -1,4 +1,6 @@
-class XAvatarLoader {
+import {logger} from "./Logger.js"
+
+export default class XAvatarLoader {
     constructor() {
         E(this, "containers", new Map);
         E(this, "meshes", new Map);
@@ -17,8 +19,8 @@ class XAvatarLoader {
         E(this, "enableShareTexture", !0);
         E(this, "enableShareAnimation", !0);
         E(this, "fillEmptyLod", !0);
-        const e = new GLTFFileLoader;
-        SceneLoader.RegisterPlugin(e),
+        const e = new BABYLON.GLTFFileLoader;
+        BABYLON.SceneLoader.RegisterPlugin(e),
         e.preprocessUrlAsync = function(t) {
             const r = avatarLoader._mappings.get(t);
             return r ? Promise.resolve(r) : Promise.resolve(t)
@@ -70,12 +72,12 @@ class XAvatarLoader {
                         o(d)
                     }
                     ).catch(h=>{
-                        log$K.error(`[Engine] parse json file error,${h}`)
+                        logger.error(`[Engine] parse json file error,${h}`)
                     }
                     )
                 }
                 ).catch(c=>{
-                    log$K.error(`[Engine] ulrtransform error, cannot find resource in db,${c}`)
+                    logger.error(`[Engine] ulrtransform error, cannot find resource in db,${c}`)
                 }
                 )
             }
@@ -102,7 +104,7 @@ class XAvatarLoader {
         t ? t.forEach(r=>{
             this.aniPath.set(e + "_" + r.name, r.url)
         }
-        ) : log$K.error("[Engine] no animation list exist, please check config for details")
+        ) : logger.error("[Engine] no animation list exist, please check config for details")
     }
     disposeContainer() {
         this.containers.forEach((e,t)=>{
@@ -189,12 +191,12 @@ class XAvatarLoader {
         return this.meshTexList.get(e)
     }
     _loadGltfFromUrl(e, t, r) {
-        return SceneLoader.LoadAssetContainerAsync(r, t + ".gltf", e.Scene, null, ".gltf")
+        return BABYLON.SceneLoader.LoadAssetContainerAsync(r, t + ".gltf", e.Scene, null, ".gltf")
     }
     _loadGlbFromBlob(e, t, r) {
         return new Promise((n,o)=>{
             e.urlTransformer(r).then(a=>{
-                SceneLoader.LoadAssetContainerAsync("", a, e.Scene, null, ".glb").then(s=>{
+                BABYLON.SceneLoader.LoadAssetContainerAsync("", a, e.Scene, null, ".glb").then(s=>{
                     if (s) {
                         if (this.enableShareTexture && s.textures.length > 0) {
                             const l = t.indexOf("_lod") != -1 ? t.slice(0, -5) : t
@@ -227,7 +229,7 @@ class XAvatarLoader {
     }
     _loadGlbFromUrl(e, t, r) {
         return new Promise((n,o)=>{
-            SceneLoader.LoadAssetContainerAsync("", r, e.Scene, null, ".glb").then(a=>{
+            BABYLON.SceneLoader.LoadAssetContainerAsync("", r, e.Scene, null, ".glb").then(a=>{
                 if (a) {
                     if (a.addAllToScene(),
                     a.meshes.forEach(s=>{
@@ -290,7 +292,7 @@ class XAvatarLoader {
             s.push(this._blobMapping(e, d)),
             Promise.all(s).then(()=>{
                 const _ = u.replace(l + ".gltf", "");
-                SceneLoader.LoadAssetContainerAsync(_, l + ".gltf", e.Scene, null, ".gltf").then(g=>{
+                BABYLON.SceneLoader.LoadAssetContainerAsync(_, l + ".gltf", e.Scene, null, ".gltf").then(g=>{
                     var v;
                     this.containers.set(u, g),
                     g.addAllToScene(),
@@ -316,4 +318,7 @@ class XAvatarLoader {
         }
         )
     }
-}
+}
+
+const avatarLoader = new XAvatarLoader();
+export { avatarLoader };

+ 3 - 1
src/XAvatarManager.js

@@ -1,5 +1,7 @@
 import {logger} from "./Logger.js"
 import Pool from "./Pool"
+import BillboardStatus from "./enum/BillboardStatus.js"
+import {avatarLoader} from "./XAvatarLoader.js"
 
 export default class XAvatarManager {
     constructor(e) {
@@ -691,7 +693,7 @@ export default class XAvatarManager {
         return new Promise((n,o)=>{
             var a;
             (a = this.sceneManager) == null || a.urlTransformer(e).then(s=>{
-                SceneLoader.LoadAssetContainerAsync("", s, this.scene, null, avatarSetting.fileType).then(l=>{
+                BABYLON.SceneLoader.LoadAssetContainerAsync("", s, this.scene, null, avatarSetting.fileType).then(l=>{
                     var c;
                     this.extraComps.set(r, l.meshes[0]);
                     const u = new NodeMaterial(`material_${r}`,this._scene,{

+ 11 - 10
src/XBillboard.js

@@ -1,9 +1,10 @@
-const log$I = new Logger$1("Billboard");
-var BillboardStatus = (i=>(i[i.SHOW = 1] = "SHOW",
-i[i.HIDE = 0] = "HIDE",
-i[i.DISPOSE = -1] = "DISPOSE",
-i))(BillboardStatus || {});
-class XBillboard {
+//const log$I = new Logger$1("Billboard");
+
+import EMeshType from "./enum/EMeshType.js"
+import {logger} from "./Logger.js"
+import XBillboardManager from "./XBillboardManager.js"
+
+export default class XBillboard {
     constructor(e, t=!1, r=!1) {
         E(this, "_mesh", null);
         E(this, "_texture", null);
@@ -14,7 +15,7 @@ class XBillboard {
         E(this, "_billboardManager");
         E(this, "poolobj", null);
         E(this, "_usePool");
-        E(this, "_initMeshScale", new Vector3(1,1,1));
+        E(this, "_initMeshScale", new BABYLON.Vector3(1,1,1));
         E(this, "_status", -1);
         E(this, "_stageChanged", !1);
         E(this, "DEFAULT_CONFIGS", {});
@@ -80,7 +81,7 @@ class XBillboard {
     updateImage(e) {
         return new Promise(t=>{
             if (this._texture == null) {
-                log$I.error("[Engine]Billboard texture not found");
+                logger.error("[Engine]Billboard texture not found");
                 return
             }
             const r = this._mesh
@@ -127,7 +128,7 @@ class XBillboard {
     }
     updateText(e, t, r=!0, n=[], o=30, a="monospace", s="black", l="bold", u) {
         if (this._texture == null) {
-            log$I.error("[Engine]Billboard texture not found");
+            logger.error("[Engine]Billboard texture not found");
             return
         }
         const c = this._texture
@@ -171,7 +172,7 @@ class XBillboard {
                 const y = u && u < n.length - 1 ? u : n.length - 1
                   , b = 480 * f
                   , T = 60 * f * y;
-                this._mesh.scaling = new Vector3(b * d,T * _,1),
+                this._mesh.scaling = new BABYLON.Vector3(b * d,T * _,1),
                 c.scaleTo(b, T);
                 const C = c.getContext();
                 C.textAlign = "center",

+ 14 - 10
src/XBillboardManager.js

@@ -1,5 +1,9 @@
 const texRootDir = "https://app-asset-1258211750.file.myqcloud.com/1/textures/"
-class XBillboardManager {
+
+import BillboardStatus from "./enum/BillboardStatus.js"
+import Pool from "./Pool.js"
+
+export default class XBillboardManager {
     constructor(e) {
         E(this, "billboardMap", new Map);
         E(this, "sceneManager");
@@ -28,21 +32,21 @@ class XBillboardManager {
         const r = BABYLON.MeshBuilder.CreatePlane("billboard-", {
             height: .001,
             width: .001,
-            sideOrientation: Mesh.DOUBLESIDE
+            sideOrientation: BABYLON.Mesh.DOUBLESIDE
         }, e);
         r.isPickable = !0,
         r.setEnabled(!1);
-        const n = new DynamicTexture("billboard-tex-",{
+        const n = new BABYLON.DynamicTexture("billboard-tex-",{
             width: .001 + 1,
             height: .001 + 1
-        },e,t,Texture.BILINEAR_SAMPLINGMODE);
+        },e,t,BABYLON.Texture.BILINEAR_SAMPLINGMODE);
         n.hasAlpha = !0;
-        const o = new StandardMaterial("billboard-mat-",e);
+        const o = new BABYLON.StandardMaterial("billboard-mat-",e);
         return o.diffuseTexture = n,
-        o.emissiveColor = new Color3(.95,.95,.95),
+        o.emissiveColor = new BABYLON.Color3(.95,.95,.95),
         o.useAlphaFromDiffuseTexture = !0,
         r.material = o,
-        r.billboardMode = Mesh.BILLBOARDMODE_Y,
+        r.billboardMode = BABYLON.Mesh.BILLBOARDMODE_Y,
         r.position.y = 0,
         r
     }
@@ -53,14 +57,14 @@ class XBillboardManager {
         e
     }
     async loadBackGroundTexToIDB() {
-        ge.userBubbleUrls.forEach(r=>{
+        XBillboardManager.userBubbleUrls.forEach(r=>{
             this.sceneManager.urlTransformer(r).then(n=>{
                 this.userBackGroundBlob.push(n)
             }
             )
         }
         ),
-        ge.npcBubbleUrls.forEach(r=>{
+        XBillboardManager.npcBubbleUrls.forEach(r=>{
             this.sceneManager.urlTransformer(r).then(n=>{
                 this.npcBackGroundBlob.push(n)
             }
@@ -85,7 +89,7 @@ class XBillboardManager {
         const g = this.addBillboard(t, !1, !0);
         g.getMesh() == null && g.init(t, f, d);
         let m;
-        r != null && (m = r ? ge.userBubbleUrls : ge.npcBubbleUrls),
+        r != null && (m = r ? XBillboardManager.userBubbleUrls : XBillboardManager.npcBubbleUrls),
         g && g.getMesh() && (g.DEFAULT_CONFIGS = {
             id: t,
             isUser: r,

+ 18 - 14
src/XBreathPointManager.js

@@ -1,4 +1,8 @@
-class XBreathPointManager {
+import XStaticMesh from "./XStaticMesh.js"
+import {logger} from "./Logger.js"
+import EMeshType from "./enum/EMeshType.js"
+
+export default class XBreathPointManager {
     constructor(e) {
         E(this, "_scene");
         E(this, "materialMap", new Map);
@@ -11,7 +15,7 @@ class XBreathPointManager {
                 url: "https://static.xverse.cn/qqktv/texture.png"
             }];
             if (t.length <= 0) {
-                log$w.warn("[Engine] BreathPoint get texture list error: textureList.length <= 0"),
+                logger.warn("[Engine] BreathPoint get texture list error: textureList.length <= 0"),
                 new XBreathPointError("[Engine] BreathPoint get texture list error!");
                 return
             }
@@ -22,12 +26,12 @@ class XBreathPointManager {
                 roll: 0
             }, size: c=.6, width: h=-1, height: f=-1, fps: d=30, billboardMode: _=!1, forceLeaveGround: g=!1, type: m="default", lifeTime: v=-1, backfaceculling: y=!0, maxVisibleRegion: b=-1, skinInfo: T="default"} = e;
             if (this.breathPoints.get(n)) {
-                log$w.warn("[Engine] Cannot add breathPoint with an existing id: [" + n + "]"),
+                logger.warn("[Engine] Cannot add breathPoint with an existing id: [" + n + "]"),
                 new XBreathPointError("[Engine] Cannot add breathPoint with an existing id: [" + n + "]");
                 return
             }
             if (g) {
-                const I = this.castRay(new Vector3(l.x,l.y,l.z)) * scaleFromUE4toXverse;
+                const I = this.castRay(new BABYLON.Vector3(l.x,l.y,l.z)) * scaleFromUE4toXverse;
                 I != 0 ? l.z = l.z - I + 1 : l.z = l.z + 1
             }
             let C;
@@ -37,7 +41,7 @@ class XBreathPointManager {
                 C = I.mat
             } else {
                 const I = new Texture(o,this._scene,!0,!0,Texture.BILINEAR_SAMPLINGMODE,null,()=>{
-                    log$w.error("[Engine] Breathpoint create texture error."),
+                    logger.error("[Engine] Breathpoint create texture error."),
                     new XBreathPointError("[Engine] Breathpoint create texture error.")
                 }
                 ,null,!0);
@@ -189,7 +193,7 @@ class XBreathPointManager {
             y: e.y,
             z: e.z
         });
-        const t = new Vector3(0,-1,0)
+        const t = new BABYLON.Vector3(0,-1,0)
           , r = new Ray(e,t,length)
           , n = []
           , o = (s = this._sceneManager) == null ? void 0 : s.getGround({
@@ -225,17 +229,17 @@ class XBreathPointManager {
             r.changePickable(e)
     }
     clearBreathPoints(e) {
-        log$w.info(`[Engine] clearBreathPoints: ${e}`);
+        logger.info(`[Engine] clearBreathPoints: ${e}`);
         for (const [t,r] of this.breathPoints.entries())
             (r._type == e || r._id == e) && this.delete(r._id)
     }
     clearBreathPointsBySkinInfo(e) {
-        log$w.info(`[Engine] clearBreathPointsBySkinInfo: ${e}`);
+        logger.info(`[Engine] clearBreathPointsBySkinInfo: ${e}`);
         for (const [t,r] of this.breathPoints.entries())
             r.skinInfo == e && this.delete(r._id)
     }
     clearAllBreathPoints() {
-        log$w.info("[Engine] ClearAllBreathPoints");
+        logger.info("[Engine] ClearAllBreathPoints");
         for (const [e,t] of this.breathPoints.entries())
             this.delete(t._id)
     }
@@ -251,14 +255,14 @@ class XBreathPointManager {
         return e
     }
     changeBreathPointPose(e, t, r) {
-        const n = new Vector3(e.position.x,e.position.y,e.position.z);
+        const n = new BABYLON.Vector3(e.position.x,e.position.y,e.position.z);
         if (this.breathPoints.get(r) != null) {
-            log$w.info(`[Engine] changeBreathPointPose, id:${r}`);
+            logger.info(`[Engine] changeBreathPointPose, id:${r}`);
             const o = this.breathPoints.get(r)
               , a = o.mesh.position;
             let s = a.subtract(n);
-            s = Vector3.Normalize(s);
-            const l = Vector3.Distance(a, n)
+            s = BABYLON.Vector3.Normalize(s);
+            const l = BABYLON.Vector3.Distance(a, n)
               , u = new Ray(n,s,l)
               , c = this._scene.multiPickWithRay(u);
             if (c) {
@@ -270,6 +274,6 @@ class XBreathPointManager {
                     }
             }
         } else
-            log$w.warn(`[Engine] changeBreathPointPose, id:${r} is not existing!`)
+            logger.warn(`[Engine] changeBreathPointPose, id:${r} is not existing!`)
     }
 }

+ 9 - 6
src/XDecal.js

@@ -1,4 +1,7 @@
-class XDecal {
+import EMeshType from "./enum/EMeshType.js"
+import {logger} from "./Logger.js"
+
+export default class XDecal {
     constructor(e) {
         E(this, "_id");
         E(this, "meshPath");
@@ -8,7 +11,7 @@ class XDecal {
         E(this, "_skinInfo");
         E(this, "sourceMatId", "");
         E(this, "loadModel", async()=>new Promise((e,t)=>{
-            typeof this.meshPath == "string" ? SceneLoader.LoadAssetContainerAsync("", this.meshPath, this.scene, null, ".glb").then(r=>{
+            typeof this.meshPath == "string" ? BABYLON.SceneLoader.LoadAssetContainerAsync("", this.meshPath, this.scene, null, ".glb").then(r=>{
                 for (let n = r.materials.length - 1; n >= 0; --n)
                     r.materials[n].dispose();
                 for (let n = 0; n < r.meshes.length; ++n)
@@ -65,8 +68,8 @@ class XDecal {
     }
     changeModel(e="") {
         return e != "" && (this.meshPath = e),
-        this.meshPath == "" ? (log$x.error("[Engine] changeModel Error! meshPath is empty"),
-        Promise.reject(new XDecalTextureError("[Engine] changeModel Error! meshPath is empty"))) : new Promise((t,r)=>SceneLoader.LoadAssetContainerAsync("", this.meshPath, this.scene, null, ".glb").then(n=>{
+        this.meshPath == "" ? (logger.error("[Engine] changeModel Error! meshPath is empty"),
+        Promise.reject(new XDecalTextureError("[Engine] changeModel Error! meshPath is empty"))) : new Promise((t,r)=>BABYLON.SceneLoader.LoadAssetContainerAsync("", this.meshPath, this.scene, null, ".glb").then(n=>{
             for (let a = n.materials.length - 1; a >= 0; --a)
                 n.materials[a].dispose();
             const o = [];
@@ -89,13 +92,13 @@ class XDecal {
             t(this)
         }
         ).catch(n=>{
-            log$x.error("[Engine] Create decal error! " + n),
+            logger.error("[Engine] Create decal error! " + n),
             r(new XDecalError("[Engine] Create decal error! " + n))
         }
         ))
     }
     cleanMesh(e=!1, t=!1) {
-        log$x.info("[Engine] Decal Model clean mesh");
+        logger.info("[Engine] Decal Model clean mesh");
         for (let r = 0; r < this._low_model.length; ++r)
             this._low_model[r].dispose(e, t)
     }

+ 21 - 21
src/XDecalManager.js

@@ -1,4 +1,4 @@
-class XDecalManager {
+export default class XDecalManager {
     constructor(e) {
         E(this, "scene");
         E(this, "_decal");
@@ -19,8 +19,8 @@ class XDecalManager {
     }
     async addDecal(e) {
         const {id: t, meshPath: r, skinInfo: n="default"} = e;
-        return this._decal.get(t) ? (log$x.warn(`[Engine] Cannot add decal with an existing id: [${t}], meshPath: ${r}, skinInfo:${n}`),
-        Promise.resolve(!0)) : (log$x.info(`[Engine] addDecal wiht id:[${t}], meshPath: ${r}, skinInfo:${n}`),
+        return this._decal.get(t) ? (logger.warn(`[Engine] Cannot add decal with an existing id: [${t}], meshPath: ${r}, skinInfo:${n}`),
+        Promise.resolve(!0)) : (logger.info(`[Engine] addDecal wiht id:[${t}], meshPath: ${r}, skinInfo:${n}`),
         new Promise((o,a)=>this._scenemanager.urlTransformer(r).then(s=>new Promise((l,u)=>{
             if (this._decal.get(t))
                 l(!0);
@@ -36,7 +36,7 @@ class XDecalManager {
                     l(!0)
                 }
                 ).catch(h=>{
-                    log$x.error(`[Engine] addDecal Error! id: [${t}], meshpath:${r}, skin: ${n}. ${h}`),
+                    logger.error(`[Engine] addDecal Error! id: [${t}], meshpath:${r}, skin: ${n}. ${h}`),
                     u(new XDecalError(`[Engine] addDecal Error! id: [${t}], meshpath:${r}, skin: ${n}. ${h}`))
                 }
                 )
@@ -46,7 +46,7 @@ class XDecalManager {
             s == !0 ? o(!0) : a(!1)
         }
         ).catch(s=>{
-            log$x.error(`[Engine] Add Decal error! id: [${t}], meshpath:${r}, skin:${n}. ${s}`),
+            logger.error(`[Engine] Add Decal error! id: [${t}], meshpath:${r}, skin:${n}. ${s}`),
             a(new XDecalError(`[Engine] addDecal  error! id: [${t}], meshpath:${r}, skin:${n}. ${s}`))
         }
         )))
@@ -54,7 +54,7 @@ class XDecalManager {
     setDecalTexture(e) {
         const {id: t, buffer: r, isDynamic: n=!1, width: o=1100, height: a=25, slots: s=1, visibleSlots: l=1} = e
           , u = !0;
-        return log$x.info(`[Engine] setDecalTexture wiht id:[${t}]`),
+        return logger.info(`[Engine] setDecalTexture wiht id:[${t}]`),
         new Promise((c,h)=>{
             const f = this._decal.get(t);
             if (f != null)
@@ -79,20 +79,20 @@ class XDecalManager {
                         c(!0)
                     }
                     ).catch(_=>{
-                        log$x.error("[Engine] setDecalTexture Error! " + _),
+                        logger.error("[Engine] setDecalTexture Error! " + _),
                         h(new XDecalTextureError(`[Engine] decal set texture error! ${_}`))
                     }
                     )
                 }
             else
-                log$x.error("[Engine] Error! decal id: [" + t + "] is not find!"),
+                logger.error("[Engine] Error! decal id: [" + t + "] is not find!"),
                 h(new XDecalTextureError(`[Engine] decal id: [${t}] is not find!`))
         }
         )
     }
     async shareDecal(e) {
         const {idTar: t, meshPath: r, idSrc: n, skinInfo: o="default"} = e;
-        return this._decal.has(n) && !this._decal.has(t) && this._mat.has(n) && !this._mat.has(t) ? (log$x.info(`[Engine] shareDecal wiht idTar:[${t}], idSrc:[${n}], skinInfo: ${o}, meshPath: ${r}`),
+        return this._decal.has(n) && !this._decal.has(t) && this._mat.has(n) && !this._mat.has(t) ? (logger.info(`[Engine] shareDecal wiht idTar:[${t}], idSrc:[${n}], skinInfo: ${o}, meshPath: ${r}`),
         new Promise((a,s)=>this._scenemanager.urlTransformer(r).then(l=>{
             const u = new XDecal({
                 id: t,
@@ -110,25 +110,25 @@ class XDecalManager {
         ).catch(l=>{
             s(new XDecalError(`[Engine] decal shareDecal error! ${l}`))
         }
-        ))) : (log$x.error(`[Engine] shareDecal Error. idSrc: [${n}] not exist! or idTar: [${t}] exists!`),
+        ))) : (logger.error(`[Engine] shareDecal Error. idSrc: [${n}] not exist! or idTar: [${t}] exists!`),
         Promise.reject(`[Engine] shareDecal Error. idSrc: [${n}] not exist! or idTar: [${t}] exists!`))
     }
     async changeDecalModel(e) {
         const {id: t, meshPath: r} = e
           , n = this._decal.get(t);
-        return new Promise((o,a)=>n != null ? (log$x.info(`[Engine] changeDecalModel id:${t}`),
+        return new Promise((o,a)=>n != null ? (logger.info(`[Engine] changeDecalModel id:${t}`),
         n.changeModel(r).then(()=>{
             this._decal.set(t, n),
             o(!0)
         }
-        )) : (log$x.warn(`[Engine] changeDecalModel id:${t} is not exist`),
+        )) : (logger.warn(`[Engine] changeDecalModel id:${t} is not exist`),
         a(`[Engine] changeDecalModel id:${t} is not exist`)))
     }
     changeDecalTexture(e) {
         const {id: t, buffer: r, isUrl: n=!1, isDynamic: o=!1, width: a=1110, height: s=25, slots: l=1, visibleSlots: u=1} = e
           , c = this._mat.get(t);
         c != null && this._decal.has(t) ? (c.changeTexture(r, n, o, a, s, l, u),
-        this._mat.set(t, c)) : log$x.error(`[Engine] changeDecalTexture Error. id:${t} is not exist`)
+        this._mat.set(t, c)) : logger.error(`[Engine] changeDecalTexture Error. id:${t} is not exist`)
     }
     deleteDecal(e) {
         var t, r;
@@ -182,7 +182,7 @@ class XDecalManager {
     }
     async updateTexAsImg(e, t, r={}) {
         const {clearArea: n=!0, w: o=480, h: a=480, x: s=o / 2, y: l=a / 2, clearW: u=o, clearH: c=a} = r;
-        return t == null || t == null || t == "" ? (log$x.error(`[Engine] updateTexAsImg Error. id: [${e}], newBuffer is Null or ""!`),
+        return t == null || t == null || t == "" ? (logger.error(`[Engine] updateTexAsImg Error. id: [${e}], newBuffer is Null or ""!`),
         Promise.reject(new XDecalError(`[Engine] updateTexAsImg Error. id: [${e}], newBuffer is Null or ""!`))) : new Promise((h,f)=>this._scenemanager.urlTransformer(t).then(d=>new Promise((_,g)=>{
             const m = this._mat.get(e);
             if (m) {
@@ -200,31 +200,31 @@ class XDecalManager {
                     }
                     ,
                     b.onerror = ()=>{
-                        log$x.error(`[Engine] updateTexAsImg Error.newImg load error. id: [${e}], decalMat is Null or undefined!`),
+                        logger.error(`[Engine] updateTexAsImg Error.newImg load error. id: [${e}], decalMat is Null or undefined!`),
                         g(new XDecalError(`[Engine] updateTexAsImg Error. id: [${e}], decalMat is Null or undefined!`))
                     }
                 } else
-                    log$x.error(`[Engine] updateTexAsImg Error. id: [${e}], Buffer is not string!`),
+                    logger.error(`[Engine] updateTexAsImg Error. id: [${e}], Buffer is not string!`),
                     g(new XDecalError(`[Engine] updateTexAsImg Error. id: [${e}], Buffer is not string!`))
             } else
-                log$x.error(`[Engine] updateTexAsImg Error. id: [${e}], decalMat is Null or undefined!`),
+                logger.error(`[Engine] updateTexAsImg Error. id: [${e}], decalMat is Null or undefined!`),
                 g(new XDecalError(`[Engine] updateTexAsImg Error. id: [${e}], decalMat is Null or undefined!`))
         }
         ).then(_=>{
-            _ == !0 ? h(!0) : (log$x.error(`[Engine] updateTexAsImg Error. id: [${e}] !`),
+            _ == !0 ? h(!0) : (logger.error(`[Engine] updateTexAsImg Error. id: [${e}] !`),
             f(new XDecalError(`[Engine] updateTexAsImg error! id: [${e}]`)))
         }
         ).catch(_=>{
-            log$x.error(`[Engine] updateTexAsImg Error. id: [${e}]. ${_}`)
+            logger.error(`[Engine] updateTexAsImg Error. id: [${e}]. ${_}`)
         }
         )))
     }
     startAnime(e, t) {
-        log$x.info(`[Engine] Decal Start Anime. [${e}]`);
+        logger.info(`[Engine] Decal Start Anime. [${e}]`);
         const {speed: r=.001, callback: n} = t
           , o = this._mat.get(e);
         o ? (o.do_animation(r),
-        n && o.uOffsetObserverable.add(n)) : (log$x.error(`[Engine] startAnime Error. id: [${e}] is not exist!`),
+        n && o.uOffsetObserverable.add(n)) : (logger.error(`[Engine] startAnime Error. id: [${e}] is not exist!`),
         new XDecalError(`[Engine] startAnime Error. id: [${e}] is not exist!`))
     }
 }

+ 13 - 10
src/XDecalMaterial.js

@@ -1,4 +1,7 @@
-class XDecalMaterial {
+
+import XDecalTextureError from "./error/XDecalTextureError"
+
+export default class XDecalMaterial {
     constructor(e, t) {
         E(this, "_id");
         E(this, "_tex");
@@ -21,7 +24,7 @@ class XDecalMaterial {
             this._slots = a,
             this._visibleSlots = s;
             const c = this._tex;
-            r ? (this._tex = new DynamicTexture("dyTex",{
+            r ? (this._tex = new BABYLON.DynamicTexture("dyTex",{
                 width: n,
                 height: o
             },this.scene,!0,Texture.BILINEAR_SAMPLINGMODE),
@@ -30,25 +33,25 @@ class XDecalMaterial {
             this._tex.vScale = -1,
             this._tex.vOffset = 1,
             this._tex.wrapU = 1,
-            this._mat.emissiveColor = new Color3(.95,.95,.95),
+            this._mat.emissiveColor = new BABYLON.Color3(.95,.95,.95),
             this._mat.diffuseTexture = this._tex,
             this._mat.diffuseTexture.hasAlpha = !0,
             this._mat.useAlphaFromDiffuseTexture = !0,
             this._mat.backFaceCulling = !1,
-            this._mat.transparencyMode = Material.MATERIAL_ALPHATEST,
+            this._mat.transparencyMode = BABYLON.Material.MATERIAL_ALPHATEST,
             c != null && c.dispose(),
-            l(!0)) : !r && t && typeof e == "string" ? this._tex = new Texture(e,this.scene,!0,!1,Texture.BILINEAR_SAMPLINGMODE,()=>{
+            l(!0)) : !r && t && typeof e == "string" ? this._tex = new BABYLON.Texture(e,this.scene,!0,!1,Texture.BILINEAR_SAMPLINGMODE,()=>{
                 this._tex.name = "decal_" + this._id,
                 this._mat.emissiveTexture = this._tex,
                 this._mat.diffuseTexture = this._tex,
                 this._mat.diffuseTexture.hasAlpha = !0,
                 this._mat.useAlphaFromDiffuseTexture = !0,
-                this._mat.transparencyMode = Material.MATERIAL_ALPHATEST,
+                this._mat.transparencyMode = BABYLON.Material.MATERIAL_ALPHATEST,
                 c != null && c.dispose(),
                 l(!0)
             }
             ,()=>{
-                log$x.error("[Engine] decal create texture error!"),
+                logger.error("[Engine] decal create texture error!"),
                 u(new XDecalTextureError("[Engine] decal create texture error!"))
             }
             ,null,!0) : this._tex = new Texture("data:decal_" + this._id,this.scene,!0,!1,Texture.BILINEAR_SAMPLINGMODE,()=>{
@@ -62,7 +65,7 @@ class XDecalMaterial {
                 l(!0)
             }
             ,()=>{
-                log$x.error("[Engine] decal create texture error!"),
+                logger.error("[Engine] decal create texture error!"),
                 u(new XDecalTextureError("[Engine] decal create texture error!"))
             }
             ,e,!0)
@@ -95,11 +98,11 @@ class XDecalMaterial {
         ))
     }
     changeTexture(e, t=!1, r=!1, n=1, o=1, a=1, s=1) {
-        return this._mat == null || this._tex == null ? (log$x.error("[Engine] Decal Mat is null or tex is null"),
+        return this._mat == null || this._tex == null ? (logger.error("[Engine] Decal Mat is null or tex is null"),
         Promise.reject(new XDecalTextureError("[Engine] Decal Mat is null or tex is null"))) : this.setTexture(e, t, r, n, o, a, s)
     }
     cleanTexture() {
-        log$x.info("[Engine] Decal clean Texture"),
+        logger.info("[Engine] Decal clean Texture"),
         this.scene.onBeforeRenderObservable.remove(this._animeObserver),
         this._uOffsetObserverable.clear(),
         this._tex.dispose(),

+ 3 - 1
src/XEngineRunTimeStats.js

@@ -1,4 +1,6 @@
-class XEngineRunTimeStats {
+import RunTimeArray from "./RunTimeArray.js"
+
+export default class XEngineRunTimeStats {
     constructor() {
         E(this, "timeArray_loadStaticMesh", new RunTimeArray);
         E(this, "timeArray_updateStaticMesh", new RunTimeArray);

+ 12 - 10
src/XLightManager.js

@@ -1,5 +1,7 @@
-const log$C = new Logger$1("XLightManager");
-class XLightManager {
+//const log$C = new Logger$1("XLightManager");
+import {logger} from "./Logger.js"
+
+export default class XLightManager {
     constructor(e) {
         E(this, "_scene");
         E(this, "_envTexture");
@@ -12,20 +14,20 @@ class XLightManager {
         this._scene = this.sceneManager.Scene,
         this._envTexture = null,
         this.shadowLean = .1;
-        const t = new Vector3(this.shadowLean,-1,0)
+        const t = new BABYLON.Vector3(this.shadowLean,-1,0)
           , r = 1024;
-        this._shadowLight = new DirectionalLight("AvatarLight",t,this._scene),
+        this._shadowLight = new BABYLON.DirectionalLight("AvatarLight",t,this._scene),
         this._shadowLight.shadowMaxZ = 5e3,
         this._shadowLight.intensity = 0,
         this.attachLightToCamera(this._shadowLight),
-        this._shadowGenerator = new ShadowGenerator(r,this._shadowLight,!0),
+        this._shadowGenerator = new BABYLON.ShadowGenerator(r,this._shadowLight,!0),
         this._avatarShadowMeshMap = new Map,
         this._cullingShadowObservers = new Map
     }
     set shadowLean(e) {
         e = Math.min(e, 1),
         e = Math.max(e, -1),
-        this._shadowLight && (this._shadowLight.direction = new Vector3(e,-1,0))
+        this._shadowLight && (this._shadowLight.direction = new BABYLON.Vector3(e,-1,0))
     }
     setIBL(e) {
         return new Promise((t,r)=>{
@@ -38,7 +40,7 @@ class XLightManager {
                 this._scene.environmentTexture = this._envTexture,
                 this._envTexture.onLoadObservable.addOnce(()=>{
                     t("env set success"),
-                    log$C.info("env set success")
+                    logger.info("env set success")
                 }
                 )
             }
@@ -50,10 +52,10 @@ class XLightManager {
         )
     }
     disposeIBL() {
-        this._envTexture == null ? log$C.info("env not exist") : (this._envTexture.dispose(),
+        this._envTexture == null ? logger.info("env not exist") : (this._envTexture.dispose(),
         this._envTexture = null,
         this._scene.environmentTexture = null,
-        log$C.info("env dispose success"))
+        logger.info("env dispose success"))
     }
     removeShadow(e) {
         var t;
@@ -113,7 +115,7 @@ class XLightManager {
             const o = this._scene.activeCamera;
             if (o) {
                 const a = t.direction
-                  , s = new Vector3(r * a.x,r * a.y,r * a.z)
+                  , s = new BABYLON.Vector3(r * a.x,r * a.y,r * a.z)
                   , l = o.position;
                 t.position = l.subtract(s)
             }

+ 26 - 27
src/XMaterialComponent.js

@@ -1,8 +1,7 @@
-var EShaderMode = (i=>(i[i.default = 0] = "default",
-i[i.video = 1] = "video",
-i[i.videoAndPano = 2] = "videoAndPano",
-i))(EShaderMode || {});
-class XMaterialComponent {
+import {logger} from "./Logger.js"
+import XVideoRawYUV from "./XVideoRawYUV"
+
+export default class XMaterialComponent {
     constructor(e, t) {
         E(this, "scene");
         E(this, "engine");
@@ -36,12 +35,12 @@ class XMaterialComponent {
         E(this, "_initPureVideoContent", e=>{
             this._inputYUV420 ? this._videoRawYUVTexArray.getVideoYUVTex(0) != null && (this._lowModelShader.setTexture("texture_video", this._videoRawYUVTexArray.getVideoYUVTex(0)),
             this._lowModelShader.setFloat("isYUV", 1),
-            Texture.WhenAllReady([this._videoRawYUVTexArray.getVideoYUVTex(0)], ()=>{
+            BABYLON.Texture.WhenAllReady([this._videoRawYUVTexArray.getVideoYUVTex(0)], ()=>{
                 this._changePureVideoLowModelShaderCanvasSize(e)
             }
             )) : (this._videoElement = e.videoElement,
             this._videoTexture || (this._videoTexture = new VideoTexture("InterVideoTexture",this._videoElement,this.scene,!0,!1)),
-            Texture.WhenAllReady([this._videoTexture], ()=>{
+            BABYLON.Texture.WhenAllReady([this._videoTexture], ()=>{
                 this._changePureVideoLowModelShaderCanvasSize({
                     width: this._videoElement.height,
                     height: this._videoElement.width,
@@ -59,7 +58,7 @@ class XMaterialComponent {
               , r = e.width || 720
               , n = e.height || 1280
               , o = r / (2 * Math.tan(Math.PI * t / 360));
-            (a = this._lowModelShader) == null || a.setVector3("focal_width_height", new Vector3(o,r,n))
+            (a = this._lowModelShader) == null || a.setVector3("focal_width_height", new BABYLON.Vector3(o,r,n))
         }
         );
         E(this, "updateRawYUVData", (e,t,r,n=-1)=>{
@@ -82,7 +81,7 @@ class XMaterialComponent {
                 this._scenemanager.cameraComponent.cameraFovChange(s),
                 this._scenemanager.yuvInfo = s),
                 (o = this._videoRawYUVTexArray.getVideoYUVTex(l)) == null || o.update(e),
-                (a = this._videoRawYUVTexArray.getVideoYUVTex(l)) == null || a.updateSamplingMode(Texture.BILINEAR_SAMPLINGMODE)
+                (a = this._videoRawYUVTexArray.getVideoYUVTex(l)) == null || a.updateSamplingMode(BABYLON.Texture.BILINEAR_SAMPLINGMODE)
             }
         }
         );
@@ -108,19 +107,19 @@ class XMaterialComponent {
             }
             )
         }
-        ).catch(n=>log$v.error(`[Engine] ${n}`)));
+        ).catch(n=>logger.error(`[Engine] ${n}`)));
         E(this, "_initDefaultShader", ()=>{
-            this._defaultShader == null && (this._defaultShader = new GridMaterial("GridShader",this.scene),
+            this._defaultShader == null && (this._defaultShader = new BABYLON.GridMaterial("GridShader",this.scene),
             this._defaultShader.gridRatio = 50,
-            this._defaultShader.lineColor = new Color3(0,0,.5),
+            this._defaultShader.lineColor = new BABYLON.Color3(0,0,.5),
             this._defaultShader.majorUnitFrequency = 1,
-            this._defaultShader.mainColor = new Color3(.6,.6,.6),
+            this._defaultShader.mainColor = new BABYLON.Color3(.6,.6,.6),
             this._defaultShader.backFaceCulling = !1)
         }
         );
         E(this, "_initPureVideoShader", ()=>{
             if (this._lowModelShader == null) {
-                const e = new ShaderMaterial("PureVideoShader",this.scene,{
+                const e = new BABYLON.ShaderMaterial("PureVideoShader",this.scene,{
                     vertexSource: pureVideoVertex,
                     fragmentSource: pureVideoFragment
                 },{
@@ -134,8 +133,8 @@ class XMaterialComponent {
                 e.setTexture("texture_video", null),
                 e.setFloat("isYUV", this._inputYUV420 ? 1 : 0),
                 e.setFloat("fireworkLight", 0),
-                e.setVector3("fireworkLightPosition", new Vector3(0,0,0)),
-                e.setVector3("focal_width_height", new Vector3(772.022491,720,1280)),
+                e.setVector3("fireworkLightPosition", new BABYLON.Vector3(0,0,0)),
+                e.setVector3("focal_width_height", new BABYLON.Vector3(772.022491,720,1280)),
                 e.backFaceCulling = !1,
                 this._lowModelShader = e
             }
@@ -151,14 +150,14 @@ class XMaterialComponent {
         E(this, "initDynamicTexture", (e,t,r)=>{
             this._isInDynamicRange(e) && (this._dynamic_textures[e] != null && (this._dynamic_textures[e].dispose(),
             this._dynamic_textures[e] = null),
-            this._dynamic_textures[e] = new RawTexture(null,t,r * 1.5,Engine.TEXTUREFORMAT_LUMINANCE,this.scene,!1,!0,Texture.NEAREST_SAMPLINGMODE,Engine.TEXTURETYPE_UNSIGNED_BYTE),
+            this._dynamic_textures[e] = new BABYLON.RawTexture(null,t,r * 1.5,BABYLON.Engine.TEXTUREFORMAT_LUMINANCE,this.scene,!1,!0,BABYLON.Texture.NEAREST_SAMPLINGMODE,BABYLON.Engine.TEXTURETYPE_UNSIGNED_BYTE),
             this._dynamic_textures[e].name = "Pano_Dynamic_" + e + "_" + Date.now())
         }
         );
-        E(this, "initDynamicShaders", e=>(log$v.info("[Engine] Material init dynamic shader."),
+        E(this, "initDynamicShaders", e=>(logger.info("[Engine] Material init dynamic shader."),
         new Promise((t,r)=>{
             this._dynamic_shaders[e] != null && this._dynamic_shaders[e].dispose();
-            const n = new ShaderMaterial("Pano_Shader_" + e,this.scene,{
+            const n = new BABYLON.ShaderMaterial("Pano_Shader_" + e,this.scene,{
                 vertexSource: panoVertex,
                 fragmentSource: panoFragment
             },{
@@ -167,13 +166,13 @@ class XMaterialComponent {
                 defines: ["#define SHADOWFULLFLOAT"]
             });
             n.setTexture("texture_pano", null),
-            n.setVector3("centre_pose", new Vector3(0,0,0)),
+            n.setVector3("centre_pose", new BABYLON.Vector3(0,0,0)),
             n.setFloat("isYUV", this._inputPanoYUV420 ? 1 : 0),
             n.setTexture("shadowSampler", null),
             n.setMatrix("lightSpaceMatrix", null),
             n.setFloat("haveShadowLight", 0),
             n.setFloat("fireworkLight", 0),
-            n.setVector3("fireworkLightPosition", new Vector3(0,0,0)),
+            n.setVector3("fireworkLightPosition", new BABYLON.Vector3(0,0,0)),
             n.backFaceCulling = !1,
             this._dynamic_shaders[e] = n,
             t(!0)
@@ -229,9 +228,9 @@ class XMaterialComponent {
         }
     }
     changePanoImg(e, t) {
-        if (log$v.info(`[Engine] changePanoImg, id=${e}, pose=${t.pose.position.x},${t.pose.position.y},${t.pose.position.z}`),
+        if (logger.info(`[Engine] changePanoImg, id=${e}, pose=${t.pose.position.x},${t.pose.position.y},${t.pose.position.z}`),
         !this._isInDynamicRange(e))
-            return log$v.error(`[Engine] ${e} is bigger than dynamic size set in PanoInfo`),
+            return logger.error(`[Engine] ${e} is bigger than dynamic size set in PanoInfo`),
             Promise.reject(new XMaterialError(`[Engine] ${e} is bigger than dynamic size set in PanoInfo`));
         const r = ue4Position2Xverse(t.pose.position);
         return r && (this._dynamic_babylonpose[e] = {
@@ -241,12 +240,12 @@ class XMaterialComponent {
             try {
                 typeof t.data == "string" ? (this.setPanoYUV420(!1),
                 this._dynamic_textures[e].updateURL(t.data, null, ()=>{
-                    this._dynamic_textures[e].updateSamplingMode(Texture.NEAREST_SAMPLINGMODE)
+                    this._dynamic_textures[e].updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE)
                 }
                 )) : (this.isPanoYUV420() == !1 && this.initDynamicTexture(e, this._panoInfo.width, this._panoInfo.height),
                 this.setPanoYUV420(!0),
                 this._dynamic_textures[e].update(t.data),
-                this._dynamic_textures[e].updateSamplingMode(Texture.NEAREST_SAMPLINGMODE)),
+                this._dynamic_textures[e].updateSamplingMode(BABYLON.Texture.NEAREST_SAMPLINGMODE)),
                 n(this)
             } catch (a) {
                 o(new XMaterialError(`[Engine] ChangePanoImg Error! ${a}`))
@@ -288,7 +287,7 @@ class XMaterialComponent {
             }
             );
         else {
-            const h = new PointLight("fireworkLight",new Vector3(0,0,0),this.scene);
+            const h = new BABYLON.PointLight("fireworkLight",new BABYLON.Vector3(0,0,0),this.scene);
             h.intensity = 0
         }
     }
@@ -308,7 +307,7 @@ class XMaterialComponent {
                 }
                 );
             else {
-                const f = new PointLight("fireworkLight",new Vector3(0,0,0),this.scene);
+                const f = new BABYLON.PointLight("fireworkLight",new BABYLON.Vector3(0,0,0),this.scene);
                 f.intensity = 0
             }
     }

+ 1 - 1
src/XParticleManager.js

@@ -60,7 +60,7 @@ class XParticleManager{
         this._scene.getLightByName("fireworkLight"))
             this._light = this._scene.getLightByName("fireworkLight");
         else {
-            const t = new PointLight("fireworkLight",new Vector3(0,0,0),e);
+            const t = new PointLight("fireworkLight",new BABYLON.Vector3(0,0,0),e);
             t.intensity = 0,
             this._light = t
         }

+ 5 - 2
src/XRain.js

@@ -1,4 +1,7 @@
-class XRain extends XSubSequence {
+
+import XSubSequence from "./XSubSequence.js"
+
+export default class XRain extends XSubSequence {
     constructor(e, t, r) {
         super(e, t, r);
         this.onLoadedObserverable.addOnce(()=>{
@@ -9,7 +12,7 @@ class XRain extends XSubSequence {
                       , c = Math.random() * 15 * Math.sin(u)
                       , h = this.minEmitBox.y
                       , f = Math.random() * 15 * Math.cos(u);
-                    Vector3.TransformCoordinatesFromFloatsToRef(c, h, f, a, s)
+                      BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(c, h, f, a, s)
                 }
                 )
             }

+ 27 - 1
src/XSceneManager.js

@@ -3,6 +3,32 @@ import {logger} from "./Logger.js"
 import Logger1 from "./Logger1.js"
 import XCameraComponent from "./XCameraComponent.js"
 import XStaticMeshComponent from "./XStaticMeshComponent.js"
+import XMaterialComponent from "./XMaterialComponent.js"
+import XStats from "./XStats.js"
+import XBreathPointManager from "./XBreathPointManager.js"
+import XDecalManager from "./XDecalManager.js"
+import XAvatarManager from "./XAvatarManager.js"
+import XBillboardManager from "./XBillboardManager.js"
+import XLightManager from "./XLightManager.js"
+import XEngineRunTimeStats from "./XEngineRunTimeStats.js"
+import EShaderMode from "./enum/EShaderMode.js"
+
+
+const getAlphaWidthMap = (i,e)=>{
+    const t = new BABYLON.DynamicTexture("test",3,e)
+      , r = new Map;
+    for (let n = 32; n < 127; n++) {
+        const o = String.fromCodePoint(n)
+          , a = 2 + "px " + i;
+        t.drawText(o, null, null, a, "#000000", "#ffffff", !0);
+        const s = t.getContext();
+        s.font = a;
+        const l = s.measureText(o).width;
+        r.set(n, l)
+    }
+    return t.dispose(),
+    r
+}
 
 export default class XSceneManager {
     constructor(e, t) {
@@ -402,7 +428,7 @@ export default class XSceneManager {
         this._lightManager.setIBL(e)
     }
     postprocessing() {
-        const e = new DefaultRenderingPipeline("default",!0,this.scene);
+        const e = new BABYLON.DefaultRenderingPipeline("default",!0,this.scene);
         e.imageProcessingEnabled = !1,
         e.bloomEnabled = !0,
         e.bloomThreshold = 1,

+ 5 - 5
src/XSequence.js

@@ -178,9 +178,9 @@ class XSubSequence {
                 o.value instanceof Array) {
                     const a = {
                         frame: o.frame,
-                        value: new Vector3(0,0,0)
+                        value: new BABYLON.Vector3(0,0,0)
                     }
-                      , s = new Vector3(o.value[0],o.value[1],o.value[2]);
+                      , s = new BABYLON.Vector3(o.value[0],o.value[1],o.value[2]);
                     a.value = s,
                     t.push(a)
                 } else
@@ -417,7 +417,7 @@ class XSubSequence {
     setPositionVector(e) {
         this._centerNode.position = e,
         this._particleGroups.forEach(t=>{
-            t.emitterNode == null || t.emitterNode instanceof Vector3 ? t.emitterNode = e : this._scene.getMeshByName(t.emitterNode.name) || (t.emitterNode = e)
+            t.emitterNode == null || t.emitterNode instanceof BABYLON.Vector3 ? t.emitterNode = e : this._scene.getMeshByName(t.emitterNode.name) || (t.emitterNode = e)
         }
         ),
         this._spriteGroups.forEach(t=>{
@@ -609,7 +609,7 @@ class XSubSequence {
                     t();
                     return
                 }
-                SceneLoader.LoadAssetContainer("", o, this._scene, a=>{
+                BABYLON.SceneLoader.LoadAssetContainer("", o, this._scene, a=>{
                     if (this._isDisposing) {
                         a.removeAllFromScene(),
                         t();
@@ -788,7 +788,7 @@ class XSubSequence {
         e.meshName.forEach(r=>{
             const n = this._scene.getMeshByName(r);
             if (n != null) {
-                const o = new Color3(e.color[0],e.color[1],e.color[2]);
+                const o = new BABYLON.Color3(e.color[0],e.color[1],e.color[2]);
                 t.addMesh(n, o)
             }
         }

+ 10 - 8
src/XStateMachine.js

@@ -1,4 +1,6 @@
-const log$G = new Logger$1("XStateMachine");
+//const log$G = new Logger$1("XStateMachine");
+import {logger} from "./Logger.js"
+
 class XStateMachine {
     constructor(e) {
         E(this, "state");
@@ -16,7 +18,7 @@ class XStateMachine {
             if (r && e.setRotation(r),
             t == r)
                 return o();
-            e.priority === 0 && log$G.info(`avatar ${e.id} starts to rotate from ${r} to ${t}`);
+            e.priority === 0 && logger.info(`avatar ${e.id} starts to rotate from ${r} to ${t}`);
             let l = 0;
             const u = 1e3 / 25
               , c = calcDistance3DAngle(t, e.rotation) / u;
@@ -28,7 +30,7 @@ class XStateMachine {
                     if (!e.rootNode)
                         return e.setRotation(t),
                         o();
-                    const d = Vector3.Lerp(e.rootNode.rotation, ue4Rotation2Xverse(t), l);
+                    const d = BABYLON.Vector3.Lerp(e.rootNode.rotation, ue4Rotation2Xverse(t), l);
                     e.setRotation(xverseRotation2Ue4(d)),
                     l += u / (c * 1e3)
                 } else
@@ -53,7 +55,7 @@ class XStateMachine {
         return new Promise((s,l)=>{
             var m;
             const u = e.avatarManager.scene;
-            e.priority === 0 && log$G.info(`avatar ${e.id} starts to move from ${t} to ${r}`);
+            e.priority === 0 && logger.info(`avatar ${e.id} starts to move from ${t} to ${r}`);
             let c = 0;
             a ? a = a.concat(r) : a = [r],
             a = this._filterPathPoint(a);
@@ -77,7 +79,7 @@ class XStateMachine {
             this._movingObserver = u == null ? void 0 : u.onBeforeRenderObservable.add(()=>{
                 var v;
                 if (c < 1) {
-                    const y = Vector3.Lerp(ue4Position2Xverse(h), ue4Position2Xverse(f), c);
+                    const y = BABYLON.Vector3.Lerp(ue4Position2Xverse(h), ue4Position2Xverse(f), c);
                     if (e.setPosition(xversePosition2Ue4(y)),
                     !e.rootNode)
                         return e.setPosition(r),
@@ -111,7 +113,7 @@ class XStateMachine {
             var _, g;
             const o = ue4Position2Xverse(t)
               , s = e.rootNode.position.subtract(o).length()
-              , l = new Vector3(s * Math.sin(e.rootNode.rotation.y),0,s * Math.cos(e.rootNode.rotation.y))
+              , l = new BABYLON.Vector3(s * Math.sin(e.rootNode.rotation.y),0,s * Math.cos(e.rootNode.rotation.y))
               , u = (_ = e.rootNode) == null ? void 0 : _.position.add(l);
             let c = 0;
             const h = r || 1 / 100
@@ -120,7 +122,7 @@ class XStateMachine {
                 var y, b;
                 const m = (y = e.controller) == null ? void 0 : y.animations.find(T=>T.name == "Idle");
                 (m == null ? void 0 : m.isPlaying) != !0 && (m == null || m.play());
-                const v = Vector3.Lerp(u, o, c);
+                const v = BABYLON.Vector3.Lerp(u, o, c);
                 c < 1 ? ((b = e.rootNode) == null || b.lookAt(v),
                 c += h) : (d && f.onBeforeRenderObservable.remove(d),
                 n())
@@ -155,7 +157,7 @@ class XStateMachine {
                     r.loaded || (T && c.onBeforeRenderObservable.remove(T),
                     s());
                     const C = ue4Position2Xverse(t.position)
-                      , A = new Vector3((C.x - b.x) * f,m,(C.z - b.z) * f);
+                      , A = new BABYLON.Vector3((C.x - b.x) * f,m,(C.z - b.z) * f);
                     m = m - g,
                     h < 1 ? (v = v.add(A),
                     r.setPositionVector(v.add(y)),

+ 10 - 7
src/XStaticMesh.js

@@ -1,5 +1,8 @@
-const log$z = new Logger$1("XStaticMesh");
-class XStaticMesh {
+//const log$z = new Logger$1("XStaticMesh");
+import {logger} from "./Logger.js"
+import EMeshType from "./enum/EMeshType.js"
+
+export default class XStaticMesh {
     constructor({id: e, mesh: t, group: r="default", lod: n=0, xtype: o=EMeshType.XStaticMesh, skinInfo: a="default", url: s=""}) {
         E(this, "_mesh");
         E(this, "_id", "-1");
@@ -68,11 +71,11 @@ class XStaticMesh {
             e && l ? (e.setParent(l),
             e.position = s,
             e.rotation = a,
-            e.scaling = o) : log$z.error("[Engine] avatar or attachment not found!")
+            e.scaling = o) : logger.error("[Engine] avatar or attachment not found!")
         }
         );
         E(this, "detachFromAvatar", (e,t=!1)=>{
-            this._mesh && e ? this._mesh.removeChild(e) : log$z.error("[Engine] avatar not found!")
+            this._mesh && e ? this._mesh.removeChild(e) : logger.error("[Engine] avatar not found!")
         }
         );
         this._id = e,
@@ -142,14 +145,14 @@ class XStaticMesh {
             const t = ue4Position2Xverse(e);
             this._mesh.position = t
         } else
-            log$z.error("[Engine] no root for positioning")
+            logger.error("[Engine] no root for positioning")
     }
     setRotation(e) {
         const t = ue4Rotation2Xverse_mesh(e);
-        this._mesh ? this._mesh.rotation = t : log$z.error("[Engine] no root for rotating")
+        this._mesh ? this._mesh.rotation = t : logger.error("[Engine] no root for rotating")
     }
     setScale(e) {
-        this._mesh ? this._mesh.scaling = new Vector3(e,e,-e) : log$z.error("[Engine] no root for scaling")
+        this._mesh ? this._mesh.scaling = new BABYLON.Vector3(e,e,-e) : logger.error("[Engine] no root for scaling")
     }
     disableAvatar() {
         var e;

+ 6 - 3
src/XStaticMeshComponent.js

@@ -1,6 +1,9 @@
 //const log$u = new Logger$1("XStaticMeshComponent")
-
 import {logger} from "./Logger.js"
+import XStaticMesh from "./XStaticMesh.js"
+import EMeshType from "./enum/EMeshType.js"
+import XStaticMeshFromOneGltf from "./XStaticMeshFromOneGltf.js"
+import XLowpolyModelError from "./error/XLowpolyModelError.js"
 
 export default class XStaticMeshComponent{
     constructor(e) {
@@ -442,8 +445,8 @@ export default class XStaticMeshComponent{
         const e = BABYLON.MeshBuilder.CreatePlane("CgPlane", {
             size: 400
         });
-        e.position = new Vector3(0,1010,0),
-        e.rotation = new Vector3(3 * Math.PI / 2,0,0),
+        e.position = new BABYLON.Vector3(0,1010,0),
+        e.rotation = new BABYLON.Vector3(3 * Math.PI / 2,0,0),
         this._CgPlane = new XStaticMesh({
             id: "CgPlane",
             mesh: e,

+ 10 - 4
src/XStaticMeshFromOneGltf.js

@@ -1,4 +1,10 @@
-class XStaticMeshFromOneGltf {
+import {logger} from "./Logger.js"
+import XStaticMesh from "./XStaticMesh.js"
+import XLowpolyModelError from "./error/XLowpolyModelError.js"
+import util from "./util.js"
+import EMeshType from "./enum/EMeshType.js"
+
+export default class XStaticMeshFromOneGltf {
     constructor(e, t) {
         E(this, "_scene");
         E(this, "_url");
@@ -14,7 +20,7 @@ class XStaticMeshFromOneGltf {
             const r = this._meshes.length
               , n = t ? 1 : 0
               , o = this._url;
-            return SceneLoader.LoadAssetContainerAsync("", o, this._scene, ()=>{
+            return BABYLON.SceneLoader.LoadAssetContainerAsync("", o, this._scene, ()=>{
                 this._scene.blockMaterialDirtyMechanism = !0
             }
             , ".glb").then(a=>{
@@ -50,7 +56,7 @@ class XStaticMeshFromOneGltf {
                 return Promise.resolve(!0)
             }
             ).catch(a=>{
-                log$u.error("[Engine] input gltf mesh uri error! " + a),
+                logger.error("[Engine] input gltf mesh uri error! " + a),
                 Promise.reject(new XLowpolyModelError("[Engine] input gltf mesh uri error! " + a))
             }
             )
@@ -64,7 +70,7 @@ class XStaticMeshFromOneGltf {
         t.id != null ? this._id = t.id : this._id = "default",
         t.lod != null ? this._lod = t.lod : this._lod = -1,
         t.skinInfo != null ? this._skinInfo = t.skinInfo : this._skinInfo = "default",
-        this._groupUuid = uuid$2(),
+        this._groupUuid = util.uuid(),
         this._isInScene = !1
     }
     get isinscene() {

+ 3 - 3
src/XStats.js

@@ -1,4 +1,4 @@
-class XStats {
+export default class XStats {
     constructor(e) {
         E(this, "scene");
         E(this, "sceneInstrumentation");
@@ -14,7 +14,7 @@ class XStats {
         this.initSceneInstrument()
     }
     initSceneInstrument() {
-        this.sceneInstrumentation = new SceneInstrumentation(this.scene),
+        this.sceneInstrumentation = new BABYLON.SceneInstrumentation(this.scene),
         this.sceneInstrumentation.captureCameraRenderTime = !0,
         this.sceneInstrumentation.captureActiveMeshesEvaluationTime = !0,
         this.sceneInstrumentation.captureRenderTargetsRenderTime = !0,
@@ -25,7 +25,7 @@ class XStats {
         this.sceneInstrumentation.captureSpritesRenderTime = !0,
         this.sceneInstrumentation.capturePhysicsTime = !0,
         this.sceneInstrumentation.captureAnimationsTime = !0,
-        this.engineInstrumentation = new EngineInstrumentation(this.scene.getEngine()),
+        this.engineInstrumentation = new BABYLON.EngineInstrumentation(this.scene.getEngine()),
         this.caps = this.scene.getEngine().getCaps(),
         this.engine = this.scene.getEngine(),
         this._osversion = this.osVersion()

+ 32 - 32
src/XTelevision.js

@@ -1,9 +1,9 @@
-const log$y = new Logger$1("XTelevision");
-var EFitMode = (i=>(i.fill = "fill",
-i.contain = "contain",
-i.cover = "cover",
-i))(EFitMode || {});
-class XTelevision {
+//const log$y = new Logger$1("XTelevision");
+import {logger} from "./Logger.js"
+import XStaticMesh from "./XStaticMesh.js"
+import EMeshType from "./enum/EMeshType.js"
+
+export default class XTelevision {
     constructor(e, t, r, n) {
         E(this, "videoElement");
         E(this, "meshPath");
@@ -53,7 +53,7 @@ class XTelevision {
     async setUrl(e) {
         const {url: t, isLive: r=!1, poster: n=null, bLoop: o=!1, bMuted: a=!0} = e || {};
         if (typeof t != "string")
-            return log$y.error("[Engine] Tv setUrl Error, url must be string: ", t),
+            return logger.error("[Engine] Tv setUrl Error, url must be string: ", t),
             Promise.reject(new XTvMediaUrlError("[Engine] url must be string"));
         if (this.videoElement) {
             this.videoElement.src = t,
@@ -80,19 +80,19 @@ class XTelevision {
             )
         }
         ).catch(l=>{
-            log$y.error("[Engine] setUrl  error! " + l),
+            logger.error("[Engine] setUrl  error! " + l),
             new XTvMediaUrlError("[Engine] setUrl  error! " + l)
         }
         )
     }
     setCurrentTime(e) {
         if (!this.videoElement) {
-            log$y.warn("[Engine] The television is not been initialize succesfully");
+            logger.warn("[Engine] The television is not been initialize succesfully");
             return
         }
         const {currentTime: t} = e;
         if (typeof t != "number") {
-            log$y.warn("[Engine] video currentTime must be number");
+            logger.warn("[Engine] video currentTime must be number");
             return
         }
         this.videoElement.currentTime = t / 1e3
@@ -101,17 +101,17 @@ class XTelevision {
         return this.videoElement ? this.videoElement.currentTime * 1e3 : -1
     }
     play() {
-        return log$y.info("[Engine] Play television"),
+        return logger.info("[Engine] Play television"),
         this.toggle(!0),
         this.videoElement ? this.videoElement.play() : Promise.resolve()
     }
     pause() {
         var e;
-        return log$y.info("[Engine] Pause television"),
+        return logger.info("[Engine] Pause television"),
         (e = this.videoElement) == null ? void 0 : e.pause()
     }
     stop() {
-        log$y.info("[Engine] Stop television"),
+        logger.info("[Engine] Stop television"),
         this.pause(),
         setTimeout(()=>{
             this.setCurrentTime({
@@ -122,7 +122,7 @@ class XTelevision {
         this.toggle(!1)
     }
     toggle(e) {
-        log$y.info(`[Engine] Set Tv visibility = ${e}`);
+        logger.info(`[Engine] Set Tv visibility = ${e}`);
         for (let t = 0; t < this.tvMeshs.length; ++t)
             e == !0 ? this.tvMeshs[t].show() : this.tvMeshs[t].hide()
     }
@@ -137,10 +137,10 @@ class XTelevision {
         this.videoMat.setFloat("bforceforceKeepContent", -1)) : this.videoMat.setFloat("tvWidthHeightScale", -1)
     }
     async setVideo(e, t=!1, r=!0) {
-        return this.tvMeshs.length != 0 ? (log$y.warn(`[Engine] Set Video. length!=0, mesh: ${this.meshPath}, src: ${e.src}`),
+        return this.tvMeshs.length != 0 ? (logger.warn(`[Engine] Set Video. length!=0, mesh: ${this.meshPath}, src: ${e.src}`),
         new Promise((n,o)=>{
             if (!(e instanceof HTMLVideoElement))
-                return log$y.error("[Engine] Error, param of setVideo must be a HTMLVideoElement"),
+                return logger.error("[Engine] Error, param of setVideo must be a HTMLVideoElement"),
                 o(new XTvVideoElementError("[Engine] param of setVideo must be a HTMLVideoElement"));
             this.videoElement = e,
             r == !1 && (t == !1 || checkOS().isIOS) && e.crossOrigin !== "anonymous" && (e.crossOrigin = "anonymous",
@@ -152,12 +152,12 @@ class XTelevision {
             this.videoTexture.updateURL(this.videoElement.src),
             n(this)
         }
-        )) : (log$y.warn(`[Engine] Set Video. length==0, mesh: ${this.meshPath}, src: ${e.src}`),
-        this.meshPath == "" ? (log$y.error("[Engine] Error, television meshPath is empty."),
+        )) : (logger.warn(`[Engine] Set Video. length==0, mesh: ${this.meshPath}, src: ${e.src}`),
+        this.meshPath == "" ? (logger.error("[Engine] Error, television meshPath is empty."),
         Promise.reject(new XTvVideoElementError("[Engine] Error, television meshPath is empty."))) : this._scenemanager.urlTransformer(this.meshPath).then(n=>new Promise((o,a)=>e instanceof HTMLVideoElement ? (this.videoElement = e,
         r == !1 && (t == !1 || checkOS().isIOS) && e.crossOrigin !== "anonymous" && (e.crossOrigin = "anonymous",
         e.load()),
-        SceneLoader.LoadAssetContainerAsync("", n, this.scene, null, ".glb").then(s=>{
+        BABYLON.SceneLoader.LoadAssetContainerAsync("", n, this.scene, null, ".glb").then(s=>{
             for (let u = s.materials.length - 1; u >= 0; --u)
                 s.materials[u].dispose();
             const l = [];
@@ -202,14 +202,14 @@ class XTelevision {
             o(this)
         }
         ).catch(s=>{
-            log$y.error("[Engine] setVideo: create Tv by input mesh error! " + s),
+            logger.error("[Engine] setVideo: create Tv by input mesh error! " + s),
             a(new XTvModelError("[Engine] setVideo: create Tv by input mesh error! " + s))
         }
         )) : a(new XTvVideoElementError("[Engine] param of setVideo must be a HTMLVideoElement")))))
     }
     async setSameVideo(e, t="") {
-        return e == null || e == null ? (log$y.error("[Engine] setSameVideo: input material is null or undefined "),
-        Promise.reject(new XTvModelError("[Engine] setSameVideo input material is null or undefined !"))) : this.tvMeshs.length != 0 && t == "" ? (log$y.warn(`[Engine] Set mirror video. length!=0, mesh: ${this.meshPath}`),
+        return e == null || e == null ? (logger.error("[Engine] setSameVideo: input material is null or undefined "),
+        Promise.reject(new XTvModelError("[Engine] setSameVideo input material is null or undefined !"))) : this.tvMeshs.length != 0 && t == "" ? (logger.warn(`[Engine] Set mirror video. length!=0, mesh: ${this.meshPath}`),
         new Promise((r,n)=>{
             try {
                 this.videoMat = e,
@@ -220,17 +220,17 @@ class XTelevision {
                 this.changeTvFitMode(),
                 r(this)
             } catch (o) {
-                log$y.error("[Engine] setSameVideo: create Tv by input mesh error! " + o),
+                logger.error("[Engine] setSameVideo: create Tv by input mesh error! " + o),
                 n(new XTvModelError("[Engine] create Tv by input mesh error! " + o))
             }
         }
         )) : (t != "" && (this.meshPath = t,
         this.widthHeightScale = -1),
-        this.meshPath == "" ? (log$y.error("[Engine] Error, setSameVideo television meshPath is empty."),
-        Promise.reject(new XTvVideoElementError("[Engine] Error, setSameVideo television meshPath is empty."))) : (log$y.warn(`[Engine] Set mirror video. length==0, mesh: ${this.meshPath}`),
+        this.meshPath == "" ? (logger.error("[Engine] Error, setSameVideo television meshPath is empty."),
+        Promise.reject(new XTvVideoElementError("[Engine] Error, setSameVideo television meshPath is empty."))) : (logger.warn(`[Engine] Set mirror video. length==0, mesh: ${this.meshPath}`),
         this._scenemanager.urlTransformer(this.meshPath).then(r=>new Promise((n,o)=>(this.videoMat = e,
         e != null && e.getActiveTextures()[0] && (this.videoElement = e == null ? void 0 : e.getActiveTextures()[0].video),
-        SceneLoader.LoadAssetContainerAsync("", r, this.scene, null, ".glb").then(a=>{
+        BABYLON.SceneLoader.LoadAssetContainerAsync("", r, this.scene, null, ".glb").then(a=>{
             for (let l = a.materials.length - 1; l >= 0; --l)
                 a.materials[l].dispose();
             const s = [];
@@ -252,7 +252,7 @@ class XTelevision {
             n(this)
         }
         ).catch(a=>{
-            log$y.error("[Engine] setSameVideo: create Tv by input mesh error! " + a),
+            logger.error("[Engine] setSameVideo: create Tv by input mesh error! " + a),
             o(new XTvModelError("[Engine] create Tv by input mesh error! " + a))
         }
         ))))))
@@ -260,9 +260,9 @@ class XTelevision {
     async changeTvModel(e="") {
         return e != "" && (this.meshPath = e,
         this.widthHeightScale = -1),
-        this.meshPath == "" ? (log$y.error("[Engine] Error,changeTvModel television meshPath is empty."),
-        Promise.reject(new XTvVideoElementError("[Engine] Error, changeTvModel television meshPath is empty."))) : this.videoMat == null || this.videoMat == null ? (log$y.error("[Engine] changeTvModel: videoMat is null or undefined! "),
-        Promise.reject(new XTvModelError("[Engine] changeTvModel: videoMat is null or undefined!"))) : this._scenemanager.urlTransformer(this.meshPath).then(t=>new Promise((r,n)=>SceneLoader.LoadAssetContainerAsync("", t, this.scene, null, ".glb").then(o=>{
+        this.meshPath == "" ? (logger.error("[Engine] Error,changeTvModel television meshPath is empty."),
+        Promise.reject(new XTvVideoElementError("[Engine] Error, changeTvModel television meshPath is empty."))) : this.videoMat == null || this.videoMat == null ? (logger.error("[Engine] changeTvModel: videoMat is null or undefined! "),
+        Promise.reject(new XTvModelError("[Engine] changeTvModel: videoMat is null or undefined!"))) : this._scenemanager.urlTransformer(this.meshPath).then(t=>new Promise((r,n)=>BABYLON.SceneLoader.LoadAssetContainerAsync("", t, this.scene, null, ".glb").then(o=>{
             for (let s = o.materials.length - 1; s >= 0; --s)
                 o.materials[s].dispose();
             const a = [];
@@ -284,7 +284,7 @@ class XTelevision {
             r(this)
         }
         ).catch(o=>{
-            log$y.error("[Engine] changeTvModel: create Tv by input mesh error! " + o),
+            logger.error("[Engine] changeTvModel: create Tv by input mesh error! " + o),
             n(new XTvModelError("[Engine] changeTvModel: create Tv by input mesh error! " + o))
         }
         )))
@@ -310,7 +310,7 @@ class XTelevision {
         return Math.sqrt(r * r + o * o) / Math.abs(n)
     }
     cleanTv(e=!1, t=!0) {
-        log$y.warn("[Engine] cleanTV");
+        logger.warn("[Engine] cleanTV");
         for (let r = 0; r < this.tvMeshs.length; ++r)
             this.tvMeshs[r].dispose(e, t);
         this.tvMeshs = [],

+ 2 - 2
src/XVideoRawYUV.js

@@ -1,4 +1,4 @@
-class XVideoRawYUV {
+export default class XVideoRawYUV {
     constructor(e, t) {
         E(this, "scene");
         E(this, "_videoRawYUVTexture");
@@ -10,7 +10,7 @@ class XVideoRawYUV {
         this._currentVideoId = -1;
         for (let r = 0; r < t.length; ++r)
             (n=>{
-                const o = RawTexture.CreateLuminanceTexture(null, t[n].width, t[n].height * 1.5, this.scene, !1, !0);
+                const o = BABYLON.RawTexture.CreateLuminanceTexture(null, t[n].width, t[n].height * 1.5, this.scene, !1, !0);
                 o.name = "videoTex_" + t[n].width + "_" + t[n].height,
                 this._videoRawYUVTexture.push(o)
             }

+ 1 - 0
src/XverseAvatarManager.js

@@ -4,6 +4,7 @@ import CoreBroadcastType from "./enum/CoreBroadcastType.js"
 import AvatarGroup from "./enum/AvatarGroup.js"
 import Broadcast from "./Broadcast.js"
 import TimeoutError from "./error/TimeoutError.js"
+import {avatarLoader} from "./XAvatarLoader.js"
 
 export default class XverseAvatarManager extends EventEmitter {
     constructor(e) {

+ 6 - 0
src/enum/BillboardStatus.js

@@ -0,0 +1,6 @@
+var BillboardStatus = {
+    SHOW:1,
+    HIDE:0,
+    DISPOSE:-1
+}
+export default BillboardStatus

+ 6 - 0
src/enum/EFitMode.js

@@ -0,0 +1,6 @@
+var EFitMode = {
+    fill:'fill',
+    contain:'contain',
+    cover:'cover'
+}
+export default EFitMode

+ 11 - 0
src/enum/EMeshType.js

@@ -0,0 +1,11 @@
+var EMeshType = {
+    XAvatar:'XAvatar',
+    XStaticMesh:'XStaticMesh',
+    XBreathPoint:'breathpoint',
+    Decal:'decal',
+    Cgplane:'cgplane',
+    Tv:'tv',
+    XSubSequence:'XSubSequence',
+    XBillboard:'XBillboard',
+}
+export default EMeshType