void RenderAndWrite(Camera Cam) { if (Cam == null) { return; } if (mCast == null) { return; } // if no texture provided, make one if (mCaptureCameraTexture == null) { mCaptureCameraTexture = new RenderTexture(Cam.pixelWidth, Cam.pixelHeight, 16); } // save settings to restore RenderTexture PreTarget = RenderTexture.active; var PreCameraTarget = Cam.targetTexture; Cam.targetTexture = mCaptureCameraTexture; RenderTexture.active = mCaptureCameraTexture; Cam.Render(); // aaaand restore. RenderTexture.active = PreTarget; Cam.targetTexture = PreCameraTarget; mCast.UpdateTexture(mCaptureCameraTexture, 0); }
void Update() { // write latest stream data if (mCast != null) { // check where to output the camera, if we haven't already bool CameraCaptureOutput = false; int FirstStreamUnused = -1; // output textures for (int i = 0; i < OutputTextures.Count; i++) { var Tex = OutputTextures[i]; if (Tex == null) { if (FirstStreamUnused == -1) { FirstStreamUnused = i; } continue; } CameraCaptureOutput |= Tex == mCaptureCameraTexture; mCast.UpdateTexture(Tex, i); } // if we want to write the capture texture, and we havent... do it now if (!CameraCaptureOutput && mCaptureCameraTexture != null) { // if we haven't left a gap... do it at the end if (FirstStreamUnused == -1) { FirstStreamUnused = OutputTextures.Count; } mCast.UpdateTexture(mCaptureCameraTexture, FirstStreamUnused); } } }
void Update() { // write latest stream data if (mCast != null) { // check where to output the camera, if we haven't already bool CameraCaptureOutput = false; // if we want to write the capture texture, and we havent... do it now if (!CameraCaptureOutput && mCaptureCameraTexture != null) { mCast.UpdateTexture(mCaptureCameraTexture, 0); } } }
void Update() { //Debug.Log ("Popcast window update"); // update texture LateUpdate(); // write latest stream data if (mPopCast != null) { if (PushFakeTextures) { mPopCast.UpdateFakeTexture(0); } else { mPopCast.UpdateTexture(RecordToTexture, 0); } } }