// 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); } }
// 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); } }
/// <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); } }
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); }
// 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; } } }