コード例 #1
0
        private void OnCameraSelection(Object sender, int cameraID)
        {
            // Set current camera
            CameraStore.SetCurrentCamera(cameraID);
            CurrentCamera = CameraStore.CurrentCamera;

            // Check if camera selection was done through grid mode
            if (IsGridLayoutActive)
            {
                IsGridLayoutActive = false;

                // Don't display drawer nor toolbar if this is slave mode
                if (!QTMNetworkConnection.IsMaster && !IsDemoModeActive)
                {
                    IsDrawerActive      = false;
                    IsModeToolbarActive = false;
                }
            }

            // Switch drawer mode
            Device.BeginInvokeOnMainThread(() => SwitchDrawers(CurrentCamera.Settings.Mode));

            // Change camera page title
            UpdatePageTitle(IsGridLayoutActive);
        }
コード例 #2
0
        // Turns on/off the frame around a camera screen in the 3D scene
        private void ToggleCameraScreenFrame(bool flag)
        {
            List <DataModels.Camera> cameras = CameraStore.GetCameras();

            for (int i = 0; i < cameras.Count; i++)
            {
                cameras[i].Screen.ToggleFrame(flag);
            }
        }
コード例 #3
0
        // Handles camera info depending on view mode
        private void ToggleCameraUIInfo(ScreenLayoutType screenLayoutType)
        {
            List <DataModels.Camera> cameras = CameraStore.GetCameras();

            // Iterate over screens and toggle the info
            foreach (DataModels.Camera camera in cameras)
            {
                camera.Screen.ToggleUIInfo(screenLayoutType);
            }
        }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        cameraStore = new CameraStore();

        target = GameObject.FindGameObjectWithTag("Player").gameObject.transform;

        if (StartPos != null && EndPos != null)
        {
            cameraStore.StartPos = StartPos.transform.position;
            cameraStore.EndPos   = EndPos.transform.position;
        }
        cameraStore.destination = Vector3.zero;
    }
コード例 #5
0
        /// <summary>
        /// Creates the cameras and attaches markersphers to them
        /// </summary>
        private void InitializeCameras(Node cameraNode)
        {
            // Create mesh node that will hold every marker
            meshNode = scene.CreateChild();
            CameraStore.GenerateCameraScreens(cameraNode);

            foreach (DataModels.Camera camera in CameraStore.GetCameras())
            {
                Node screenNode = meshNode.CreateChild();
                // Create and Initialize cameras, order matters here so make sure to attach children AFTER creation
                camera.Screen.Scale = 10;
                screenNode.AddComponent(camera.Screen);
            }
        }
コード例 #6
0
        // Start app using demo mode
        void StartDemoMode()
        {
            // Show loading screen whilst connecting
            // This loading screen is disabled in the CameraPageViewModel constructor
            Task.Run(() => userDialogs.ShowLoading("Loading demo mode..."));

            // Initialize mock general settings
            SettingsService.Initialize(true);
            CameraStore.GenerateCameras();

            // Navigate to camera page
            NavigationParameters navigationParams = new NavigationParameters();

            navigationParams.Add(Helpers.Constants.NAVIGATION_DEMO_MODE_STRING, true);
            Device.BeginInvokeOnMainThread(() => navigationService.NavigateAsync("CameraPage", navigationParams));
        }
コード例 #7
0
        private async void CreateScene()
        {
            // Create new scene
            scene = new Scene();
            scene.Clear(true, true);

            // Create default octree (-1000:1000)
            octree = scene.CreateComponent <Octree>();

            // Create camera
            Node cameraNode = scene.CreateChild("camera");

            camera = cameraNode.CreateComponent <Camera>();

            // Arbitrary far clipping plane
            camera.FarClip = 50.0f;

            // Reposition it..
            cameraNode.Position = new Vector3(0, 0, 0);

            // Create light and attach to camera
            Node  lightNode = cameraNode.CreateChild(name: "light");
            Light light     = lightNode.CreateComponent <Light>();

            light.LightType  = LightType.Point;
            light.Range      = 10000;
            light.Brightness = 1.3f;

            // Initialize marker sphere meshes
            InitializeCameras(cameraNode);

            List <DataModels.Camera> cameras = CameraStore.GetCameras();

            // Set the default layout
            screenLayout = new Dictionary <ScreenLayoutType, CameraScreenLayout>()
            {
                { ScreenLayoutType.Grid, new GridScreenLayout(cameras.Count, 2, camera) },
                { ScreenLayoutType.Carousel, new CarouselScreenLayout(cameras.Count, camera) }
            };

            SwitchScreenLayout(ScreenLayoutType.Carousel);
            currentScreenLayout.Select(CameraStore.CurrentCamera.ID);
        }
コード例 #8
0
        // Called every frame
        protected override void OnUpdate(float timeStep)
        {
            base.OnUpdate(timeStep);

            // Update camera offset and reset
            //UpdateCameraPosition();

            List <DataModels.Camera> cameras = CameraStore.GetCameras();

            for (int i = 0; i < cameras.Count; i++)
            {
                if (i < currentScreenLayout.Selection + 1 || i > currentScreenLayout.Selection - 1)
                {
                    cameras[i].Screen.Enabled = true;
                    currentScreenLayout.SetCameraScreenPosition(cameras[i].Screen, Orientation);
                }
                else
                {
                    cameras[i].Screen.Enabled = false;
                }
            }
        }
コード例 #9
0
 public PadTargetingController(CameraStore cameraStore)
 {
     _cameraStore = cameraStore;
 }
コード例 #10
0
ファイル: SightBlocker.cs プロジェクト: witia87/Overhaul
 protected virtual void Awake()
 {
     SightStore  = FindObjectOfType <SightStore>();
     CameraStore = FindObjectOfType <CameraStore>();
 }
コード例 #11
0
ファイル: ModulePresenter.cs プロジェクト: witia87/Overhaul
 protected virtual void Awake()
 {
     CameraStore = FindObjectOfType <CameraStore>();
     _angleStep  = 360.0f / _angleDivisionCount;
 }
コード例 #12
0
 public PadMovementController(CameraStore cameraStore)
 {
     _cameraStore = cameraStore;
 }
コード例 #13
0
ファイル: MouseStore.cs プロジェクト: witia87/Overhaul
 protected override void Awake()
 {
     base.Awake();
     _viewStore   = FindObjectOfType <ViewStore>();
     _cameraStore = FindObjectOfType <CameraStore>();
 }
コード例 #14
0
        public CameraPageViewModel(INavigationService navigationService, IUserDialogs userDialogs)
        {
            this.navigationService = navigationService;
            this.userDialogs       = userDialogs;

            // Start with a visible drawer
            // Otherwise iOS will mess everything up..
            IsBottomSheetVisible = true;
            IsModeToolbarActive  = true;
            IsDrawerActive       = true;

            CurrentCamera = CameraStore.CurrentCamera;

            SetCameraModeToMarkerCommand    = new DelegateCommand(() => SetCameraMode(CameraMode.ModeMarker));
            SetCameraModeToVideoCommand     = new DelegateCommand(() => SetCameraMode(CameraMode.ModeVideo));
            SetCameraModeToIntensityCommand = new DelegateCommand(() => SetCameraMode(CameraMode.ModeMarkerIntensity));

            ToggleBottomSheetCommand = new DelegateCommand(() => {
                IsBottomSheetVisible = !isBottomSheetVisible;
            });

            SetCameraScreenLayoutCommand = new DelegateCommand(() =>
            {
                IsGridLayoutActive = true;
                MessagingService.Send(this, MessageSubject.SET_CAMERA_SCREEN_LAYOUT, ScreenLayoutType.Grid);

                // Update the page title
                UpdatePageTitle(true);
            });

            // We're starting with carousel mode
            IsGridLayoutActive = false;

            MessagingCenter.Subscribe <CarouselScreenLayout, int>(this,
                                                                  MessageSubject.SET_CAMERA_SELECTION.ToString(),
                                                                  OnCameraSelection);

            MessagingCenter.Subscribe(this,
                                      MessageSubject.CAMERA_SETTINGS_CHANGED.ToString(),
                                      (QTMEventListener sender) =>
            {
                skipCounter++;

                CameraStore.RefreshSettings();
                CurrentCamera = CameraStore.CurrentCamera;

                if (cameraMode != CurrentCamera.Settings.Mode)
                {
                    SetCameraMode(CurrentCamera.Settings.Mode);
                }
            });

            // Used to hide drawer when the urho surface is tapped
            MessagingCenter.Subscribe <CameraApplication>(this, MessageSubject.URHO_SURFACE_TAPPED, (sender) =>
            {
                if (isBottomSheetVisible)
                {
                    IsBottomSheetVisible = false;
                }
            });

            // Handle back-button presses on Android
            MessagingCenter.Subscribe <CameraApplication>(this, MessageSubject.URHO_ANDROID_BACK_BUTTON_PRESSED, (sender) =>
            {
                // Go back to main menu if settings drawer is not visible
                if (isBottomSheetVisible)
                {
                    IsBottomSheetVisible = false;
                }
                else
                {
                    Device.BeginInvokeOnMainThread(() => navigationService.GoBackAsync());
                }
            });

            // Notifies of camera selection
            MessagingCenter.Send(this, MessageSubject.SET_CAMERA_SELECTION.ToString(), CurrentCamera.ID);

            // Initialize lens aperture snapper
            lensApertureSnapper = new LensApertureSnapper(this);
            ApertureSnapMax     = lensApertureSnapper.LookupTSize - 1;

            // Switch them drawers now
            SwitchDrawers(CurrentCamera.Settings.Mode);

            // No Lens control UI when we start (if even available)
            IsLensControlActive = false;

            UpdatePageTitle(IsGridLayoutActive);
        }
コード例 #15
0
        /// <summary>
        /// Callback method for starting connection
        /// </summary>
        async void OnConnectionStarted()
        {
            try
            {
                // Connect to IP
                bool success = connection.Connect(IPAddress);

                if (!success)
                {
                    if (!QTMNetworkConnection.QTMVersionSupported)
                    {
                        // QTM is not supported
                        userDialogs.Alert("Please make sure that you are connecting to a Windows PC with " +
                                          "a Qualisys Track Manager software version of at least 2.16", "Attention", "Dismiss");
                    }
                    else
                    {
                        // There was an error with the connection
                        notificationService.Show("Attention", "There was a connection error, please check IP address");
                    }

                    return;
                }
                else if (connection.HasPassword())
                {
                    // NOTE: A new propmt configuration has to be created everytime we run it
                    // if we do not do this the acr library will add an action to it and since
                    // it is async it does not expect that and will thus throw an error
                    PromptResult result = await userDialogs
                                          .PromptAsync(
                        new PromptConfig()
                        .SetTitle("Please enter password (blank for slave mode)")
                        .SetOkText("Connect"));

                    if (!result.Ok)
                    {
                        return;
                    }

                    // Connect to host
                    connection.Connect(IPAddress, result.Text);

                    if (!connection.TakeControl() && result.Text != "")
                    {
                        ToastAction toastAction = new ToastAction().SetText("Retry").SetAction(() => OnConnectionStarted());
                        ToastConfig toastConfig = new ToastConfig("Incorrect Password")
                                                  .SetAction(toastAction);

                        userDialogs.Toast(toastConfig);
                        return;
                    }
                }

                // Send connection instance to settings service
                if (!SettingsService.Initialize())
                {
                    // There was a problem when attempting to establish the connection
                    userDialogs.Alert("There was a communication mismatch with QTM, please make sure you are running the" +
                                      " latest version of this application and that you have the QTM version specified in" +
                                      " the requirements", "Error", "Dismiss");

                    connection.Disconnect();
                    return;
                }

                // Show loading screen whilst connecting
                // This loading screen is disabled in the CameraPageViewModel constructor
                Task.Run(() => userDialogs.ShowLoading("Establishing connection..."));

                // Fetch information from system and fill structures accordingly
                CameraStore.GenerateCameras();

                // Connection was successfull
                // Navigate to camera page
                NavigationParameters navigationParams = new NavigationParameters();
                navigationParams.Add(Helpers.Constants.NAVIGATION_DEMO_MODE_STRING, false);
                Device.BeginInvokeOnMainThread(() => navigationService.NavigateAsync("CameraPage", navigationParams));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                notificationService.Show("Attention", "Please make sure that QTM is up and running and that the cameras are plugged in");

                Task.Run(() => userDialogs.HideLoading());

                return;
            }
        }