SCRtcMe.cs 857 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Runtime.InteropServices;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. public class SCRtcMe
  8. {
  9. [DllImport("NativeCameraPlugin")]
  10. public static extern void SetTextureLocal(System.IntPtr texture);
  11. [DllImport("NativeCameraPlugin")]
  12. private static extern IntPtr GetLocalEventFunc();
  13. public string peerId;
  14. public string cId;
  15. public Texture2D tex;
  16. public int TextureID;
  17. public void updateTexture()
  18. {
  19. if (TextureID != 0)
  20. {
  21. GL.IssuePluginEvent(GetLocalEventFunc(), TextureID);
  22. }
  23. }
  24. public virtual void setMyCamera(RenderTexture myRenderTexture)
  25. {
  26. TextureID = myRenderTexture.GetNativeTexturePtr().ToInt32();
  27. SetTextureLocal(myRenderTexture.GetNativeTexturePtr());
  28. }
  29. }