xushiting 3 лет назад
Родитель
Сommit
9c63c70d07
5 измененных файлов с 24 добавлено и 104 удалено
  1. 2 1
      dist/index.html
  2. 15 0
      dist/libs/toastify-js.js
  3. 0 101
      src/XMaterialComponent.js
  4. 5 0
      src/Xverse_Room.js
  5. 2 2
      src/main.js

+ 2 - 1
dist/index.html

@@ -35,8 +35,9 @@
     <script src="./libs/VisibilityChangeHandler.js"></script>
     <script src="./libs/decoder.js"></script>
     <script src="./libs/nipplejs.min.js"></script>
+    <script src="./libs/toastify-js.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" />

Разница между файлами не показана из-за своего большого размера
+ 15 - 0
dist/libs/toastify-js.js


+ 0 - 101
src/XMaterialComponent.js

@@ -1,25 +1,6 @@
 import XVideoRawYUV from "./XVideoRawYUV"
 import Logger from "./Logger.js"
 
-
-window.generateRandomArray = ()=>{
-    var rnd=[];
-    for(let i=0;i< 512*1024;i++)
-    {
-        rnd[i] = Math.floor(Math.random()*255);
-    }
-    return rnd;
-}
-
-window.updateTexture = (yuv)=>
-{
-    let Y = yuv.subarray(0, 512*1024);
-    window._videoRawYTexture.update(Y)
-    window._videoRawYTexture.updateSamplingMode(BABYLON.Texture.BILINEAR_SAMPLINGMODE)
-    Y = undefined;
-}
-const yuv = new Uint8Array(window.generateRandomArray())
-
 const logger = new Logger('XMaterial')
 export default class XMaterialComponent {
     constructor(e, t) {
@@ -133,74 +114,6 @@ export default class XMaterialComponent {
                 }
                 //(o = this._videoRawYUVTexArray.getVideoYUVTex(videosResOriArrayIndex)) == null || o.update(stream),
                 //(a = this._videoRawYUVTexArray.getVideoYUVTex(videosResOriArrayIndex)) == null || a.updateSamplingMode(BABYLON.Texture.BILINEAR_SAMPLINGMODE)
-
-                if(window.testPlane != null){
-                    if(window.testPlane.material == null){
-                        /*
-                        BABYLON.Effect.ShadersStore['customVertexShader'] = `
-                            precision highp float; 
-                            attribute vec2 uv;
-                            attribute vec3 position;
-                            varying vec2 vUV;
-                            uniform mat4 view;
-                            uniform mat4 projection; 
-                            uniform mat4 world;
-                            uniform mat4 worldViewProjection;
-                            void main()
-                            { 
-                                vUV = uv;
-                                gl_Position = projection * view * world * vec4(position , 1.0); 
-                            }
-                        `;
-                        BABYLON.Effect.ShadersStore["customFragmentShader"]=`
-                            precision highp float;
-                            varying vec2 vUV;
-                            uniform sampler2D chrominanceYTexture;
-                            void main()
-                            {    
-                                vec2 uv = vUV;
-                                vec3 color = vec3(0,0,0);
-                                color = texture2D(chrominanceYTexture, uv).rgb;    
-                                gl_FragColor = vec4( color, 1.0); 
-                            }
-                        `;
-                            
-                        
-                        window.testPlane.material = new BABYLON.ShaderMaterial(
-                            'customShader',
-                            this.scene,
-                            { 
-                              vertex: "custom",
-                              fragment: "custom",
-                            },
-                            {
-                              attributes: ['uv', 'position'],
-                              uniforms: ['view', 'projection', 'worldViewProjection', 'world'],
-                            },
-                        )*/
-                        
-                        window._videoRawYTexture = BABYLON.RawTexture.CreateLuminanceTexture(
-                            null,
-                            512,
-                            1024,
-                            this.scene,
-                            true,
-                            true,
-                          )
-
-                       // window.testPlane.material.setTexture('chrominanceYTexture', window._videoRawYTexture)
-                        
-                       
-                        
-                        window.testPlane.material = new BABYLON.StandardMaterial("xsttest",this.scene);
-                        window.testPlane.material.diffuseTexture = window._videoRawYTexture
-                        
-                        window.testPlane.material.backFaceCulling = false;//Allways show the front and the back of an element
-                        window.setInterval( ()=>{
-                            window.updateTexture( new Uint8Array(window.generateRandomArray()) );
-                        }, 60);
-                    }
-                }
             }
         }
         );
@@ -310,20 +223,6 @@ export default class XMaterialComponent {
         this.shaderMode = t.shaderMode,
         t.yuvInfo != null && (this.yuvInfo = t.yuvInfo),
         t.panoInfo != null && this.setPanoInfo(t.panoInfo)
-
-        window.testPlane = null
-        this.addPlane()
-    }
-
-    //调试
-    addPlane(){
-        //window.testPlane = BABYLON.Mesh.CreatePlane("xstplane", {width: 6, height: 6}, this.scene);
-        //window.testPlane = BABYLON.Mesh.CreatePlane("xstplane", "6", this.scene);
-        window.testPlane = BABYLON.MeshBuilder.CreateGround("ground", {width: 6, height: 6}, this.scene);
-        window.testPlane.rotation.x = Math.PI/2
-        window.testPlane.position.y = 3;
-        window.testPlane.position.z = -20;
-        window.testPlane.position.x = 15;
     }
 
     stopYUVUpdate() {

+ 5 - 0
src/Xverse_Room.js

@@ -74,6 +74,10 @@ export default class Xverse_Room extends EventEmitter {
             this.setViewMode("observer").then(()=>this, ()=>this)) : new Promise(o=>{
                 const a = this.networkController.rtcp.workers;
                 a.registerFunction("signal", s=>{
+                    if(s.signal.actionType == 1014)
+                    {
+                        console.log('signal:'+JSON.stringify(this.sceneManager.cameraComponent.mainCamera.rotation.y))
+                    }
                     this.signal.handleSignal(s)
                 });
 
@@ -87,6 +91,7 @@ export default class Xverse_Room extends EventEmitter {
                         r || (r = !0,logger.info("Invoke updateRawYUVData"));
                         this.isUpdatedRawYUVData = !1;
                         const fov = (l = this._currentState.skin) == null ? void 0 : l.fov;
+                        console.log('旋转stream')
                         this.sceneManager.materialComponent.updateRawYUVData(s.stream, s.width, s.height, fov);
                         this.isUpdatedRawYUVData = !0
                     }

+ 2 - 2
src/main.js

@@ -33,11 +33,11 @@ const l = async()=>{
             skinId: '10092',
             avatarId: 'KGe_Boy',
             roomId: 'e629ef3e-022d-4e64-8654-703bb96410eb',
-            userId: '1f7acca1db9d5',
+            userId: '2f7acca1db9d5',
             wsServerUrl: 'wss://uat-eks.xverse.cn/ws',
             appId: "10016",
             token: " ",
-            nickname: '1f7acca1db9d5',
+            nickname: '2f7acca1db9d5',
             firends: ["user1"],
             viewMode: "full",
             resolution: {