/* Overrides */ protected override void Render(ICamera camera) { #if DEBUG /* Draw a collision circle */ camera.Renderer.DrawCircle(DebugTexture, Color.Yellow, 1, Parent.GetActualPosition(), mRadius, MathHelper.TwoPi, 0.0f, true); #endif }
public void SetCamera(ICamera camera) { this.camera.Stop(); this.camera = camera; this.camera.Canvas = pictureBoxVideo; this.camera.Start(); }
public override void Initialize() { camera = (ICamera)Game.Services.GetService(typeof(ICamera)); postprocessingManager = (IPostprocessingManager)Game.Services.GetService(typeof(IPostprocessingManager)); projection = camera.Projection; view = camera.View; for (int i = 0; i < scenery.Length; ++i) { scenery[i] = new List<SceneryComponent>(); for (int j = 0; j < OBJ_PER_LAYER; ++j) { // Create initial scenery for each scenery channel, spawning them a random // distance further behind the far plane. This gives the impression that // the scenery is coming in randomly, instead of initially appearing in a // large group across the entire screen. scenery[i].Add(CreateScenery(i == 0, j)); Vector3 pos = scenery[i][j].Position; pos.Z -= (float)Utility.Prng.NextDouble() * 5000.0f; scenery[i][j].Position = pos; postprocessingManager.AddComponent(scenery[i][j]); } } base.Initialize(); }
public void Draw(GameTime gameTime, ICamera cam, TextureCube skyTexture, Matrix proj) { // start the shader //oceanEffect.Begin(); //oceanEffect.CurrentTechnique.Passes[0].Begin(); // set the transforms oceanEffect.Parameters["World"].SetValue(Matrix.Identity); oceanEffect.Parameters["View"].SetValue(cam.CameraMatrix); oceanEffect.Parameters["Projection"].SetValue(proj); oceanEffect.Parameters["EyePos"].SetValue(cam.Position); // choose and set the ocean textures int oceanTexIndex = ((int)(gameTime.TotalGameTime.TotalSeconds) % 4); oceanEffect.Parameters["normalTex"].SetValue(OceanNormalMaps[(oceanTexIndex + 1) % 4]); oceanEffect.Parameters["normalTex2"].SetValue(OceanNormalMaps[(oceanTexIndex) % 4]); oceanEffect.Parameters["textureLerp"].SetValue((((((float)gameTime.TotalGameTime.TotalSeconds) - (int)(gameTime.TotalGameTime.TotalSeconds)) * 2 - 1) * 0.5f) + 0.5f); // set the time used for moving waves oceanEffect.Parameters["time"].SetValue((float)gameTime.TotalGameTime.TotalSeconds * 0.02f); // set the sky texture oceanEffect.Parameters["cubeTex"].SetValue(skyTexture); //oceanEffect.CommitChanges(); oceanEffect.CurrentTechnique.Passes[0].Apply(); // draw our geometry //Global.Graphics.VertexDeclaration = OceanVD; Global.Graphics.DrawUserPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, OceanVerts, 0, 2); // and we're done! //oceanEffect.CurrentTechnique.Passes[0].End(); //oceanEffect.End(); }
protected override void Draw(GameTime gt, IObject obj, RenderHelper render, ICamera cam, IList<ILight> lights) { Vector3 dir = cam.Target - cam.Position; dir.Normalize(); _shader.Parameters["forward"].SetValue(dir); _shader.Parameters["camUp"].SetValue(cam.Up); _shader.Parameters["scaleX"].SetValue(scale.X); _shader.Parameters["scaleY"].SetValue(scale.Y); _shader.Parameters["xWorld"].SetValue(obj.PhysicObject.WorldMatrix); _shader.Parameters["xView"].SetValue(cam.View); _shader.Parameters["xProjection"].SetValue(cam.Projection); //_shader.Parameters["xBillboardTexture"].SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE,0,0)); render.Textures[0] = obj.Modelo.getTexture(TextureType.DIFFUSE, 0, 0); _shader.Parameters["atenuation"].SetValue(atenuation); render.PushRasterizerState(RasterizerState.CullNone); BatchInformation batchInfo = obj.Modelo.GetBatchInformation(0)[0]; { _shader.Parameters["alphaTest"].SetValue(alphaTestLimit); render.RenderBatch(batchInfo, _shader); } render.PopRasterizerState(); }
public static void Configure(ICamera camera, GestureSensor gestureSensor) { var middleWidth = camera.ResolutionWidth/2; var middleHeight = camera.ResolutionHeight/2; var l = camera.LeftHand; var r = camera.RightHand; new GestureSlideLeft(l, middleWidth).SlideDetected += (s, a) => gestureSensor.OnSlideLeft(new GestureEventArgs("Left Hand Slide Left")); new GestureSlideRight(l, middleWidth).SlideDetected += (s, a) => gestureSensor.OnSlideRight(new GestureEventArgs("Left Hand Slide Right")); new GestureSlideUp(l, middleHeight).SlideDetected += (s, a) => gestureSensor.OnSlideUp(new GestureEventArgs("Left Hand Slide Up")); new GestureSlideDown(l, middleHeight).SlideDetected += (s, a) => gestureSensor.OnSlideDown(new GestureEventArgs("Left Hand Slide Down")); new GestureSlideLeft(r, middleWidth).SlideDetected += (s, a) => gestureSensor.OnSlideLeft(new GestureEventArgs("Right Hand Slide Left")); new GestureSlideRight(r, middleWidth).SlideDetected += (s, a) => gestureSensor.OnSlideRight(new GestureEventArgs("Right Hand Slide Right")); new GestureSlideUp(r, middleHeight).SlideDetected += (s, a) => gestureSensor.OnSlideUp(new GestureEventArgs("Right Hand Slide Up")); new GestureSlideDown(r, middleHeight).SlideDetected += (s, a) => gestureSensor.OnSlideDown(new GestureEventArgs("Right Hand Slide Down")); }
public override void Load(IModel model, ICamera camera, int width, int height) { _camera = camera; GL.MakeCurrent(); GL.Enable(OpenGL.GL_TEXTURE_2D); GL.Enable(OpenGL.GL_CULL_FACE); GL.Enable(OpenGL.GL_DEPTH_TEST); GL.Enable(OpenGL.GL_BLEND); GL.Enable(OpenGL.GL_VERTEX_ARRAY); GL.Hint(HintTarget.LineSmooth, HintMode.Nicest); GL.Enable(OpenGL.GL_LINE_SMOOTH); GL.Enable(OpenGL.GL_BLEND); GL.BlendFunc(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.OneMinusSourceAlpha); GL.Enable(OpenGL.GL_MULTISAMPLE); GL.MinSampleShading(4.0f); GL.PolygonMode(FaceMode.FrontAndBack, PolygonMode.Filled); _postProcesser = new PostProcesser(GL,width,height); _backgroundRenderer = new BackgroundRenderer(GL); var octreeModel = model as OctreeModel; if (octreeModel != null) { _octreeRenderer = new OctreeRenderer(octreeModel, GL); } }
public Window() : base(1280, 720, new GraphicsMode(32, 0, 0, 4), "OpenCAD") { VSync = VSyncMode.On; _camera = new MainCamera(); }
public void Render(GameTime gameTime, ICamera camera) { if (_basicEffect != null) { // Set the effect's parameters. Matrix projectionMatrix, viewMatrix; camera.GetMatrices(out projectionMatrix, out viewMatrix); _basicEffect.Projection = projectionMatrix; _basicEffect.View = viewMatrix; _basicEffect.World = SceneNode.Transformation; // Set the rasterizer state. _graphics.DepthStencilState = DepthStencilState.Default; _graphics.BlendState = BlendState.AlphaBlend; _graphics.RasterizerState = _rasterizerState; // Draw the vertex buffer. foreach (var effectPass in _basicEffect.CurrentTechnique.Passes) { effectPass.Apply(); _graphics.DrawUserPrimitives(PrimitiveType.TriangleList, _particleVertices, 0, _particles.Length, VertexPositionColor.VertexDeclaration); } } }
public async Task Initialize(ICamera camera, IStorage storage) { this.camera = camera; this.storage = storage; var cacheFolder = KnownFolders.PicturesLibrary; this.dropFolder = await cacheFolder.GetFolderAsync("securitysystem-cameradrop"); this.dropFolderWatcher = dropFolder.CreateFileQuery(); var images = await this.dropFolderWatcher.GetFilesAsync(); var orderedImages = images.OrderByDescending(x => x.DateCreated); this.newestImage = orderedImages.FirstOrDefault(); this.dropFolderWatcher.ContentsChanged += DropFolderWatcher_ContentsChanged; this.allJoynBusAttachment = new AllJoynBusAttachment(); this.producer = new SecuritySystemProducer(this.allJoynBusAttachment); this.allJoynBusAttachment.AboutData.DefaultAppName = Package.Current.DisplayName; this.allJoynBusAttachment.AboutData.DefaultDescription = Package.Current.Description; this.allJoynBusAttachment.AboutData.DefaultManufacturer = Package.Current.Id.Publisher; this.allJoynBusAttachment.AboutData.SoftwareVersion = Package.Current.Id.Version.ToString(); this.allJoynBusAttachment.AboutData.IsEnabled = true; this.producer.Service = this; this.producer.Start(); }
public override void Update(GameTime gameTime, ICamera camera) { if (_spaceShip == null || !Enabled) { return; } var keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Keys.W) || keyboard.IsKeyDown(Keys.Up)) { _spaceShip.Thrust(Vector2.UnitY * -2500.0f); } if (keyboard.IsKeyDown(Keys.S) || keyboard.IsKeyDown(Keys.Down)) { _spaceShip.Thrust(Vector2.UnitY * 2500.0f); } if (keyboard.IsKeyDown(Keys.E)) { _spaceShip.Thrust(Vector2.UnitX * 2000.0f); } if (keyboard.IsKeyDown(Keys.Q)) { _spaceShip.Thrust(Vector2.UnitX * -2000.0f); } if (keyboard.IsKeyDown(Keys.D) || keyboard.IsKeyDown(Keys.Right)) { _spaceShip.Rotate(2500.0f); } if (keyboard.IsKeyDown(Keys.A) || keyboard.IsKeyDown(Keys.Left)) { _spaceShip.Rotate(-2500.0f); } }
public Terrain( Game game, IHeightMap heightMap, ICamera camera ) : base( game ) { mGame = game; mHeightMap = heightMap; mCamera = camera; mTerrainCells = new List<TerrainCell>(); }
public SceneGraph(ICamera camera, IMap map) { this._RootGraphList = new List<GameObject>(); this.RootGraph = _RootGraphList.AsReadOnly(); this.Camera = camera; this.Map = map; }
public void Render(DeviceContext deviceContext, Matrix viewMatrix, Matrix projectionMatrix, Light light, ICamera camera) { _skydome.Render(deviceContext); _shader.Render(deviceContext, _skydome.IndexCount, Matrix.Scaling(10000) * Matrix.RotationY(MathUtil.PiOverTwo - _angle / 8), viewMatrix, projectionMatrix, _skydome.Texture, light, camera); }
public void LoadContent() { _spriteBatch = new SpriteBatch(_graphics); _world = new StaticEntityWorld(_game.Services); var pp = _graphics.PresentationParameters; _camera = new DefaultCamera(null, new Viewport(0, 0, pp.BackBufferWidth, pp.BackBufferHeight)); _cameraNode = _world.Scene.Root.CreateChild("Camera"); _cameraNode.Position = new Vector3(_camera.ScreenSize / 2.0f, 0.0f); _cameraNode.Scale = new Vector3(.5f); _cameraNode.Attach(_camera); // Create the tile map. _terrain = new Terrain(new Vector2(102.4f, 102.4f), 51.2f, 9); _terrain.DebugEnabled = true; _world.Add(_terrain); // Create the circle brush. _circleBrush = new CircleBrush(2.5f); _circleBrushNode = _world.Scene.CreateSceneNode(); _circleBrushNode.Attach(new CircleRenderable(2.5f, 64) { Color = Vector3.One }); }
public Main() { graphics = new GraphicsDeviceManager(this); graphics.SynchronizeWithVerticalRetrace = false; graphics.ApplyChanges(); resolution = Settings.Default.WindowResolution; graphics.PreferredBackBufferWidth = resolution.X; graphics.PreferredBackBufferHeight = resolution.Y; Content.RootDirectory = "Content"; camera = new FreeLookCamera(this); cameraHandler = new CameraHandler(this); fps = new FPS(this); hud = new HUD(this); Components.Add(camera); Components.Add(cameraHandler); Components.Add(fps); Components.Add(hud); Services.AddService(typeof(ICamera), camera); fakeViewFrustum = new BoundingFrustum(Matrix.Identity); }
public override void Initialize() { collisionManager = (ICollisionManager)Game.Services.GetService(typeof(ICollisionManager)); camera = (ICamera)Game.Services.GetService(typeof(ICamera)); base.Initialize(); }
public void EnableCameraTracking(ICamera camera) { this.AddLine("ViewPort: {0}", () => camera.SceneViewport); this.AddLine("Translation: {0}", () => camera.SceneTranslationVector); this.AddLine("Position: {0}", () => camera.Position); this.AddLine("Zooming: {0:f1}", () => camera.ZoomFactor); }
internal DrawTarget(ICamera camera, bool enabled) { if (camera == null) throw new ArgumentNullException("camera"); this.camera = camera; this.enabled = enabled; }
/// <summary> /// Manages a scene to be rendered and updated. /// </summary> /// <param name="camera">Camera of the scene</param> /// <param name="canvas">Canvas that this scene binds to.</param> /// <param name="objects">Objects to be rendered</param> public Scene(ICamera camera, ICanvas canvas, params SceneObject[] objects) { if (camera == null || canvas == null) { throw new ArgumentNullException(); } this.Canvas = canvas; { this.rootUI = new SceneRootUI(); } { var rootObject = new SceneRootObject(this); rootObject.Children.AddRange(objects); this.rootObject = rootObject; } { var rootViewPort = new SceneRootViewPort( AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top, new Padding(0, 0, 0, 0), canvas.Size); rootViewPort.Children.Add(new ViewPort(camera, AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom, new Padding(0, 0, 0, 0), canvas.Size)); this.rootViewPort = rootViewPort; } //var cursor = UICursor.CreateDefault(); //cursor.Enabled = false; //this.rootCursor.Children.Add(cursor); //this.Cursor = cursor; }
public void GenerateShadowMatrix(ICamera camera, ILight light, out Matrix view, out Matrix projection) { /// view transforms into Lightspace. Depth is saved. The depth value is then written to the shadowmap position defined by projection (the normal modelviewprojection matrix) /// but this is nonsense cause projection will not generate the same position for every pixel across a ray originatin from the lightposition view = new Matrix(); projection = new Matrix(); }
public void Draw(ICamera camera) { SetCameraClippingPlanes(camera); _renderer.Draw(_location, camera.Location, camera.OriginBasedViewTransformation, camera.ProjectionTransformation); _terrain.Draw(camera.Location, camera.OriginBasedViewTransformation, camera.ProjectionTransformation); }
internal void Update(GameTime gameTime, ICamera Camera) { ViewFrustrum.Matrix = Camera.ViewProjection; CameraPosition = Camera.Position; //Corners 0-3 = near plane clockwise, Corners 4-7 = far plane clockwise ViewFrustrum.GetCorners(VFCorners); var clip = ClippingFrustrum.FromFrustrumCorners(VFCorners, CameraPosition); ClipShape = clip.ProjectToTargetY(_position.Y); _lastCameraPosition = _cameraPosition; IndexCount = 0; _rootNode.Merge(); _rootNode.EnforceMinimumDepth(); _activeNode = _rootNode.DeepestNodeWithPoint(ClipShape.ViewPoint); if (_activeNode != null) { _activeNode.Split(); } _rootNode.SetActiveVertices(); _buffers.UpdateIndexBuffer(Indices, IndexCount); _buffers.SwapBuffer(); }
public VisualisationWindow(ZArrayDescriptor desc, ICamera cam, int width, int height, int fsaa_samples, bool vsync) : base(width, height, new GraphicsMode(32, 24, 0, fsaa_samples)) { this.cam = cam; if(!vsync) this.VSync = VSyncMode.Off; }
public FollowCamera(ICamera camera, IWorldObject target) { this.camera = camera; this.target = target; Distance = 1.0f; TicksToCatchUp = 200; }
public Capture(string leftCamera, string rightCamera, Device d3dDevice) { if (leftCamera.ToLower().StartsWith("udp://")) { if (rightCamera != "" && rightCamera.ToLower().StartsWith("udp://")) { m_rightCamera = new StreamingCamera(rightCamera, d3dDevice, 1); } } else { DsDevice[] systemCamereas = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice); foreach (var device in systemCamereas) { if (device.DevicePath.Equals(leftCamera)) { if (device.Name.ToLower().StartsWith("hauppauge")) { m_leftCamera = new AnalogCamera(device, d3dDevice); } else { m_leftCamera = new WebCamera(device, d3dDevice); } } if (device.DevicePath.Equals(rightCamera)) { m_rightCamera = new WebCamera(device, d3dDevice); } } } }
/**************************************************************************************************** * ****************************************************************************************************/ public void UpdateBuffer(DeviceContext context, Matrix world, ICamera camera) { var view = camera.CreateViewMatrix(); var projection = camera.CreateProjectionMatrix(Resolution); Matrices[0] = Matrix.Transpose(world); Matrices[1] = Matrix.Transpose(view); Matrices[2] = Matrix.Transpose(projection); Matrices[3] = Matrix.Transpose(world * view); Matrices[4] = Matrix.Transpose(world * view * projection); Matrices[5] = Matrix.Transpose(view * projection); Matrices[6] = Matrix.Invert(world); Matrices[7] = Matrix.Invert(world * view); Matrices[8] = Matrix.Transpose(Matrix.Identity * Matrix.Scaling(LightPosition)); Matrices[9] = new Matrix(new float[] { LerpTime, AbsoluteTime, Resolution.X, Resolution.Y, BeatTime, Lead,0,0, Nisse0, Nisse1, Nisse2, Nisse3, 0,0,0,0, }); if (Buffer == null) { Buffer = new Buffer(context.Device, Matrices.Length * Utilities.SizeOf<Matrix>(), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0); } context.UpdateSubresource(Matrices, Buffer); }
public CameraTracker(Game game, ICamera camera) : base(game) { Camera = camera; Tension = 0; Bias = 0; Continuity = 0; Waypoints = new List<Waypoint>(); float time = 0.0f; float delta = 3.0f; // Waypoints und LookAt-Directions initialisieren Waypoints.Add(CreateWaypoint(new Vector3(10.0f, 5.0f, 10.0f), new Vector3(0.0f, 0.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(10.0f, 3.0f, -10.0f), new Vector3(0.0f, 3.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(-10.0f, 5.0f, -10.0f), new Vector3(0.0f, 0.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(-10.0f, 3.0f, 10.0f), new Vector3(0.0f, 3.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(-15.0f, 10.0f, 15.0f), new Vector3(5.0f, 0.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(-15.0f, 10.0f, -15.0f), new Vector3(0.0f, 0.0f, 5.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(1.0f, 5.0f, -1.0f), new Vector3(0.0f, 0.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(15.0f, 10.0f, 15.0f), new Vector3(0.0f, 0.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(10.0f, 5.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(0.0f, 0.2f, 0.0f), new Vector3(-1.0f, 0.2f, 0.0f), time += delta)); Waypoints.Add(CreateWaypoint(new Vector3(-10.0f, 5.0f, 0.0f), new Vector3(0.0f, 0.0f, 0.0f), time += delta)); }
/// <summary> /// Initializes a new instance of the <see cref="RenderEventArg"/> class. /// </summary> /// <param name="renderMode">render mode.</param> /// <param name="camera">camera used during rendering.</param> /// <param name="pickingGeometryType">Target geometry type(point, line, triangle, quad or polygon) for color-coded-picking when <paramref name="renderMode"/> is <see cref="RenderModes.ColorCodedPicking"/>; otherwise useless.</param> public RenderEventArg(RenderModes renderMode, Rectangle viewport, ICamera camera, GeometryType pickingGeometryType = GeometryType.Point) { this.RenderMode = renderMode; this.CanvasRect = viewport; this.Camera = camera; this.PickingGeometryType = pickingGeometryType; }
public LevelView(ILevel level, ISpriteBatch spriteBatch, ITexture texture, ICamera camera) { _level = level; _spriteBatch = spriteBatch; _texture = texture; _camera = camera; }
/// <summary> /// Spawns all objects needed for a level based on an XML file /// </summary> /// <param name="filepath">Path to the XML file we should read from for this level</param> /// <param name="levelBackground">Sprite for background of level</param> /// <param name="mainCamera">Camera created for this level.</param> /// <param name="players">List of players spawned for this level</param> /// <param name="enemies">List of enemies spawned for this level</param> /// <param name="Tiles">List of tiles spawned for this level</param> /// <param name="items">List of items spawned for this level</param> /// <returns>True if level loading was successful, false if there was an error.</returns> public bool LoadLevelFromXML(string filepath, out ISprite levelBackground, out ICamera mainCamera, out List <IPlayer> players, out List <IEnemy> enemies, out List <ITile> tiles, out List <IItem> items) { levelBackground = null; mainCamera = null; players = new List <IPlayer>(); enemies = new List <IEnemy>(); tiles = new List <ITile>(); items = new List <IItem>(); //If we were given a bad file, exit. if (!filepath.EndsWith(XmlFileExtension) || !File.Exists(filepath)) { Debug.WriteLine(BadXmlError1 + filepath + BadXmlError2); return(false); } XmlReader reader = XmlReader.Create(filepath); while (reader.Read()) { if (!reader.IsStartElement()) { continue; } if (reader.LocalName == RootLocalName) { LevelType t; //Get level background if (TryGetLevelTypeFromEnum(reader.GetAttribute(LevelTypeAttr), out t) && levelBackdrops.ContainsKey(t)) { levelBackground = levelBackdrops[t]; } //Create camera based on camera type CameraType cType; if (TryGetCameraTypeFromEnum(reader.GetAttribute(CameraTypeAttr), out cType) && cameraTypes.ContainsKey(cType)) { int xPos, yPos; if (int.TryParse(reader.GetAttribute(CameraXPosAttr), out xPos) && int.TryParse(reader.GetAttribute(CameraYPosAttr), out yPos)) { mainCamera = cameraTypes[cType].Invoke(xPos, yPos); } else { mainCamera = cameraTypes[cType].Invoke(Zero, Zero); } } } //NOTE: The order of players in the XML file is the player number they are (first occurence is player 1, second is player 2, etc.) else if (reader.LocalName == PlayersLocalName) { RetrieveAllChildElementsFromReader <IPlayer>(ref reader, PlayerChildElementName, TryCreatePlayerFromEnum, out players); } else if (reader.LocalName == EnemiesLocalName) { RetrieveAllChildElementsFromReader <IEnemy>(ref reader, EnemyChildElementName, TryCreateEnemyFromEnum, out enemies); } //Tile uses its own logic temporarily, until we add in optional parameters to RetrieveAllChildElementsFromReader() next sprint. else if (reader.LocalName == TilesLocalName) { if (!reader.ReadToDescendant(TileChildElementName)) { continue; } //Add first tile element List <ITile> newTiles = new List <ITile>(); List <IItem> newItems = new List <IItem>(); int posX, posY; if (int.TryParse(reader.GetAttribute(PosXAttr), out posX) && int.TryParse(reader.GetAttribute(PosYAttr), out posY) && TryCreateTileFromEnum(reader, reader.GetAttribute(TypeAttr), reader.GetAttribute(RepeatAttr), reader.GetAttribute(RepeatSpaceAttr), posX, posY, out newTiles, out newItems)) { tiles.AddRange(newTiles); items.AddRange(newItems); } //Add all subsequent elements while (reader.ReadToNextSibling(TileChildElementName)) { if (int.TryParse(reader.GetAttribute(PosXAttr), out posX) && int.TryParse(reader.GetAttribute(PosYAttr), out posY) && TryCreateTileFromEnum(reader, reader.GetAttribute(TypeAttr), reader.GetAttribute(RepeatAttr), reader.GetAttribute(RepeatSpaceAttr), posX, posY, out newTiles, out newItems)) { tiles.AddRange(newTiles); items.AddRange(newItems); } } } else if (reader.LocalName == ItemsLocalName) { List <IItem> newItems; RetrieveAllChildElementsFromReader <IItem>(ref reader, ItemChildElementName, TryCreateItemFromEnum, out newItems); items.AddRange(newItems); } else { Debug.WriteLine(BadXmlElementError1 + filepath + BadXmlElementError2 + reader.LocalName); } } return(true); }
public CameraThingLostListener(ICamera cameraThing) { CameraThingy = cameraThing; }
public CameraThingDiscoveredListener(ICamera cameraThing) { CameraThingy = cameraThing; }
private void start(bool isCameraStart = true) { labelMsg.Visible = true; #if (TRACE) ds = new DataSet("trace"); dtBlow = new DataTable("blow"); dtBlow.Columns.Add("id", typeof(int)); dtBlow.Columns.Add("valve", typeof(int)); dtBlow.Columns.Add("sec", typeof(int)); dtBlow.Columns.Add("milisec", typeof(int)); dtSensor = new DataTable("sensor"); dtSensor.Columns.Add("id", typeof(int)); dtSensor.Columns.Add("valve", typeof(int)); dtSensor.Columns.Add("sec", typeof(int)); dtSensor.Columns.Add("milisec", typeof(int)); ds.Tables.Add(dtBlow); ds.Tables.Add(dtSensor); // ds.Relations.Add("relation_id", dtBlow.Columns["id"], dtSensor.Columns["id"]);/**/ #endif // detectors { valves.init(); if (true) { detectorMaster = new detect_blobs(new ColorRange("Red"), (ThresholdType)cbBinMethodMaster.SelectedIndex, (byte)trBinValMaster.Value, 255, 2, true); if (!checkBoxIsUseCore.Checked) { detectorMaster.NewBlobs += new detect_blobs.DetectNewBlobHandle(masterBlobsHaveAdded); emulationZeroSample4Master(); // first sample detected long time -> emulate firs/t sample & delete it ................. if (cfg.isShowFrameRgb) { detectorMaster.ShowFrameRgb += new detect_blobs.ShowImageHandle(masterShowFrameRgb); // slowing - don't use } if (cfg.isShowFrameBin) { detectorMaster.ShowFrameBin += new detect_blobs.ShowImageHandle(masterShowFrameBin); } timerM.Start(); } } #if (DEMO) cbCamMS.Checked = true; #endif if (cbCamMS.Checked) { if (MSLink == null) { MSLink = new List <long[]>(); } linkMS = new comparator(); linkMS.ComplitParticle += new comparator.ComplitReorddHandle(complectMSCompare); detectorSlave = new detect_blobs(new ColorRange("Red"), (ThresholdType)cbBinMethodMaster.SelectedIndex, (byte)trBinValMaster.Value, 255, 2, false); if (!checkBoxIsUseCore.Checked) { detectorSlave.NewBlobs += new detect_blobs.DetectNewBlobHandle(slaveBlobsHaveAdded); emulationZeroSample4Slave(); // first sample detected long time -> emulate first sample & delete it ................. if (cfg.isShowFrameRgb) { detectorSlave.ShowFrameRgb += new detect_blobs.ShowImageHandle(slaveShowFrameRgb); // slowing - don't use } if (cfg.isShowFrameBin) { detectorSlave.ShowFrameBin += new detect_blobs.ShowImageHandle(slaveShowFrameBin); } timerS.Start(); } } } cbBinMethodMaster.SelectedItem = detectorMaster.ThresholdType_METHOD; trBinValMaster.Value = detectorMaster.ThresholdType_VAL; if (isCameraStart) { #if (DEMO) cbCamOne.Checked = true; #endif // camera engine if (cbCamOne.Checked) { drv = new IDS(); drv.Init(((IDS)drv).GetNoInDeviceList(cfg.CameraMaster), -1, -1, 24, dpsMaster.pbLife, IntPtr.Zero); } else { drv = new IDSMS(); ((IDSMS)drv).SetCameraID(cfg.CameraMaster, 1); drv.Init(0, -1, -1, 24, dpsSlave.pbLife, dpsMaster.pbLife.Handle); ((IDSMS)drv).ImageCapturedSlave += new CameraBridgeEventHandler(cameraSlaveCapture); } // device HidController.Controller.Start(cfg.FrontLight, (int)cfg.BackLigth, cfg.VibroVal, cfg.VibroVal2); HidController.Controller.BlowSetTime(cfg.BlowInterval); HidController.Controller.SensorsClear(); drv.TurnON(); drv.ImageCaptured += new CameraBridgeEventHandler(cameraMasterCapture); if (cbCamOne.Checked) { valves.init(((IDS)drv).GetWidth(), ((IDS)drv).GetWidth()); } else { valves.init(((IDSMS)drv).GetMasterWidth(), ((IDSMS)drv).GetSlaveWidth()); } #if (DEMO) cbCamMS.Checked = true; timerDEMO.Start(); #endif labelMsg.Visible = false; clearCounters(); #if (TRACE) dtSensor.Rows.Clear(); dtBlow.Rows.Clear(); cntBlow = 0; #endif } }
public void OnGainedCameraFocus(ICamera cam) { }
public PlanetView(ICamera camera) { _camera = camera; Loaded = false; }
public void UpdateInFrustum(ICamera par1ICamera) { IsInFrustum = par1ICamera.IsBoundingBoxInFrustum(RendererBoundingBox); }
public void Flight() { //Get IMessageDispatcher interface IMessageDispatcher pMessageDispatcher; pMessageDispatcher = new MessageDispatcherClass(); //Set the ESC key to be seen as a cancel action pMessageDispatcher.CancelOnClick = false; pMessageDispatcher.CancelOnEscPress = true; //Get the scene graph ISceneGraph pSceneGraph = (ISceneGraph)m_pSceneHookHelper.SceneGraph; //Get the scene viewer ISceneViewer pSceneViewer = (ISceneViewer)m_pSceneHookHelper.ActiveViewer; //Get the camera ICamera pCamera = (ICamera)m_pSceneHookHelper.Camera; bCancel = false; do { //Get the elapsed time double dlastFrameDuration, dMeanFrameRate; pSceneGraph.GetDrawingTimeInfo(out dlastFrameDuration, out dMeanFrameRate); if (dlastFrameDuration < 0.01) { dlastFrameDuration = 0.01; } if (dlastFrameDuration > 1) { dlastFrameDuration = 1; } //Windows API call to get windows client coordinates Rectangle rect = new Rectangle(); if (GetClientRect(m_pSceneHookHelper.ActiveViewer.hWnd, ref rect) == 0) { return; } //Get normal vectors double dXMouseNormal, dYMouseNormal; dXMouseNormal = 2 * ((double)m_lMouseX / (double)rect.Right) - 1; dYMouseNormal = 2 * ((double)m_lMouseY / (double)rect.Bottom) - 1; //Set elevation and azimuth in radians for normal rotation m_dElevation = m_dElevation - (dlastFrameDuration * dYMouseNormal * Math.Abs(dYMouseNormal)); m_dAzimut = m_dAzimut - (dlastFrameDuration * dXMouseNormal * Math.Abs(dXMouseNormal)); if (m_dElevation > 0.45 * 3.141592) { m_dElevation = 0.45 * 3.141592; } if (m_dElevation < -0.45 * 3.141592) { m_dElevation = -0.45 * 3.141592; } if (m_dAzimut < 0) { m_dAzimut = m_dAzimut + (2 * 3.141592); } if (m_dAzimut > 2 * 3.141592) { m_dAzimut = m_dAzimut - (2 * 3.141592); } double dx, dy, dz; dx = Math.Cos(m_dElevation) * Math.Cos(m_dAzimut); dy = Math.Cos(m_dElevation) * Math.Sin(m_dAzimut); dz = Math.Sin(m_dElevation); //Change the viewing directions (target) m_pPointTgt.X = m_pPointObs.X + (m_dDistance * dx); m_pPointTgt.Y = m_pPointObs.Y + (m_dDistance * dy); m_pPointTgt.Z = m_pPointObs.Z + (m_dDistance * dz); //Move the camera in the viewing directions m_pPointObs.X = m_pPointObs.X + (dlastFrameDuration * (2 ^ m_iSpeed) * m_dMotion * dx); m_pPointObs.Y = m_pPointObs.Y + (dlastFrameDuration * (2 ^ m_iSpeed) * m_dMotion * dy); m_pPointTgt.X = m_pPointTgt.X + (dlastFrameDuration * (2 ^ m_iSpeed) * m_dMotion * dx); m_pPointTgt.Y = m_pPointTgt.Y + (dlastFrameDuration * (2 ^ m_iSpeed) * m_dMotion * dy); m_pPointObs.Z = m_pPointObs.Z + (dlastFrameDuration * (2 ^ m_iSpeed) * m_dMotion * dz); m_pPointTgt.Z = m_pPointTgt.Z + (dlastFrameDuration * (2 ^ m_iSpeed) * m_dMotion * dz); pCamera.Observer = m_pPointObs; pCamera.Target = m_pPointTgt; //Set the angle of the camera about the line of sight between the observer and target pCamera.RollAngle = 10 * dXMouseNormal * Math.Abs(dXMouseNormal); //Redraw the scene viewer pSceneViewer.Redraw(true); object objCancel; //Dispatch any waiting messages: OnMouseMove / OnMouseUp / OnKeyUp events //object objCancel = bCancel as object; pMessageDispatcher.Dispatch(m_pSceneHookHelper.ActiveViewer.hWnd, false, out objCancel); //End flight if ESC key pressed if (bCancel == true) { EndFlight(); } }while(m_bInUse == true && bCancel == false); bCancel = false; }
public void Draw(GameTime gameTime, ICamera camera) { model.Draw(LocalToWorld, camera.View, camera.Projection); }
public SpriteRenderLayer(ICamera camera) { m_camera = camera; }
public void SetMatrices(Matrix objectTransform, ICamera camera) { _effect.FxWorldViewProj.SetMatrix(objectTransform * camera.ViewProj); // _effect.FxWorld.SetMatrix(objectTransform); }
protected void AddToWorld(ICamera obj) { world.CameraManager.AddCamera(obj); }
/// <summary> /// Create the axis /// </summary> /// <param name="graphicsDevice">Used to create the graphics objects</param> /// <param name="axisLenght">Positive lenght of the axis</param> /// <param name="coloAxisX">Color of the x axis</param> /// <param name="coloAxisY">Color of the y axis</param> /// <param name="coloAxisZ">Color of the z axis</param> /// <param name="camera">Camera used to draw the axis in projection</param> public CartesianAxis(GraphicsDevice graphicsDevice, float axisLenght, Color coloAxisX, Color coloAxisY, Color coloAxisZ, ICamera camera) { this.camera = camera; axisX = new VertexPositionColor[2]; axisX[0] = new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), coloAxisX); axisX[1] = new VertexPositionColor(new Vector3(axisLenght, 0.0f, 0.0f), coloAxisX); axisY = new VertexPositionColor[2]; axisY[0] = new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), coloAxisY); axisY[1] = new VertexPositionColor(new Vector3(0.0f, axisLenght, 0.0f), coloAxisY); axisZ = new VertexPositionColor[2]; axisZ[0] = new VertexPositionColor(new Vector3(0.0f, 0.0f, 0.0f), coloAxisZ); axisZ[1] = new VertexPositionColor(new Vector3(0.0f, 0.0f, axisLenght), coloAxisZ); this.IsEnabled = true; basicEffect = new BasicEffect(graphicsDevice); updateEffect(); }
public virtual void Render(ICamera camera) { }
public void Begin(ICamera camera) { _viewProjection = camera.ViewProjection; }
public void Draw(SpriteBatch spriteBatch, ICamera camera) { this.Sprite.Draw(spriteBatch, camera); }
public void StartFrame(ICamera cam, RenderState rs) { camera = cam; rstate = rs; lineVertices = 0; }
private void axSceneControl_OnMouseWheel(object sender, MouseEventArgs e) { try { System.Drawing.Point pSceLoc = axSceneControl1.PointToScreen(this.axSceneControl1.Location); System.Drawing.Point Pt = this.PointToScreen(e.Location); if (Pt.X < pSceLoc.X || Pt.X > pSceLoc.X + axSceneControl1.Width || Pt.Y < pSceLoc.Y || Pt.Y > pSceLoc.Y + axSceneControl1.Height) { return; } double scale = 0.2; if (e.Delta < 0) { scale = -0.2; } ICamera pCamera = axSceneControl1.Camera; IPoint pPtObs = pCamera.Observer; IPoint pPtTar = pCamera.Target; IPoint point; //point= pCamera.Target; point = pCamera.Observer; IEnvelope pEnv = new EnvelopeClass(); pEnv.XMax = point.X + 5; pEnv.XMin = point.X - 5; pEnv.YMax = point.Y + 5; pEnv.YMin = point.Y - 5; pPtObs.X += (pPtObs.X - pPtTar.X) * scale; pPtObs.Y += (pPtObs.Y - pPtTar.Y) * scale; pPtObs.Z += (pPtObs.Z - pPtTar.Z) * scale; pCamera.Observer = pPtObs; axSceneControl1.SceneGraph.RefreshViewers(); //pEnv.XMax = e.X + 5; //pEnv.XMin = e.X - 5; //pEnv.YMax = e.Y + 5; //pEnv.YMin = e.Y - 5; IRectangleElement pRectangleEle = new RectangleElementClass(); IElement pEle = pRectangleEle as IElement; pEle.Geometry = pEnv; //设置线框的边线对象,包括颜色和线宽 IRgbColor pColor = new RgbColorClass(); pColor.Red = 238; pColor.Green = 99; pColor.Blue = 99; pColor.Transparency = 255; // 产生一个线符号对象 ILineSymbol pOutline = new SimpleLineSymbolClass(); pOutline.Width = 2; pOutline.Color = pColor; // 设置颜色属性 pColor.Red = 238; pColor.Green = 99; pColor.Blue = 99; pColor.Transparency = 0; // 设置线框填充符号的属性 IFillSymbol pFillSymbol = new SimpleFillSymbolClass(); pFillSymbol.Color = pColor; pFillSymbol.Outline = pOutline; IFillShapeElement pFillShapeEle = pEle as IFillShapeElement; pFillShapeEle.Symbol = pFillSymbol; // 得到鹰眼视图中的图形元素容器 IGraphicsContainer pGra = axMapControl1.Map as IGraphicsContainer; IActiveView pAv = pGra as IActiveView; // 在绘制前,清除 axMapControl1 中的任何图形元素 pGra.DeleteAllElements(); // 鹰眼视图中添加线框 pGra.AddElement((IElement)pFillShapeEle, 0); // 刷新鹰眼 pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); } catch { } }
public void OnLostCameraFocus(ICamera cam) { }
public void SetCamera(ICamera cam) { camera = cam; }
public override bool OutOfView(ICamera camera) { return(false); }
public override bool PrepareRender(ICamera camera, NebulaRenderer nr, SystemRenderer sys) { sys.AddObject(this); return(true); }
void tea_OnUpdate(IObject obj, GameTime gt, ICamera cam) { obj.PhysicObject.Rotation *= Matrix.CreateRotationY(0.02f); obj.PhysicObject.Rotation *= Matrix.CreateRotationZ(0.02f); }
protected SamplerIntegrator(ICamera camera, ISampler sampler, in PixelArea pixelBounds)
public Executor(IJavaScriptExecutor javaScriptExecutor, IElementFinder finder, ICamera camera) { if (javaScriptExecutor == null) { throw new ArgumentNullException("javaScriptExecutor"); } if (finder == null) { throw new ArgumentNullException("finder"); } if (camera == null) { throw new ArgumentNullException("camera"); } _javaScriptExecutor = javaScriptExecutor; _finder = finder; _camera = camera; }
protected abstract bool Is2Add(int i, MyPMX pmx, VertexSelect vS, ICamera camera);
public void Draw(SpriteBatch spriteBatch, ICamera camera) { this.CurrentState.Draw(spriteBatch, camera); }
public void Update(ICamera camera, TimeSpan delta, TimeSpan totalTime) { Levels[0].Update(camera, delta); }
public void Update(ICamera camera, double delta) { if (ready) foreach (FaceGroup faceGroup in FaceGroups) faceGroup.Update (camera); }
public ViewTransformProvider(ICamera camera) { Camera = camera; }