예제 #1
0
 private void Update()
 {
     if (!Mathf.Approximately(_lastClientUVScale, _clientUVScale))
     {
         HvNetIOServerCommand.Send(NetworkSender.Instance.NetIO, HvNetIOServerCommand.ServerCommand.UVScale, _clientUVScale);
         _lastClientUVScale = _clientUVScale;
     }
 }
예제 #2
0
    // クライアントのUV倍率
    public static void SendClientUVScale(float scale)
    {
        var n = NetworkSender.Instance.NetIO;

        if (n == null)
        {
            return;
        }

        HvNetIOServerCommand.Send(n, HvNetIOServerCommand.ServerCommand.UVScale, scale);
    }
예제 #3
0
    // 角度リセット要求
    public static void SendResetTrackingCenter()
    {
        var n = NetworkSender.Instance.NetIO;

        if (n == null)
        {
            return;
        }

        HvNetIOServerCommand.Send(n, HvNetIOServerCommand.ServerCommand.ResetTracking, 0.0f);
    }
예제 #4
0
    // クライアントから設定情報が来たとき
    private void NetworkSender_OnSetting(int inWidth, int inHeight)
    {
        // 幅の比率
        float wrate = (float)(inWidth / 2) / inHeight;

        // 現在の解像度に直す
        var width = wrate * Screen.height;

        // 要求された幅の方が長い
        if (width > (float)Screen.width)
        {
            this.HmdWidth  = Screen.width;
            this.HmdHeight = (int)((float)inHeight / (float)(inWidth / 2) * Screen.width);
        }
        else
        {
            this.HmdWidth  = (int)width;
            this.HmdHeight = Screen.height;
        }


        Debug.Log($"this.HmdWidth = {this.HmdWidth} : this.HmdHeight = {this.HmdHeight}");

        _camera.rect = new Rect(0.0f, 0.0f, (float)this.HmdWidth / Screen.width, 1.0f);
        _lensCorrenction.ResizeBufffer(this.HmdWidth, this.HmdHeight);

        // サーバから送られる解像度を送信
        HvNetIOStartInfo.Send(NetworkSender.Instance.NetIO, this.HmdWidth, this.HmdHeight, 1024);

        // クライアントと繋がったら送信する。
        _encoder.Setup(this.HmdWidth, this.HmdHeight, _bitrate, _useCpu, _lensCorrenction.LensTexture);

        // 1度画像IDを揃える
        _waitClient = false;

        // クライントにUV倍率を送る
        HvNetIOServerCommand.Send(NetworkSender.Instance.NetIO, HvNetIOServerCommand.ServerCommand.UVScale, _clientUVScale);

        this.IsPlay = true;
    }