public TilesGisLayer(Game engine, GlobeCamera camera) : base(engine) { RegisterMapSources(); CurrentMapSource = MapSources[9]; this.camera = camera; frame = Game.Content.Load<Texture2D>("redframe.tga"); shader = Game.Content.Load<Ubershader>("globe.Tile.hlsl"); factory = shader.CreateFactory( typeof(TileFlags), Primitive.TriangleList, VertexInputElement.FromStructure<Gis.GeoPoint>(), BlendState.AlphaBlend, RasterizerState.CullCW, DepthStencilState.Default); }
public TextGisLayer(Game game, int capacity, GlobeCamera camera) : base(game) { GlobeCamera = camera; TextSpriteLayer = new SpriteLayer(Game.RenderSystem, 2048); GeoTextArray = new GeoText[capacity]; LinesCountToDraw = capacity; Font = Game.Content.Load<DiscTexture>("conchars"); //spriteFont = Game.Content.Load<SpriteFont>(@"Fonts\textFont"); MinZoom = 6380; MaxZoom = 6500; Scale = 1.0f; MaxScale = 1.5f; }
public void Update(GameTime gameTime, GlobeCamera camera = null) { if (TextureAtlas == null) return; var curCamera = camera ?? Game.RenderSystem.Gis.Camera; dotsData.View = curCamera.ViewMatrixFloat; dotsData.Proj = curCamera.ProjMatrixFloat; dotsData.AtlasSizeImgSize = new Vector4(TextureAtlas.Width, TextureAtlas.Height, ImageSizeInAtlas.X, ImageSizeInAtlas.Y); dotsData.SizeMult = new Vector4(SizeMultiplier); DotsBuffer.SetData(dotsData); }
/// <summary> /// Creates ViewLayer instance /// </summary> /// <param name="Game">Game engine</param> public RenderLayer ( Game game ) { Game = game; this.rs = Game.RenderSystem; Visible = true; Order = 0; Camera = new Camera(); SpriteLayers = new SpriteLayerCollection(); GisLayers = new List<Gis.GisLayer>(); GlobeCamera = new GlobeCamera(Game); }
public override void Initialize() { constBuffer = new ConstantBuffer(Game.GraphicsDevice, typeof(ConstData)); #region Test input region Camera = new GlobeCamera(Game); Camera.Viewport = new Viewport(0, 0, Game.GraphicsDevice.DisplayBounds.Width, Game.GraphicsDevice.DisplayBounds.Height); Camera.GoToPlace(GlobeCamera.Places.SaintPetersburg_VO); //Game.GraphicsDevice.DisplayBoundsChanged += // (sender, args) => // Camera.Viewport = // new Viewport(0, 0, Game.GraphicsDevice.DisplayBounds.Width, // Game.GraphicsDevice.DisplayBounds.Height); // Input bindings Game.Mouse.Scroll += (sender, args) => { if(args.WheelDelta > 0) Camera.CameraZoom(-0.05f); else if(args.WheelDelta < 0) Camera.CameraZoom(0.05f); }; Game.Mouse.Move += (sender, args) => { if (Game.InputDevice.IsKeyDown(Keys.LeftButton)) { DVector2 before, after; var beforeHit = Camera.ScreenToSpherical(previousMousePosition.X, previousMousePosition.Y, out before); var afterHit = Camera.ScreenToSpherical(args.Position.X, args.Position.Y, out after); if (beforeHit && afterHit) { Camera.Yaw -= after.X - before.X; Camera.Pitch += after.Y - before.Y; } } if(Game.InputDevice.IsKeyDown(Keys.MiddleButton) && Camera.CameraState == GlobeCamera.CameraStates.ViewToPoint) { Camera.RotateViewToPointCamera(Game.InputDevice.RelativeMouseOffset); } if(Game.InputDevice.IsKeyDown(Keys.RightButton) && Camera.CameraState == GlobeCamera.CameraStates.FreeSurface) { Camera.RotateFreeSurfaceCamera(Game.InputDevice.RelativeMouseOffset); } previousMousePosition = new Vector2(args.Position.X, args.Position.Y); }; #endregion //Points = new PointsGisBatch(Game, 100) //{ // ImageSizeInAtlas = new Vector2(36, 36), // TextureAtlas = Game.Content.Load<Texture2D>("circles.tga") //}; // //var r = new Random(); // //for (int i = 0; i < Points.PointsCpu.Length; i++) { // Points.PointsCpu[i] = new GeoPoint { // Lon = DMathUtil.DegreesToRadians(30.301419 + 0.125 * r.NextDouble()), // Lat = DMathUtil.DegreesToRadians(59.942562 + 0.125 * r.NextDouble()), // Color = Color.White, // Tex0 = new Vector4(r.Next(0, 10), 0, 0.5f, 3.14f) // }; //} //Points.UpdatePointsBuffer(); //lines = new LinesGisBatch(Game, 2, true); // //lines.PointsCpu[0] = new GeoPoint //{ // Lon = DMathUtil.DegreesToRadians(29), // Lat = DMathUtil.DegreesToRadians(59), // Color = Color.White, // Tex0 = new Vector4(1, 1, 1, 1) //}; //lines.PointsCpu[1] = new GeoPoint //{ // Lon = DMathUtil.DegreesToRadians(30), // Lat = DMathUtil.DegreesToRadians(60), // Color = Color.White, // Tex0 = new Vector4(1, 1, 1, 1) //}; //lines.UpdatePointsBuffer(); //heatMap = PolyGisBatch.GenerateRegularGrid(30.165024, 30.332521, 59.965494, 59.911272, 10, 64, 64, Globe.CurrentMapSource.Projection); //heatMap.MaxHeatMapLevel = 1.0f; //heatMap.InterpFactor = 1.0f; // //heatMap.ClearData(); //for (int i = 0; i < 100; i++) { // heatMap.AddValue(r.NextDouble(heatMap.Left, heatMap.Right), r.NextDouble(heatMap.Bottom, heatMap.Top), 10.0f); //} // //heatMap.UpdateHeatMap(); }