public void CreateNotConnectedCameraTest() { var ipAddress = IPAddress.Parse("192.168.0.1"); var cameraFactory = new CameraFactory(); var camera = cameraFactory.CreateCamera(ipAddress); Assert.AreEqual(ipAddress, camera.IPAddress); Assert.AreEqual(camera.State, CameraStateEnum.NotConnected); }
private Camera MakeCheckedCamera() { if (string.IsNullOrEmpty(CameraName)) { Messenger.Default.Send(new ViewModelMessageBoxMessage( this, LanguageString.Find("DeviceConfiguration_CameraCreationView_CameraNameNull"), ViewModelMessageBoxType.Error)); return(null); } Camera camera = CameraFactory.CreateCamera(); camera.Name = CameraName; return(camera); }
public void CreateNotConnectedCameraExceptionTest() { var ipAddress = IPAddress.Parse("192.168.0.1"); var cameraFactory = new CameraFactory(); try { var camera = cameraFactory.CreateCamera("admin", "admin", ipAddress); Assert.Fail(); } catch (Exception e) { Assert.AreEqual(typeof(CameraConnectionException), e.GetType()); } }
public Shaders() { Content.RootDirectory = "Content"; // Komponenten erstellen camera = CameraFactory.CreateCamera(this, CameraType.FreeLookCamera); shape = new Shape(this); room = new Shape(this); lightService = new LightService(this); crosshair = new Crosshair(this) { Visible = false }; effectService = new EffectService(); collisionDetection = new CollisionDetection(this); // Komponenten zur Engine hinzufügen Components.Add(new CameraHandler(this) { Camera = camera }); Components.Add(camera); Components.Add(lightService); Components.Add(shape); Components.Add(room); Components.Add(crosshair); Components.Add(collisionDetection); // Services hinzufügen Services.AddService(typeof(ICameraService), camera); Services.AddService(typeof(ILightService), lightService); Services.AddService(typeof(IEffectService), effectService); // Grafik-Einstellungen graphics = new GraphicsDeviceManager(this); graphics.SynchronizeWithVerticalRetrace = true; graphics.PreferMultiSampling = true; graphics.IsFullScreen = true; graphics.PreferredBackBufferWidth = 1366; graphics.PreferredBackBufferHeight = 768; IsFixedTimeStep = true; }
public ICamera BuildMenu(int choice) { CameraFactory factory = new CameraFactory(); bool done = false; ICamera camera = null; while (!done) { switch (choice) { case 1: Console.Write(SubMenu()); choice = int.Parse(Console.ReadLine()); camera = factory.CreateCamera(choice); done = true; break; case 2: GetCameraList(); done = true; break; case 3: RemoveCamera(); done = true; break; case 9: Console.WriteLine("Exiting..."); Environment.Exit(0); break; default: Console.Write("Please pick a valid number: "); choice = int.Parse(Console.ReadLine()); break; } } return(camera); }
private static Frame GenerateFrame() { var entityIdFactory = new EntityIdFactory(); var sceneBuilder = new SceneBuilder(new Vector3(0.2f, 0.0f, 0.43f)); var scatterableComputer = new ScatterableComputer(); var hitableSphereComputer = new HitableSphereComputer(); // Create the scene var elementBuilderFactory = new ElementBuilderFactory(entityIdFactory, hitableSphereComputer, scatterableComputer); sceneBuilder.AddElement(elementBuilderFactory.Create() .WithPosition(new Position(new Vector3(0.725f, 0.5f, 0.725f))) .WithShape(new Sphere(0.5f)) .WithMaterial(new Diffuse(new Vector3(0.0f, 1.0f, 0.0f))).Build()); sceneBuilder.AddElement(elementBuilderFactory.Create() .WithPosition(new Position(new Vector3(0.0f, -200.0f, 0.0f))) .WithShape(new Sphere(200f)) .WithMaterial(new Diffuse(new Vector3(0.5f, 0.5f, 0.5f))).Build()); var cameraFactory = new CameraFactory(); var lookFrom = new Vector3(0, 8, 10); var lookat = new Vector3(0, 0, 0); var distanceToFocus = (lookFrom - lookat).Length(); const float aperture = 0.1f; var camera = cameraFactory.CreateCamera(lookFrom, lookat, new Vector3(0, 1, 0), 20, (float)ResolutionHorizontal / ResolutionVertical, aperture, distanceToFocus); var scene = sceneBuilder.Build(); var tracer = new MonitoringTracer( new BackgroundTracer(scene, camera, ResolutionHorizontal, ResolutionVertical, Sampling)); return(tracer.Trace()); }
protected virtual Camera MakeCamera() { if (SelectedVideoSourceDescription == null) { Messenger.Default.Send(new ViewModelMessageBoxMessage( this, LanguageString.Find("DeviceConfiguration_CameraCreationView_PleaseSelectCameraSource"), ViewModelMessageBoxType.Error)); return(null); } if (string.IsNullOrEmpty(CameraName)) { Messenger.Default.Send(new ViewModelMessageBoxMessage( this, LanguageString.Find("DeviceConfiguration_CameraCreationView_CameraNameNull"), ViewModelMessageBoxType.Error)); return(null); } Camera camera = CameraFactory.CreateCamera(); camera.Name = CameraName; camera.Description = CameraDescription; camera.VideoSourceDescription = SelectedVideoSourceDescription; camera.Tags = CameraTags; return(camera); }