public override void FrameGate_Input(Texture2D tex) { if (peer == null) { return; } if (receivedTextureBufferIsUpdated) { return; } inputTexturePixels = tex.GetPixels32(); inputTextureHandle = GCHandle.Alloc(inputTexturePixels, GCHandleType.Pinned); inputTexturePixlesPtr = inputTextureHandle.AddrOfPinnedObject(); peer.FramgeGate_Input(inputTexturePixlesPtr, tex.width, tex.height); }
// Update is called once per frame void Update() { if (textureDataIsUpdated) { tex.LoadRawTextureData(renderingBuffer); tex.Apply(); RenderTexture currentRT = RenderTexture.active; RenderTexture.active = SubCameraTexture; inputTexture.ReadPixels(new Rect(0, 0, SubCameraTexture.width, SubCameraTexture.height), 0, 0); inputTexture.Apply(); RenderTexture.active = currentRT; pixels = inputTexture.GetPixels32(); handle = GCHandle.Alloc(pixels, GCHandleType.Pinned); texPixlesPtr = handle.AddrOfPinnedObject(); peer.FramgeGate_Input(texPixlesPtr, (int)tex.width, (int)tex.height); textureDataIsUpdated = false; } }
public override void FrameGate_Input(Texture2D tex, long timestamp_us) { if (peer == null) { return; } if (receivedTextureBufferIsUpdated) { return; } inputTexturePixels = tex.GetPixels32(); inputTextureHandle = GCHandle.Alloc(inputTexturePixels, GCHandleType.Pinned); inputTexturePixlesPtr = inputTextureHandle.AddrOfPinnedObject(); peer.FramgeGate_Input(inputTexturePixlesPtr, (int)tex.width, (int)tex.height, timestamp_us); if (!localDataChan) { return; } // bool rst = peer.SendDataViaDataChannel(timestamp_us.ToString()); bool rst = peer.SendDataViaDataChannel("hello"); }