コード例 #1
0
 private void Update()
 {
     // Check that we are playing
     if (
         !PreviewTexture.didUpdateThisFrame ||
         PreviewTexture.width == 16 ||
         PreviewTexture.height == 16
         )
     {
         return;
     }
     // Update preview buffer
     if (previewBuffer == null)
     {
         previewBuffer = PreviewTexture.GetPixels32();
     }
     else
     {
         PreviewTexture.GetPixels32(previewBuffer);
     }
     // Invoke events
     if (firstFrame)
     {
         startCallback();
         firstFrame = false;
     }
     if (frameCallback != null)
     {
         frameCallback();
     }
 }
コード例 #2
0
        public void CapturePhoto(PhotoCallback callback)
        {
            var photo = new Texture2D(PreviewTexture.width, PreviewTexture.height, TextureFormat.RGB24, false, false);

            photo.SetPixels32(PreviewTexture.GetPixels32());
            photo.Apply();
            callback(photo);
        }
コード例 #3
0
 private void Update()
 {
     // Check that we are playing
     if (
         !PreviewTexture ||
         !PreviewTexture.isPlaying ||
         !PreviewTexture.didUpdateThisFrame ||
         PreviewTexture.width == 16 ||
         PreviewTexture.height == 16
         )
     {
         if (dispatch != null)
         {
             dispatch.Dispatch(Update);
         }
         return;
     }
     // Update preview buffer
     if (previewBuffer == null)
     {
         previewBuffer = PreviewTexture.GetPixels32();
     }
     else
     {
         PreviewTexture.GetPixels32(previewBuffer);
     }
     // Invoke events
     if (firstFrame)
     {
         if (OnStart != null)
         {
             OnStart();
         }
         firstFrame = false;
     }
     if (OnFrame != null)
     {
         OnFrame();
     }
     // Re-invoke
     if (dispatch != null)
     {
         dispatch.Dispatch(Update);
     }
 }