zhouenguang 3 년 전
부모
커밋
1ea69c3d07

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 233 - 233
dist/assets/config.json


BIN
dist/assets/textures/Light_tex0.png


BIN
dist/assets/textures/Light_tex1.png


BIN
dist/assets/textures/Light_tex2.png


BIN
dist/assets/textures/NM_Door.png


BIN
dist/assets/textures/Point_Light.png


BIN
dist/assets/textures/VS_Disco.png


BIN
dist/assets/textures/billboard/bubble01.png


BIN
dist/assets/textures/billboard/bubble01_npc.png


BIN
dist/assets/textures/billboard/bubble02.png


BIN
dist/assets/textures/billboard/bubble02_npc.png


BIN
dist/assets/textures/billboard/bubble03.png


BIN
dist/assets/textures/billboard/bubble03_npc.png


dist/assets/breathPoint/texture.png → dist/assets/textures/breathPoint/texture.png


+ 1 - 1
src/XBillboardManager.js

@@ -1,4 +1,4 @@
-const texRootDir = "https://app-asset-1258211750.file.myqcloud.com/1/textures/"
+const texRootDir = "./assets/textures/billboard/"
 
 import BillboardStatus from "./enum/BillboardStatus.js"
 import Pool from "./Pool.js"

+ 86 - 80
src/XBreathPointManager.js

@@ -12,10 +12,10 @@ export default class XBreathPointManager {
         E(this, "_sceneManager");
         E(this, "_allIds", new Set);
         E(this, "_loopBPKeys", []);
-        E(this, "addBreathPoint", async e=>{
+        E(this, "addBreathPoint", async info=>{
             const t = [{
-                url: "https://static.xverse.cn/qqktv/texture.png"
-                // url: "./assets/breathPoint/texture.png"
+                // url: "https://static.xverse.cn/qqktv/texture.png"
+                url: "./assets/textures/breathPoint/texture.png"
             }];
             if (t.length <= 0) {
                 logger.warn("[Engine] BreathPoint get texture list error: textureList.length <= 0"),
@@ -23,101 +23,107 @@ export default class XBreathPointManager {
                 return
             }
             const r = t[0]
-              , {id: n, spriteSheet: o=r.url, spriteWidthNumber: a=20, spriteHeightNumber: s=1, position: l, rotation: u={
-                pitch: -90,
-                yaw: 270,
-                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)) {
-                logger.warn("[Engine] Cannot add breathPoint with an existing id: [" + n + "]"),
-                new XBreathPointError("[Engine] Cannot add breathPoint with an existing id: [" + n + "]");
+              , {
+                id, spriteSheet=r.url, spriteWidthNumber=20, spriteHeightNumber=1, position, rotation={ pitch: -90, yaw: 270, roll: 0 }, 
+                size=.6, width=-1, height=-1, fps=30, billboardMode=!1, forceLeaveGround=!1, type="default", lifeTime=-1, backfaceculling=!0, 
+                maxVisibleRegion=-1, skinInfo="default"
+            } = info;
+
+            if (this.breathPoints.get(id)) {
+                logger.warn("[Engine] Cannot add breathPoint with an existing id: [" + id + "]"),
+                new XBreathPointError("[Engine] Cannot add breathPoint with an existing id: [" + id + "]");
                 return
             }
-            if (g) {
-                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
+            if (forceLeaveGround) {
+                const I = this.castRay(new BABYLON.Vector3(position.x, position.y, position.z)) * scaleFromUE4toXverse;
+                I != 0 ? position.z = position.z - I + 1 : position.z = position.z + 1
             }
-            let C;
-            if (this.materialMap.get(m)) {
-                const I = this.materialMap.get(m);
+
+            let mat;
+            if (this.materialMap.get(type)) {
+                const I = this.materialMap.get(type);
                 I.count = I.count + 1,
-                C = I.mat
+                mat = I.mat
             } else {
-                const I = new BABYLON.Texture(o,this._scene,!0,!0,BABYLON.Texture.BILINEAR_SAMPLINGMODE,null,()=>{
+                const texture = new BABYLON.Texture(spriteSheet, this._scene, !0, !0, BABYLON.Texture.BILINEAR_SAMPLINGMODE, null, ()=>{
                     logger.error("[Engine] Breathpoint create texture error."),
                     new XBreathPointError("[Engine] Breathpoint create texture error.")
-                }
-                ,null,!0);
-                I.name = "TexBreathPoint_" + n,
-                C = new BABYLON.StandardMaterial(`MaterialBreathPoint_${n}`,this._scene),
-                C.alpha = 1,
-                C.emissiveTexture = I,
-                C.backFaceCulling = y,
-                C.diffuseTexture = I,
-                C.diffuseTexture.hasAlpha = !0,
-                C.useAlphaFromDiffuseTexture = !0,
-                this.materialMap.set(m, {
-                    mat: C,
+                } ,null, !0);
+                texture.name = "TexBreathPoint_" + id,
+
+                mat = new BABYLON.StandardMaterial(`MaterialBreathPoint_${id}`,this._scene),
+                mat.alpha = 1,
+                mat.emissiveTexture = texture,
+                mat.backFaceCulling = backfaceculling,
+                mat.diffuseTexture = texture,
+                mat.diffuseTexture.hasAlpha = !0,
+                mat.useAlphaFromDiffuseTexture = !0,
+                this.materialMap.set(type, {
+                    mat,
                     count: 1,
                     lastRenderTime: Date.now(),
-                    fps: d,
-                    spriteWidthNumber: a,
-                    spriteHeightNumber: s,
-                    spriteSheet: o,
-                    texture: I
+                    fps,
+                    spriteWidthNumber,
+                    spriteHeightNumber,
+                    spriteSheet,
+                    texture
                 })
             }
-            const A = new Array(6);
-            for (let I = 0; I < 6; I++)
-                A[I] = new BABYLON.Vector4(0,0,0,0);
-            A[0] = new BABYLON.Vector4(0,0,1 / a,1 / s),
-            A[1] = new BABYLON.Vector4(0,0,1 / a,1 / s);
-            let S = {};
-            h > 0 && f > 0 ? S = {
-                width: h,
-                height: f,
+
+            const faceUV = new Array(6);
+            for (let i = 0; i < 6; i++) faceUV[i] = new BABYLON.Vector4(0,0,0,0);
+            faceUV[0] = new BABYLON.Vector4(0, 0, 1 / spriteWidthNumber, 1 / spriteHeightNumber),
+            faceUV[1] = new BABYLON.Vector4(0, 0, 1 / spriteWidthNumber, 1 / spriteHeightNumber);
+
+            let options = {};
+            width > 0 && height > 0 ? options = {
+                width,
+                height,
                 depth: .01,
-                faceUV: A
-            } : S = {
-                size: c,
+                faceUV
+            } : options = {
+                size,
                 depth: .01,
-                faceUV: A
+                faceUV
             };
-            const P = BABYLON.MeshBuilder.CreateBox(n, S, this._scene);
-            P.material = C;
-            const R = new XStaticMesh({
-                id: n,
-                mesh: P,
+
+            const mesh = BABYLON.MeshBuilder.CreateBox(id, options, this._scene);
+            mesh.material = mat;
+            const xMesh = new XStaticMesh({
+                id,
+                mesh,
                 xtype: EMeshType.XBreathPoint,
-                skinInfo: T
+                skinInfo
             });
-            let M = u;
-            _ && (P.billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL,
-            R.allowMove(),
-            M = {
-                pitch: 0,
-                yaw: 270,
-                roll: 0
-            });
-            const x = new BreathPoint({
-                type: m,
-                mesh: R,
-                id: n,
-                position: l,
-                rotation: M,
-                mat: C,
-                maxVisibleRegion: b,
+            
+            let rota = rotation;
+            billboardMode && (
+                mesh.billboardMode = BABYLON.Mesh.BILLBOARDMODE_ALL,
+                xMesh.allowMove(),
+                rota = {
+                    pitch: 0,
+                    yaw: 270,
+                    roll: 0
+                }
+            );
+            const breathPoint = new BreathPoint({
+                type,
+                mesh: xMesh,
+                id,
+                position,
+                rotation: rota,
+                mat,
+                maxVisibleRegion,
                 scene: this._scene,
-                skinInfo: T
+                skinInfo
             });
-            this.breathPoints.set(n, x),
-            this._allIds.add(n),
-            v > 0 && setTimeout(()=>{
-                this.clearBreathPoints(n)
-            }
-            , v * 1e3)
-        }
-        );
+            this.breathPoints.set(id, breathPoint),
+            this._allIds.add(id),
+            lifeTime > 0 && setTimeout(()=>{
+                this.clearBreathPoints(id)
+            }, lifeTime * 1e3)
+        });
+
         E(this, "reg_breathpoint_update", ()=>{
             const e = new Date().getTime();
             if (this.materialMap != null)