Example #1
0
        // TODO: Add initialization for float frameHeight, float frameWidth, float min
        public CameraScreen(DataModels.Camera camera, Node cameraNode)
        {
            Camera          = camera;
            this.cameraNode = cameraNode;
            urhoCamera      = cameraNode.GetComponent <Urho.Camera>();

            orientation = camera.Orientation;

            ReceiveSceneUpdates = true;

            // Set position in relation to the number of cameras that are already initialized
            // so the screens can be positioned accordingly
            position = screenCount + 1;
            screenCount++;
        }
        private void ParallelUpdate(int index, CameraImage cameraImage, DataModels.Camera localCamera)
        {
            if (cameraImage.CameraID != localCamera.ID)
            {
                return;
            }

            SKBitmap bitmap = SKBitmap.Decode(cameraImage.ImageData).Resize(new SKImageInfo(
                                                                                Constants.URHO_TEXTURE_SIZE, Constants.URHO_TEXTURE_SIZE),
                                                                            SKBitmapResizeMethod.Lanczos3);

            if (localCamera.Screen != null)
            {
                localCamera.Screen.ImageData = bitmap.Bytes;
            }
        }