예제 #1
0
        private static void Update(int width, int height, IntPtr RGBA32GPUPtr, int rotate)
        {
            //Dispatch on main thread
            Dispatch.Dispatch(() => {
                if (WaitForFirstFrame)
                {
                    //Initialization
                                        #if UNITY_STANDALONE || UNITY_EDITOR
                    _PreviewTexture = _PreviewTexture ?? new Texture2D(width, height, TextureFormat.RGBA32, false);
                                        #else
                    _PreviewTexture = _PreviewTexture ?? Texture2D.CreateExternalTexture(width, height, TextureFormat.RGBA32, false, false, RGBA32GPUPtr);
                                        #endif

                    WaitForFirstFrame = false;
                    if (OnPreviewStart != null)
                    {
                        OnPreviewStart(_PreviewTexture, rotate);
                    }
                }
                else
                {
                                        #if UNITY_STANDALONE || UNITY_EDITOR
                    _PreviewTexture.LoadRawTextureData(RGBA32GPUPtr, width * height * 4);
                    _PreviewTexture.Apply();
                                        #else
                    _PreviewTexture.UpdateExternalTexture(RGBA32GPUPtr);
                                        #endif

                    if (OnPreviewUpdate != null)
                    {
                        OnPreviewUpdate(_PreviewTexture);
                    }
                }
            });
        }
예제 #2
0
 private static void Render(int request)
 {
     Dispatch.Dispatch(() => {
         GL.IssuePluginEvent(NativeRendererCallback(), request);
     });
 }
예제 #3
0
 public void Dispatch(Dispatch service, ClientMessage message, Session session)
 {
     service.Dispatch(message, session);
 }