示例#1
0
    void SendCamTransform()
    {
#if !UNITY_EDITOR
        Vector3 cam_pos = CameraCache.Main.transform.position;
        Vector3 cam_rot = CameraCache.Main.transform.eulerAngles;

        byte[] pos_bin = serializer_.Serialize(cam_pos);
        byte[] rot_bin = serializer_.Serialize(cam_rot);

        byte[] data = pos_bin.Concat(rot_bin).ToArray();
        tcp_sender_.SendData(data);
#endif
    }
    private void SendSensorStream()
    {
#if !UNITY_EDITOR && UNITY_METRO
        byte[] img_bin = sensor_.read();

        if (img_bin == null)
        {
            return;
        }

        int w = sensor_.GetWidth();
        int h = sensor_.GetHeight();

        byte[] w_bin = BitConverter.GetBytes(w);
        byte[] h_bin = BitConverter.GetBytes(h);

        byte[] data = w_bin.Concat(h_bin).ToArray();
        data = data.Concat(img_bin).ToArray();

        tcp_sender_.SendData(data);
#endif
    }