/// <summary> /// Update given texture2D with camera image. /// </summary> /// <param name="texture">A texture2D sholud be defined as Texture2D(ImageWidth, ImageHeight, TextureFormat.RGBA32, true/false)</param> /// <returns>true if there is any new data.</returns> /// private static void DistortedDataCallback(IntPtr data) { //update = UpdateData(); //TextureDistortedLeft.LoadRawTextureData(data, 612 * 460 * 4); LastUpdateResult = SRWorkModule_API.GetSeeThroughData(ref see_through_data_); //int offset = sizeof(char) * 612 * 460 * 4 * 2 + sizeof(char) * 1150 * 750 * 4 * 2; //undistorted_left_texture.LoadRawTextureData(data, UndistortedImageWidth * UndistortedImageHeight * UndistortedImageChannel); //offset = offset / sizeof(Int32); ////int size = sizeof(char) * 612 * 460 * 4 * 2 + sizeof(char) * 1150 * 750 * 4 * 2 + //// sizeof(float) * 16 * 2 + sizeof(int) * 12; ////byte[] data_byte = new byte[size]; //IntPtr new_ptr; //new_ptr = new IntPtr(data.ToInt32() + offset); //if (IntPtr.Size == sizeof(Int32)) //{ // Debug.Log("32"); // new_ptr = new IntPtr(data.ToInt32() + offset); //} //else //{ // Debug.Log("64"); // new_ptr = new IntPtr(data.ToInt64() + offset); //} //Marshal.Copy(new_ptr, frame, 0, frame.Length); Debug.Log("here"); }
public static bool UpdateData() { if (Time.frameCount == LastUpdateFrame) { return(LastUpdateResult == (int)Error.WORK); } else { LastUpdateFrame = Time.frameCount; } if (b4KImageReady) { LastUpdateResult4K = SRWorkModule_API.GetSeeThrough4KData(ref see_through_4k_data_); return(LastUpdateResult4K == (int)Error.WORK); } else { LastUpdateResult = SRWorkModule_API.GetSeeThroughData(ref see_through_data_); return(LastUpdateResult == (int)Error.WORK); } }