void Go() { string sText = SiteBox.Text; if (string.IsNullOrEmpty(sText)) { return; } sText = sText.Trim(); SiteBox.Text = sText; Vector3d dest = Decoder.Decode(sText); if (Globals.Network.Connected == true) { MMessageBus.TeleportRequest(this, dest, Globals.LocalUpRotation()); } else { MScene.Camera.transform.Position = dest; Globals.UserAccount.CurrentPosition = MassiveTools.ArrayFromVector(dest); Globals.Avatar.SetPosition(dest); MMessageBus.AvatarMoved(this, Globals.UserAccount.UserID, dest, Quaterniond.Identity); } MMessageBus.Navigate(this, dest); }
private void setGPSToolStripMenuItem_Click(object sender, EventArgs e) { Button b = (Button)contextMenuStrip1.SourceControl; if (b != null) { MBookmark bm = (MBookmark)b.Tag; if (bm != null) { MMessageBus.Navigate(this, MassiveTools.VectorFromArray(bm.Position)); } } }
private void AssetsView_SelectionChanged(object sender, EventArgs e) { //DataGridViewSelectedRowCollection col = AssetsView.SelectedRows; DataGridViewSelectedCellCollection col = AssetsView.SelectedCells; if (col.Count > 0) { MSceneObject mo = (MSceneObject)col[0].OwningRow.DataBoundItem; MMessageBus.Navigate(this, mo.transform.Position); MMessageBus.Select(this, new SelectEvent(mo)); } }
private void Navigate_Click(object sender, EventArgs e) { double height = 0; if (MPlanetHandler.CurrentNear != null) { height = MPlanetHandler.CurrentNear.DistanceToAvatar; } Vector3d LatLon = GetLonLatInMeters(height); MMessageBus.Navigate(this, LatLon); }
public static void SetTimeOfDay(double _time) { time = _time; MAstroBody Sol = MPlanetHandler.Get("Sol"); Quaterniond q = Quaterniond.FromEulerAngles(0, (15 * time) * Math.PI / 180.0, 0); MSceneObject mo = (MSceneObject)MScene.AstroRoot.FindModuleByName("Sol"); mo.SetPosition(q * new Vector3d(Sol.DistanceToAvatar, 0, 0)); MMessageBus.Navigate(null, mo.transform.Position); double ottime = (time + timeOffset) % 24; float f24 = (float)Math.Sin((ottime * 15.0) * Math.PI / 180.0); //f24 = Math.Min((float)Math.Pow(f24, 0.2), 1); f24 = Math.Max(f24, 0.02f); MScene.light.Ambient = new Vector3(f24, f24, f24); }
private void MapBox_MouseClick(object sender, MouseEventArgs e) { WorldLocationPoint = MapTo3D(e.X, e.Y); ClickPoint = e.Location; MMessageBus.Navigate(this, WorldLocationPoint); Console.WriteLine("Validate"); if (bmp == null) { return; } Bitmap bmp2 = new Bitmap(bmp); Pen RedPen = new Pen(Color.Red); RedPen.Width = 2; Graphics g = Graphics.FromImage(bmp2); float posx = (float)ClickPoint.X / (float)MapBox.Width * (float)bmp.Width; float posy = (float)ClickPoint.Y / (float)MapBox.Height * (float)bmp.Height; Rectangle rec = new Rectangle((int)posx - 7, (int)posy - 7, 15, 15); g.DrawRectangle(RedPen, rec); RedPen.Dispose(); g.Dispose(); MapBox.BackgroundImage = bmp2; Invalidate(new Rectangle(ClickPoint.X - 2, ClickPoint.Y - 2, 5, 5)); Vector3d Pos3d = MapTo3D(e.X, MapBox.Height - e.Y); Vector3d uv = CurrentBody.GetUVPointOnSphere(Pos3d); Vector3d lonlat = CurrentBody.GetLonLatOnShere(Pos3d); Vector3d tile = CurrentBody.GetTileFromPoint(Pos3d); WorldLocationPoint = CurrentBody.LonLatToUniPosition(lonlat.X, lonlat.Y, 0); MTerrainBoundary tb = CurrentBody.GetTileBoundaryLonLat((int)tile.X, (int)tile.Y, (int)tile.Z); WorldLocationPoint = Pos3d; WorldCoords.Text = " pos:" + Pos3d.ToString() + "\r\n" // + " uv:" + uv.ToString() + "\r\n" + " lonlat:" + lonlat.ToString() + "\r\n" + " Tile: " + tile.ToString() + "\r\n" // + " Bounds: " + tb.ToString() + "\r\n" // + " Round Trip: " + WorldLocationPoint.ToString() ; }