示例#1
0
 public static bool IsMessageAvailable(ref uint msgSize)
 {
     unsafe
     {
         int result = DllFunctions.IsMessageAvailable(ref msgSize);
         return(result != 0);
     }
 }
示例#2
0
 private void Start()
 {
     if (jname == "ipRealSenz.json")
     {
         DllFunctions.set_number_TVMS(2);
     }
     config = JsonUtility.FromJson <Config>(System.IO.File.ReadAllText(Application.streamingAssetsPath + "/" + jname));
     m_RabbitMQReceiver.ConnectionProperties.ConnectionURI = config.remote_tvm_address;
     m_RabbitMQReceiver.ConnectionProperties.ExchangeName  = config.remote_tvm_exchange_name;
     m_RabbitMQReceiver.Enabled = true;
 }
示例#3
0
    // Updating the mesh every time a new buffer is received from the network
    private void DataProvider_OnNewData(object sender, EventArgs <byte[]> e)
    {
        // Starting the stopwatch which counts the time needed to process a buffer until the mesh is rendered
        stopWatch = System.Diagnostics.Stopwatch.StartNew();

        lock (e)
        {
            if (e.Value != null && received_new_frame == false)
            {
                //// Storing the received buffer to a .bin file
                //File.WriteAllBytes(@"C:\VCL_User_Prod\RealSenzBinsCorto\RealSenzBin_" + ind + ".bin", e.Value);
                //Debug.Log("file saved");

                stopWatch = System.Diagnostics.Stopwatch.StartNew();
                stopWatch.Start();

                // Flaging that a new buffer is received
                int               size        = Marshal.SizeOf(e.Value[0]) * e.Value.Length;                                   // Buffer 's size
                var               buffer      = e.Value;                                                                       // Buffer 's data
                var               gcRes       = GCHandle.Alloc(buffer, GCHandleType.Pinned);                                   // GCHandler for the buffer
                var               pnt         = gcRes.AddrOfPinnedObject();                                                    // Buffer 's address
                IntPtr            meshPtr     = DllFunctions.callTVMFrameDLL(pnt, buffer.Length, mesh_id);                     // Pointer of the returned structure
                DllFunctions.Mesh currentMesh = (DllFunctions.Mesh)Marshal.PtrToStructure(meshPtr, typeof(DllFunctions.Mesh)); // C# struct equivalent of the one produced by the native C++ DLL

                // Clearing the lists of the deserialiazed buffer 's data
                m_vertices.Clear();
                m_faces.Clear();
                m_participatingCams.Clear();
                m_colorExts.Clear();
                m_colorInts.Clear();


                try
                {
                    // Defining the textures from the returned struct
                    DefineTexture(currentMesh);

                    // Defining the mesh data from the returned struct
                    CreateShape(currentMesh);

                    // Defining the shader 's parameters from the returned struct
                    DefineShaderParams(currentMesh);

                    // Freeing the GCHandler
                    gcRes.Free();

                    received_new_frame = true;
                }
                catch (UnityException ex)
                {
                    Debug.Log(ex.Message);
                }
                stopWatch.Stop();
                deserializeTime.Add(stopWatch.ElapsedMilliseconds);
                if (deserializeTime.Count == 1000)
                {
                    Debug.Log("Deserialization time for 1000 frames -> Mean: " + deserializeTime.Average() + ", " + "Std: " + CalculateStdDev(deserializeTime));
                }
            }
        }
    }
示例#4
0
        public static EGCResults RetrieveMessage(ref UInt32 msgType, byte[] dest, ref UInt32 msgSize)
        {
            int result = DllFunctions.RetrieveMessage(ref msgType, dest, Convert.ToUInt32(dest.Length), ref msgSize);

            return((EGCResults)result);
        }
示例#5
0
        public static EGCResults SendMessage(UInt32 msgType, byte[] data)
        {
            int result = DllFunctions.SendMessage(msgType, data, Convert.ToUInt32(data.Length));

            return((EGCResults)result);
        }
示例#6
0
 public static void Shutdown()
 {
     DllFunctions.Shutdown();
 }
示例#7
0
        public static bool Initialize()
        {
            byte result = DllFunctions.Initialize();

            return(result != 0);
        }