浏览代码

呼吸点

zhouenguang 3 年之前
父节点
当前提交
727c8406d1
共有 2 个文件被更改,包括 19 次插入37 次删除
  1. 1 1
      dist/index.html
  2. 18 36
      src/XBreathPointManager.js

+ 1 - 1
dist/index.html

@@ -58,7 +58,7 @@
     <script src="./libs/decoder.js"></script>
     <script src="./libs/nipplejs.min.js"></script>
     <script src="./shader.js"></script>
-    <!-- <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.js"></script> -->
+    <script src="https://unpkg.com/vconsole@latest/dist/vconsole.min.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" />

+ 18 - 36
src/XBreathPointManager.js

@@ -54,12 +54,12 @@ export default class XBreathPointManager {
             // if(pointsArr1.indexOf(parseInt(id)) > -1) type = "p1"
             // if(pointsArr2.indexOf(parseInt(id)) > -1) type = "p2"
             // if(pointsArr3.indexOf(parseInt(id)) > -1) type = "p3"
-            if(pointsArr3.indexOf(parseInt(id)) > -1) {
-                type = "p3"
-            }
-            else{
-                type = "p1"
-            }
+            // if(pointsArr3.indexOf(parseInt(id)) > -1) {
+            //     type = "p3"
+            // }
+            // else{
+            //     type = "p1"
+            // }
 
             let mat;
             if (this.materialMap.get(type)) {
@@ -74,17 +74,16 @@ export default class XBreathPointManager {
                 texture.name = "TexBreathPoint_" + id,
 
                 mat = new BABYLON.StandardMaterial(`MaterialBreathPoint_${id}`,this._scene)
-                // todo 暂改
-                // mat.alpha = 1,
-                // mat.emissiveTexture = texture,
-                // mat.backFaceCulling = backfaceculling,
-                // mat.diffuseTexture = texture,
-                // mat.diffuseTexture.hasAlpha = !0,
-                // mat.useAlphaFromDiffuseTexture = !0,
-                if(type == "p1") mat.emissiveColor.set(1,1,1)
-                else if(type == "p2") mat.emissiveColor.set(1,1,0.5)
-                else if(type == "p3") mat.emissiveColor.set(1,0.5,0)
-                else mat.emissiveColor.set(1,0,0)
+                mat.alpha = 1,
+                mat.emissiveTexture = texture,
+                mat.backFaceCulling = backfaceculling,
+                mat.diffuseTexture = texture,
+                mat.diffuseTexture.hasAlpha = !0,
+                mat.useAlphaFromDiffuseTexture = !0,
+                // if(type == "p1") mat.emissiveColor.set(1,1,1)
+                // else if(type == "p2") mat.emissiveColor.set(1,1,0.5)
+                // else if(type == "p3") mat.emissiveColor.set(1,0.5,0)
+                // else mat.emissiveColor.set(1,0,0)
 
                 this.materialMap.set(type, {
                     mat,
@@ -110,7 +109,7 @@ export default class XBreathPointManager {
                 depth: .01,
                 faceUV
             } : options = {
-                size: size/2,   // todo 暂改size
+                size: size,
                 depth: .01,
                 faceUV
             };
@@ -173,22 +172,6 @@ export default class XBreathPointManager {
                 }
                 bpNumMesh.position = mesh.position
                 bpNumMesh.material = materialBPNum;
-
-                // let standardVec = BABYLON.Vector3.Project(
-                //     mesh.position, 
-                //     BABYLON.Matrix.Identity(),
-                //     this._scene.getViewMatrix(),
-                //     this._scene.getProjectionMatrix()
-                // )
-                // console.error(standardVec)
-                // let screenX = Math.round(window.innerWidth / 2 * standardVec.x + window.innerWidth / 2)
-                // let screenY = Math.round(window.innerHeight / 2 * standardVec.y + window.innerHeight / 2)
-                // let idContant = document.createElement("div")
-                // idContant.innerHTML = id
-                // idContant.style.position = "absolute"
-                // idContant.style.top = screenY + "px"
-                // idContant.style.left = screenX + "px"
-                // document.querySelector("#root").appendChild(idContant)
             }
         
         });
@@ -223,8 +206,7 @@ export default class XBreathPointManager {
         );
         this._sceneManager = e,
         this._scene = e.Scene,
-        // todo 暂改
-        // this._scene.registerBeforeRender(this.reg_breathpoint_update),
+        this._scene.registerBeforeRender(this.reg_breathpoint_update),
         this._scene.registerBeforeRender(this.reg_breathpoint_autovisible)
     }
     setAllBreathPointVisibility(e) {