public void SetParameterValue(string p, SharpDX.Vector3 value) { if (HasParameter(p)) { effect.Parameters[p].SetValue(value); } }
/// <summary> /// Set a three-component vector that contains floating-point data. /// </summary> /// <param name="value">A reference to the first component. </param> /// <returns>Returns one of the following {{Direct3D 10 Return Codes}}. </returns> /// <unmanaged>HRESULT ID3D11EffectVectorVariable::SetFloatVector([In] float* pData)</unmanaged> public void Set(SharpDX.Vector3 value) { unsafe { SetRawValue(new IntPtr(&value), 0, Utilities.SizeOf <SharpDX.Vector3>()); } }
public static Vector3 DXToUnityVector3(SharpDX.Vector3 dx, Vector3 v) { v.x = dx.X; v.y = dx.Y; v.z = dx.Z; return(v); }
protected override void OnScaleChanged(Vector3 scale) { if (m_physicsMesh != null) { Owner.MarkStaticColliderDirty(); } }
protected override void OnPositionChanged(Vector3 position) { if (m_physicsMesh != null) { Owner.MarkStaticColliderDirty(); } }
/// <summary> /// Converts in-world coordinates to screen coordinates (upper left corner origin). /// </summary> /// <param name="worldPos">Coordinates in the world.</param> /// <param name="screenPos">Converted coordinates.</param> /// <returns>True if worldPos corresponds to a position in front of the camera.</returns> public bool WorldToScreen(SharpDX.Vector3 worldPos, out SharpDX.Vector2 screenPos) { // Get base object with matrices var matrixSingleton = this.getMatrixSingleton(); // Read current ViewProjectionMatrix plus game window size var viewProjectionMatrix = default(SharpDX.Matrix); float width, height; var windowPos = ImGuiHelpers.MainViewport.Pos; unsafe { var rawMatrix = (float *)(matrixSingleton + 0x1b4).ToPointer(); for (var i = 0; i < 16; i++, rawMatrix++) { viewProjectionMatrix[i] = *rawMatrix; } width = *rawMatrix; height = *(rawMatrix + 1); } SharpDX.Vector3.Transform(ref worldPos, ref viewProjectionMatrix, out SharpDX.Vector3 pCoords); screenPos = new SharpDX.Vector2(pCoords.X / pCoords.Z, pCoords.Y / pCoords.Z); screenPos.X = (0.5f * width * (screenPos.X + 1f)) + windowPos.X; screenPos.Y = (0.5f * height * (1f - screenPos.Y)) + windowPos.Y; return(pCoords.Z > 0 && screenPos.X > windowPos.X && screenPos.X < windowPos.X + width && screenPos.Y > windowPos.Y && screenPos.Y < windowPos.Y + height); }
public static SharpDX.Vector3[] Vector3EUCtoSDX(MathObjects.Vector3[] vec) { SharpDX.Vector3[] vecs = new SharpDX.Vector3[vec.Length]; for (int i = 0; i < vecs.Length; i++) vecs[i] = Vector3EUCtoSDX(vec[i]); return vecs; }
// Project takes some 3D coordinates and transform them // in 2D coordinates using the transformation matrix private ScreenPoint Project(ref DeviceComponent deviceComponent, SharpDX.Vector3 coord, Matrix transMat) { // transforming the coordinates var point = SharpDX.Vector3.TransformCoordinate(coord, transMat); var z = point.Z; if (_farZ > z) { _farZ = z; } if (_nearZ < z) { _nearZ = z; } //Console.WriteLine(point); // The transformed coordinates will be based on coordinate system // starting on the center of the screen. But drawing on screen normally starts // from top left. We then need to transform them again to have x:0, y:0 on top left. var x = point.X * deviceComponent.BmpWidth + deviceComponent.BmpWidth / 2f; var y = -point.Y * deviceComponent.BmpHeight + deviceComponent.BmpHeight / 2f; return(new ScreenPoint(new Vector2Int((int)x, (int)y), z)); }
private async void StartSimpleRun() { //var acd = ActorCommonDataHelper.EnumerateMonsters().Where(x => x.x004_Name.StartsWith("Templar")); //var localAcd = acd.Last(); while (IsBotRunning) { var target = Targeting.GetTarget(); if (target != null) { Vector3 currentCharGameLoc = new Vector3() { X = target.x0D0_WorldPosX, Y = target.x0D4_WorldPosY, Z = target.x0D8_WorldPosZ }; var moveToResult = await Core.Util.MoveTo.MoveToPosWithNavMeshAsync(currentCharGameLoc); } } //foreach (var acd in ActorCommonDataHelper.EnumerateMonsters().Where(x => x.x0D0_WorldPosX > 0 && x.x188_Hitpoints > 00001 && x.x190_TeamId == 10)) //{ // Vector3 currentCharGameLoc = new Vector3() { X = acd.x0D0_WorldPosX, Y = acd.x0D4_WorldPosY, Z = acd.x0D8_WorldPosZ }; // var moveToResult = await Core.Util.MoveTo.MoveToPosWithNavMeshAsync(currentCharGameLoc); // // await Core.Util.Attack.AttackAcdAsync(acd); // if (!IsBotRunning) // return; //} }
public bool IsVisible(Vector3 start, Vector3 end) { Vector3 vDirection = end - start; Vector3 vPoint = start; int iStepCount = (int)vDirection.Length(); vDirection /= iStepCount; Leaf pLeaf = new Leaf() { area = -1 }; while (iStepCount > 0) { vPoint += vDirection; pLeaf = GetLeafForPoint(vPoint); if (pLeaf.area != -1) { if ( (pLeaf.contents & ContentsFlag.CONTENTS_SOLID) == ContentsFlag.CONTENTS_SOLID || (pLeaf.contents & ContentsFlag.CONTENTS_DETAIL) == ContentsFlag.CONTENTS_DETAIL) { break; } } iStepCount--; } return((pLeaf.contents & ContentsFlag.CONTENTS_SOLID) != ContentsFlag.CONTENTS_SOLID); }
private void CreateMachinespace() { var machinespace = new LineBuilder(); Vector3 p0machine = new Vector3(0, 0, 0); Vector3 p1machine = new Vector3(0 - (float)App.Grbl.MaxXDistance, 0, 0); Vector3 p2machine = new Vector3(0 - (float)App.Grbl.MaxXDistance, 0 - (float)App.Grbl.MaxYDistance, 0); Vector3 p3machine = new Vector3(0, 0 - (float)App.Grbl.MaxYDistance, 0); Vector3 p4machine = new Vector3(0, 0, 0 - (float)App.Grbl.MaxZDistance); Vector3 p5machine = new Vector3(0 - (float)App.Grbl.MaxXDistance, 0, 0 - (float)App.Grbl.MaxZDistance); Vector3 p6machine = new Vector3(0 - (float)App.Grbl.MaxXDistance, 0 - (float)App.Grbl.MaxYDistance, 0 - (float)App.Grbl.MaxZDistance); Vector3 p7machine = new Vector3(0, 0 - (float)App.Grbl.MaxYDistance, 0 - (float)App.Grbl.MaxZDistance); // machinespacelines.AddBox(new Vector3(0, 0, 0), App.Grbl.MaxXDistance, App.Grbl.MaxYDistance, App.Grbl.MaxZDistance); machinespace.AddLine(p0machine, p1machine); machinespace.AddLine(p0machine, p1machine); machinespace.AddLine(p1machine, p2machine); machinespace.AddLine(p2machine, p3machine); machinespace.AddLine(p3machine, p0machine); machinespace.AddLine(p4machine, p5machine); machinespace.AddLine(p5machine, p6machine); machinespace.AddLine(p6machine, p7machine); machinespace.AddLine(p7machine, p4machine); machinespace.AddLine(p0machine, p4machine); machinespace.AddLine(p1machine, p5machine); machinespace.AddLine(p2machine, p6machine); machinespace.AddLine(p3machine, p7machine); MachineSpace = machinespace.ToLineGeometry3D(); }
void Start() { _childCount = transform.childCount; _children = new List <Transform>(_childCount); _values = new SharpDX.Vector3[_childCount]; _default = new SharpDX.Vector3[_childCount]; _initialScale = new Vector3[_childCount]; _unityValues = new Vector3[_childCount]; int i = 0; foreach (Transform child in transform) { _children.Add(child); _initialScale[i] = child.localScale; _unityValues[i] = _initialScale[i]; _values[i] = new SharpDX.Vector3(_initialScale[i].x, _initialScale[i].y, _initialScale[i].z); _default[i] = _values[i]; i++; } }
public static async Task AttackAcdAsync(ActorCommonData acd) { var minHitsReached = acd.x188_Hitpoints; var dtHitReached = DateTime.Now; DateTime dtTimeout = DateTime.Now; while (acd.x188_Hitpoints > 00000.1) { if (DateTime.Now > dtTimeout.AddSeconds(30) || DateTime.Now > dtHitReached.AddSeconds(5)) { return; } var acdVector3 = new SharpDX.Vector3() { X = acd.x0D0_WorldPosX, Y = acd.x0D4_WorldPosY, Z = acd.x0D8_WorldPosZ }; await MoveTo.MoveToPosAsync(acdVector3); var screenPos = D3ToScreen.FromD3toScreenCoords(acdVector3); MouseEvents.LeftClick(screenPos.X, screenPos.Y); await Task.Delay(new Random().Next(100, 250)); if (acd.x188_Hitpoints < minHitsReached) { minHitsReached = acd.x188_Hitpoints; dtHitReached = DateTime.Now; } } }
public unsafe Vector2 WorldToScreen(Vector3 vec3, EntityWrapper entityWrapper) { Entity localPlayer = Game.IngameState.Data.LocalPlayer; var isplayer = localPlayer.Address == entityWrapper.Address && localPlayer.IsValid; var playerMoving = isplayer && localPlayer.GetComponent<Actor>().isMoving; float x, y; int addr = base.Address + 0xbc; fixed (byte* numRef = base.M.ReadBytes(addr, 0x40)) { Matrix4x4 matrix = *(Matrix4x4*)numRef; Vector4 cord = *(Vector4*)&vec3; cord.W = 1; cord = Vector4.Transform(cord, matrix); cord = Vector4.Divide(cord, cord.W); x = ((cord.X + 1.0f) * 0.5f) * Width; y = ((1.0f - cord.Y) * 0.5f) * Height; } var resultCord = new Vector2(x, y); if (playerMoving) { if (Math.Abs(oldplayerCord.X - resultCord.X) < 40 || (Math.Abs(oldplayerCord.X - resultCord.Y) < 40)) resultCord = oldplayerCord; else oldplayerCord = resultCord; } else if (isplayer) { oldplayerCord = resultCord; } return resultCord; }
private void MainForm_KeyDown(object sender, KeyEventArgs e) { if (tabControl1.SelectedTab == tabPage3 && pic3.Focused) { SharpDX.Vector3 camPosRel = new SharpDX.Vector3((float)Math.Sin(engineLevelExplorer.CamRot) * engineLevelExplorer.CamDis, engineLevelExplorer.CamHeight, (float)Math.Cos(engineLevelExplorer.CamRot) * engineLevelExplorer.CamDis); SharpDX.Vector3 camPosAbs = engineLevelExplorer.CamPos + camPosRel; SharpDX.Vector3 dir = -camPosRel; SharpDX.Vector3 side = SharpDX.Vector3.Cross(dir, SharpDX.Vector3.UnitY); dir.Normalize(); side.Normalize(); if (e.KeyCode == Keys.W) { engineLevelExplorer.CamPos += dir; } if (e.KeyCode == Keys.S) { engineLevelExplorer.CamPos -= dir; } if (e.KeyCode == Keys.A) { engineLevelExplorer.CamPos += side; } if (e.KeyCode == Keys.D) { engineLevelExplorer.CamPos -= side; } } }
/// <summary> /// The change camera width. /// </summary> /// <param name="delta"> /// The delta. /// </param> /// <param name="zoomAround"> /// The zoom around. /// </param> /// <param name="isTouch"></param> public void ZoomByChangingCameraWidth(double delta, Point3D zoomAround, bool isTouch = false) { if (!isTouch) { if (delta < -0.5) { delta = -0.5; } } switch (this.CameraMode) { case CameraMode.WalkAround: case CameraMode.Inspect: case CameraMode.FixedPosition: if (ChangeCameraDistance(ref delta, zoomAround)) { // Modify the camera width if (this.Camera is OrthographicCamera ocamera) { ocamera.Width *= Math.Pow(2.5, delta); } } break; } }
void Start() { _values = new SharpDX.Vector3[_children.Count]; _default = new SharpDX.Vector3[_children.Count]; _unityValues = new Vector3[_children.Count]; _initialPosition = new Vector3[_children.Count]; _children = new List <Transform>(_children.Count); int i = 0; foreach (Transform child in transform) { _children.Add(child); if (_coordinateSpace == Space.World) { _initialPosition[i] = child.position; } else if (_coordinateSpace == Space.Self) { _initialPosition[i] = child.localPosition; } _values[i] = new SharpDX.Vector3(_initialPosition[i].x, _initialPosition[i].y, _initialPosition[i].z); _default[i] = _values[i]; _unityValues[i] = _initialPosition[i]; i++; } }
public Leaf GetLeafForPoint(Vector3 point) { int node = 0; Node pNode; Plane pPlane; float d = 0.0f; while (node >= 0) { pNode = nodes[node]; pPlane = planes[pNode.planenum]; d = Vector3.Dot(point, pPlane.normal) - pPlane.distance; if (d > 0) { node = pNode.children[0]; } else { node = pNode.children[1]; } } return( (-node - 1) >= 0 && -node - 1 < leafs.Length ? leafs[-node - 1] : new Leaf() { area = -1, contents = ContentsFlag.CONTENTS_EMPTY } ); }
public MainViewModel() { EffectsManager = new EffectsManager(); var builder = new MeshBuilder(); builder.AddSphere(new Vector3(), 2); builder.AddTorus(5, 1); MeshModel = builder.ToMesh(); var lineBuilder = new LineBuilder(); lineBuilder.AddGrid(BoxFaces.All, 10, 10, 10, 10); LineModel = lineBuilder.ToLineGeometry3D(); var offset = new Vector3(-4, 0, 0); PointModel = new PointGeometry3D() { Positions = new Vector3Collection(MeshModel.Positions.Select(x => x + offset)) }; ExportCommand = new RelayCommand((o) => { Export(); }); ImportCommand = new RelayCommand((o) => { Import(); }); ExportSingleTechnique = new RelayCommand((o) => { Export(SelectedTechnique); }); }
public static async Task AttackAcdAsync(ActorCommonData acd) { var minHitsReached = acd.x188_Hitpoints; var dtHitReached = DateTime.Now; DateTime dtTimeout = DateTime.Now; while (acd.x188_Hitpoints > 00000.1) { if (DateTime.Now > dtTimeout.AddSeconds(30) || DateTime.Now > dtHitReached.AddSeconds(5)) return; var acdVector3 = new SharpDX.Vector3() { X = acd.x0D0_WorldPosX, Y = acd.x0D4_WorldPosY, Z = acd.x0D8_WorldPosZ }; await MoveTo.MoveToPosAsync(acdVector3); var screenPos = D3ToScreen.FromD3toScreenCoords(acdVector3); MouseEvents.LeftClick(screenPos.X, screenPos.Y); await Task.Delay(new Random().Next(100, 250)); if (acd.x188_Hitpoints < minHitsReached) { minHitsReached = acd.x188_Hitpoints; dtHitReached = DateTime.Now; } } }
public SkyLabel(RenderContext11 renderContext, Vector3d point, string text, LabelSytle style) { Text = text; Style = style; if (texture == null) { texture = Texture11.FromBitmap(Properties.Resources.circle, 0); } pos = point; center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(80); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned Text3d t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { // This will produce sky or orbit aligned text textBatch.Add(new Text3d(pos, new Vector3d(0, 1, 0), text, 20, .01)); } }
private void ComputeDisplayParametersForThumbnail() { if (currentConstellation == "Error") { return; } IPlace target = Constellations.ConstellationCentroids[currentConstellation]; Lineset boundries = Constellations.boundries[currentConstellation]; Vector3[] points = new Vector3[boundries.Points.Count]; Vector3[] pointsOut = new Vector3[boundries.Points.Count]; for (int i = 0; i < points.Length; i++) { points[i] = Coordinates.GeoTo3d(boundries.Points[i].Dec, boundries.Points[i].RA); } Matrix mat = Matrix.RotationY((float)(-(24 - (target.RA + 6)) / 12 * Math.PI)); mat = Matrix.Multiply(mat, Matrix.RotationX((float)(target.Lat / 180f * Math.PI))); mat = Matrix.Multiply(mat, Matrix.Scaling(50, -50, 50)); mat = Matrix.Multiply(mat, Matrix.Translation(48, 22, 0)); // mat.Translate(58, 33,0); Vector3.TransformCoordinate(points, ref mat, pointsOut); lines = new PointF[points.Length + 1]; int index = 0; foreach (Vector3 point in pointsOut) { lines[index++] = new PointF((float)point.X, (float)point.Y); } lines[index] = lines[0]; }
internal void ItemClick(Vector3 searchPoint, float distance) { if (LabelItemClicked == null) { return; } if (lastHoverIndex > -1) { LabelItemClicked.Invoke(lastHoverIndex); } searchPoint = -searchPoint; Vector3 dist; int closestItem = -1; int index = 0; foreach (Vector3 point in positions) { dist = searchPoint - point; if (dist.Length() < distance) { distance = dist.Length(); closestItem = index; } index++; } if (closestItem == -1) { return; } LabelItemClicked.Invoke(closestItem); }
private float Radius(Vector3 centerpoint, Vector3 point) { double dx = point.X - centerpoint.X; double dy = point.Y - centerpoint.Y; return((float)Math.Sqrt(Math.Pow(dx, 2.0) + Math.Pow(dy, 2.0))); }
/// <summary> /// Changes the camera position by the specified vector. /// </summary> /// <param name="delta">The translation vector in camera space (z in look direction, y in up direction, and x perpendicular to the two others)</param> /// <param name="stopOther">Stop other manipulation</param> public void MoveCameraPosition(Vector3D delta, bool stopOther = true) { if (stopOther) { this.Controller.StopSpin(); this.Controller.StopPanning(); } var z = this.Camera.CameraInternal.LookDirection; z.Normalize(); var x = Vector3D.Cross(this.Camera.CameraInternal.LookDirection, this.Camera.CameraInternal.UpDirection); var y = Vector3D.Cross(x, z); y.Normalize(); x = Vector3D.Cross(z, y); // delta *= this.ZoomSensitivity; switch (this.CameraMode) { case CameraMode.Inspect: case CameraMode.WalkAround: this.Camera.Position += (x * delta.X) + (y * delta.Y) + (z * delta.Z); break; } }
public static double getDistanceBetween(SharpDX.Vector3 vec1, SharpDX.Vector3 vec2) { float xdiff = vec1.X - vec2.X; float ydiff = vec1.Y - vec1.Y; return(Math.Sqrt((xdiff * xdiff) + (ydiff * ydiff))); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if ((values != null) && (values.Count() == 2) && (values[0] is MDB.Point p1) && (values[1] is MDB.Point p2)) { var builder = new LineBuilder(); var v1 = new SharpDX.Vector3((float)p1.X, (float)p1.Y, (float)p1.Z); var v2 = new SharpDX.Vector3((float)p2.X, (float)p2.Y, (float)p2.Z); var d = v2 - v1; var n = d.Normalized(); var len = d.Length(); if ((parameter != null) && (len <= 10.0)) { v2 += n * 6.0f; v1 -= n * 6.0f; } builder.AddLine(v1, v2); return(builder.ToLineGeometry3D()); } else { return(null); } }
public void SetNormal(SharpDX.Vector3 normal) { Normal.X = normal.X; Normal.Y = normal.Y; Normal.Z = normal.Z; Normal.W = 0.0f; }
private void CreateWorkspace() { var workspace = new LineBuilder(); Vector3 p0work = new Vector3((float)(X0 + App.Grbl.Gcode.MinX), (float)(Y0 + App.Grbl.Gcode.MinY), (float)(Z0 + App.Grbl.Gcode.MinZ)); Vector3 p1work = new Vector3((float)(p0work.X + App.Grbl.Gcode.DeltaX), p0work.Y, p0work.Z); Vector3 p2work = new Vector3((float)(p0work.X + App.Grbl.Gcode.DeltaX), (float)(p0work.Y + App.Grbl.Gcode.DeltaY), p0work.Z); Vector3 p3work = new Vector3(p0work.X, (float)(p0work.Y + App.Grbl.Gcode.DeltaY), p0work.Z); Vector3 p4work = new Vector3(p0work.X, p0work.Y, (float)(p0work.Z + App.Grbl.Gcode.DeltaZ)); Vector3 p5work = new Vector3((float)(p0work.X + App.Grbl.Gcode.DeltaX), p0work.Y, (float)(p0work.Z + App.Grbl.Gcode.DeltaZ)); Vector3 p6work = new Vector3((float)(p0work.X + App.Grbl.Gcode.DeltaX), (float)(p0work.Y + App.Grbl.Gcode.DeltaY), (float)(p0work.Z + App.Grbl.Gcode.DeltaZ)); Vector3 p7work = new Vector3(p0work.X, (float)(p0work.Y + App.Grbl.Gcode.DeltaY), (float)(p0work.Z + App.Grbl.Gcode.DeltaZ)); workspace.AddLine(p0work, p1work); workspace.AddLine(p0work, p1work); workspace.AddLine(p1work, p2work); workspace.AddLine(p2work, p3work); workspace.AddLine(p3work, p0work); workspace.AddLine(p4work, p5work); workspace.AddLine(p5work, p6work); workspace.AddLine(p6work, p7work); workspace.AddLine(p7work, p4work); workspace.AddLine(p0work, p4work); workspace.AddLine(p1work, p5work); workspace.AddLine(p2work, p6work); workspace.AddLine(p3work, p7work); WorkSpace = workspace.ToLineGeometry3D(); }
public static MeshGeometryModel3D MakeMeshGeometryModel3D(List <Point3D> allPoints, HelixToolkit.Wpf.SharpDX.Material mat) { var allIndices = new List <int>(); for (int i = 0; i < allPoints.Count; i++) { allIndices.Add(i); } var g3d = new HelixToolkit.Wpf.SharpDX.MeshGeometry3D(); g3d.Positions = new HelixToolkit.Wpf.SharpDX.Core.Vector3Collection(); g3d.TriangleIndices = new HelixToolkit.Wpf.SharpDX.Core.IntCollection(); g3d.Normals = new HelixToolkit.Wpf.SharpDX.Core.Vector3Collection(); g3d.Indices = new HelixToolkit.Wpf.SharpDX.Core.IntCollection(); for (int i = 0; i < allPoints.Count; i++) { var p3 = allPoints[i]; SharpDX.Vector3 v3 = P2V(p3); g3d.Positions.Add(v3); g3d.Normals.Add(new SharpDX.Vector3(0, 1, 0)); } for (int i = 0; i < allIndices.Count; i++) { g3d.Indices.Add(allIndices[i]); } var ret = new MeshGeometryModel3D(); ret.Material = mat; ret.Geometry = g3d; //ret. = new System.Windows.Controls.TextBlock() { Text = caption }; return(ret); }
public unsafe Vector2 WorldToScreen(Vector3 vec3, EntityWrapper entityWrapper) { Entity localPlayer = Game.IngameState.Data.LocalPlayer; var isplayer = localPlayer.Address == entityWrapper.Address && localPlayer.IsValid; bool isMoving = false; isMoving = GameController.Instance.Cache.Enable ? GameController.Instance.Cache.Player.Actor.isMoving : localPlayer.GetComponent <Actor>().isMoving; var playerMoving = isplayer && isMoving; var resultCord = WorldToScreen(vec3); if (playerMoving) { if (Math.Abs(oldplayerCord.X - resultCord.X) < 40 || (Math.Abs(oldplayerCord.X - resultCord.Y) < 40)) { resultCord = oldplayerCord; } else { oldplayerCord = resultCord; } } else if (isplayer) { oldplayerCord = resultCord; } return(resultCord); }
/// <summary> /// Changes the camera distance. /// </summary> /// <param name="delta">The delta.</param> /// <param name="zoomAround">The zoom around point.</param> private bool ChangeCameraDistance(ref double delta, Point3D zoomAround) { // Handle the 'zoomAround' point var target = this.Camera.CameraInternal.Position + this.Camera.CameraInternal.LookDirection; var relativeTarget = zoomAround - target; var relativePosition = zoomAround - this.Camera.CameraInternal.Position; if (relativePosition.Length() < 1e-4) { if (delta > 0) //If Zoom out from very close distance, increase the initial relativePosition { relativePosition.Normalize(); relativePosition /= 10; } else//If Zoom in too close, stop it. { return(false); } } var f = Math.Pow(2.5, delta); var newRelativePosition = relativePosition * (float)f; var newRelativeTarget = relativeTarget * (float)f; var newTarget = zoomAround - newRelativeTarget; var newPosition = zoomAround - newRelativePosition; var newDistance = (newPosition - zoomAround).Length(); var oldDistance = (this.Camera.CameraInternal.Position - zoomAround).Length(); if (newDistance > this.Controller.ZoomDistanceLimitFar && (oldDistance < this.Controller.ZoomDistanceLimitFar || newDistance > oldDistance)) { var ratio = (newDistance - this.Controller.ZoomDistanceLimitFar) / newDistance; f *= 1 - ratio; newRelativePosition = relativePosition * (float)f; newRelativeTarget = relativeTarget * (float)f; newTarget = zoomAround - newRelativeTarget; newPosition = zoomAround - newRelativePosition; delta = Math.Log(f) / Math.Log(2.5); } if (newDistance < this.Controller.ZoomDistanceLimitNear && (oldDistance > this.Controller.ZoomDistanceLimitNear || newDistance < oldDistance)) { var ratio = (this.Controller.ZoomDistanceLimitNear - newDistance) / newDistance; f *= (1 + ratio); newRelativePosition = relativePosition * (float)f; newRelativeTarget = relativeTarget * (float)f; newTarget = zoomAround - newRelativeTarget; newPosition = zoomAround - newRelativePosition; delta = Math.Log(f) / Math.Log(2.5); } var newLookDirection = newTarget - newPosition; this.Camera.LookDirection = newLookDirection; this.Camera.Position = newPosition; return(true); }
public TimeSeriesLineVertex(Vector3 position, Vector3 normal, float time, uint color) { Position = position; Normal = normal; Tu = time; Tv = 0; this.color = color; }
public Player(int index, int health, int team, Vector3 position, Vector3 viewAngles) { Index = index; iHealth = health; iTeam = team; vec3Position = position; vec3ViewAngles = viewAngles; }
public KmlLabels() { texture = Texture11.FromBitmap( Properties.Resources.circle, 0); star = Texture11.FromBitmap(Properties.Resources.icon_rating_star_large_on, 0); center = new Vector3(10, 10, 0); positions = new List<Vector3>(); names = new List<string>(); }
public static PositionVertexBuffer11 CreateEllipseVertexBufferWithoutStartPoint(int vertexCount) { PositionVertexBuffer11 vb = new PositionVertexBuffer11(vertexCount, RenderContext11.PrepDevice); SharpDX.Vector3[] verts = (SharpDX.Vector3[])vb.Lock(0, 0); // Setting a non-zero value will prevent the ellipse shader from using the 'head' point verts[0] = new SharpDX.Vector3(1.0e-6f, 0.0f, 0.0f); for (int i = 1; i < vertexCount; ++i) { verts[i] = new SharpDX.Vector3(2.0f * (float)i / (float)vertexCount, 0.0f, 0.0f); } vb.Unlock(); return vb; }
private void Build3DImage(object sender, RoutedEventArgs e) { if(_3dwindow == null) { _3dwindow = new Image3DWindow(); _3dwindow.Show(); } else { if(_3dwindow.IsVisible) _3dwindow.Close(); _3dwindow = new Image3DWindow(); _3dwindow.Show(); } _3dwindow.ResetPoints(); ColorImage image = null; if(_imageControl.ImageSource != null) { image = new ColorImage(); image.FromBitmapSource(_imageControl.ImageSource); } foreach(var point in Points3D) { SharpDX.Vector3 pos = new SharpDX.Vector3((float)point.Real.X, (float)point.Real.Y, (float)point.Real.Z); SharpDX.Color4 color = new SharpDX.Color4(1.0f); if(image != null) { if(!(point.Cam1Img.X < 0.0 || point.Cam1Img.X > image.ColumnCount || point.Cam1Img.Y < 0.0 || point.Cam1Img.Y > image.RowCount)) { color = new SharpDX.Color4( (float)image[(int)point.Cam1Img.Y, (int)point.Cam1Img.X, RGBChannel.Red], (float)image[(int)point.Cam1Img.Y, (int)point.Cam1Img.X, RGBChannel.Green], (float)image[(int)point.Cam1Img.Y, (int)point.Cam1Img.X, RGBChannel.Blue], 1.0f); } } _3dwindow.AddPointCube(pos, color); } }
public FixtureRendererConfiguration2(string name) { Name = name; Renderer = FixtureRenderererType.Shaded; Color = new ImageMagick.MagickColor("#FFF"); Transparency = 0; HasLight = true; LightMin = 0.6; LightMax = 1.0; LightVector = new SharpDX.Vector3(1f, 1f, -1f); HasShadow = true; ShadowColor = new ImageMagick.MagickColor("#000"); ShadowOffsetX = 0; ShadowOffsetY = 0; ShadowSize = 1.0; ShadowTransparency = 75; }
public static PositionVertexBuffer11 CreateEllipseVertexBuffer(int vertexCount) { PositionVertexBuffer11 vb = new PositionVertexBuffer11( vertexCount,RenderContext11.PrepDevice); SharpDX.Vector3[] verts = (SharpDX.Vector3[])vb.Lock(0,0); int index = 0; // Pack extra samples into the front of the orbit to avoid obvious segmentation // when viewed from near the planet or moon. for (int i = 0; i < vertexCount / 2; ++i) { verts[index++] = new SharpDX.Vector3(2.0f * (float)i / (float)vertexCount * 0.05f, 0.0f, 0.0f); } for (int i = 0; i < vertexCount / 2; ++i) { verts[index++] = new SharpDX.Vector3(2.0f * (float)i / (float)vertexCount * 0.95f + 0.05f, 0.0f, 0.0f); } vb.Unlock(); return vb; }
public IPlace HoverCheck(Vector3 searchPoint, IPlace defaultPlace, float distance) { searchPoint = -searchPoint; Vector3 dist; if (defaultPlace != null) { Vector3 testPoint = Coordinates.RADecTo3d(defaultPlace.RA, -defaultPlace.Dec, -1.0).Vector311; dist = searchPoint - testPoint; distance = dist.Length(); } int closestItem = -1; int index = 0; foreach (Vector3 point in positions) { dist = searchPoint - point; if (dist.Length() < distance) { distance = dist.Length(); closestItem = index; } index++; } lastHoverIndex = closestItem; if (closestItem == -1) { return defaultPlace; } Coordinates pnt = Coordinates.CartesianToSpherical(positions[closestItem]); string name = this.names[closestItem]; if (String.IsNullOrEmpty(name)) { name = string.Format("RA={0}, Dec={1}", Coordinates.FormatHMS(pnt.RA), Coordinates.FormatDMS(pnt.Dec)); } TourPlace place = new TourPlace(name, pnt.Dec, pnt.RA, Classification.Unidentified, "", ImageSetType.Sky, -1); return place; }
internal void ItemClick(Vector3 searchPoint, float distance) { if (LabelItemClicked == null) { return; } if (lastHoverIndex > -1) { LabelItemClicked.Invoke(lastHoverIndex); } searchPoint = -searchPoint; Vector3 dist; int closestItem = -1; int index = 0; foreach (Vector3 point in positions) { dist = searchPoint - point; if (dist.Length() < distance) { distance = dist.Length(); closestItem = index; } index++; } if (closestItem == -1) { return ; } LabelItemClicked.Invoke(closestItem); }
public override bool Draw(RenderContext11 renderContext, float opacity, bool flat) { if (shapefile == null) { return false; } if (shapeFileVertex == null) { var vertList = new List<Vector3>(); var indexList = new List<UInt32>(); UInt32 firstItemIndex = 0; var lastItem = new Vector3(); var firstItem = true; var north = true; double offsetX = 0; double offsetY = 0; double centralMeridian = 0; double mapScale = 0; double standardParallel = 70; if (shapefile.Projection == ShapeFile.Projections.PolarStereo) { north = shapefile.FileHeader.ProjectionInfo.Name.ToLower().Contains("north"); standardParallel = shapefile.FileHeader.ProjectionInfo.GetParameter("standard_parallel_1"); centralMeridian = shapefile.FileHeader.ProjectionInfo.GetParameter("central_meridian"); mapScale = shapefile.FileHeader.ProjectionInfo.GetParameter("scale_factor"); offsetY = shapefile.FileHeader.ProjectionInfo.GetParameter("false_easting"); offsetX = shapefile.FileHeader.ProjectionInfo.GetParameter("false_northing"); } UInt32 currentIndex = 0; var color = Color; var count = 360; for (var i = 0; i < shapefile.Shapes.Count; i++) { if (shapefile.Shapes[i].GetType() == typeof(Polygon)) { var p = (Polygon)shapefile.Shapes[i]; for (var z = 0; z < p.Rings.Length; z++) { count = (p.Rings[z].Points.Length); // content from DBF var dr = p.Rings[z].Attributes; for (var k = 0; k < p.Rings[z].Points.Length; k++) { // 2D Point coordinates. 3d also supported which would add a Z. There's also an optional measure (M) that can be used. var Xcoord = p.Rings[z].Points[k].X; var Ycoord = p.Rings[z].Points[k].Y; if (shapefile.Projection == ShapeFile.Projections.Geo) { lastItem = Coordinates.GeoTo3d(Ycoord, Xcoord); } else if (shapefile.Projection == ShapeFile.Projections.PolarStereo) { lastItem = Coordinates.SterographicTo3d(Xcoord, Ycoord, 1, standardParallel, centralMeridian, offsetX, offsetY, mapScale, north).Vector3; } if (k == 0) { firstItemIndex = currentIndex; firstItem = true; } vertList.Add(lastItem); if (firstItem) { firstItem = false; } else { indexList.Add(currentIndex); currentIndex++; indexList.Add(currentIndex); } } indexList.Add(currentIndex); indexList.Add(firstItemIndex); currentIndex++; } } else if (shapefile.Shapes[i].GetType() == typeof(PolygonZ)) { var p = (PolygonZ)shapefile.Shapes[i]; for (var z = 0; z < p.Rings.Length; z++) { count = (p.Rings[z].Points.Length); // content from DBF var dr = p.Rings[z].Attributes; for (var k = 0; k < p.Rings[z].Points.Length; k++) { // 2D Point coordinates. 3d also supported which would add a Z. There's also an optional measure (M) that can be used. var Xcoord = p.Rings[z].Points[k].X; var Ycoord = p.Rings[z].Points[k].Y; if (shapefile.Projection == ShapeFile.Projections.Geo) { lastItem = Coordinates.GeoTo3d(Ycoord, Xcoord); } else if (shapefile.Projection == ShapeFile.Projections.PolarStereo) { lastItem = Coordinates.SterographicTo3d(Xcoord, Ycoord, 1, standardParallel, centralMeridian, offsetX, offsetY, mapScale, north).Vector3; } if (k == 0) { firstItemIndex = currentIndex; firstItem = true; } vertList.Add(lastItem); if (firstItem) { firstItem = false; } else { indexList.Add(currentIndex); currentIndex++; indexList.Add(currentIndex); } } indexList.Add(currentIndex); indexList.Add(firstItemIndex); currentIndex++; } } else if (shapefile.Shapes[i].GetType() == typeof(PolyLine)) { var p = (PolyLine)shapefile.Shapes[i]; for (var z = 0; z < p.Lines.Length; z++) { count = (p.Lines[z].Points.Length); firstItem = true; for (var k = 0; k < p.Lines[z].Points.Length; k++) { // 2D Point coordinates. 3d also supported which would add a Z. There's also an optional measure (M) that can be used. var Xcoord = p.Lines[z].Points[k].X; var Ycoord = p.Lines[z].Points[k].Y; if (shapefile.Projection == ShapeFile.Projections.Geo) { lastItem = Coordinates.GeoTo3d(Ycoord, Xcoord); } else if (shapefile.Projection == ShapeFile.Projections.PolarStereo) { lastItem = Coordinates.SterographicTo3d(Xcoord, Ycoord, 1, standardParallel, centralMeridian, offsetX, offsetY, mapScale, north).Vector3; } if (k == 0) { firstItemIndex = currentIndex; firstItem = true; } vertList.Add(lastItem); if (firstItem) { firstItem = false; } else { indexList.Add(currentIndex); currentIndex++; indexList.Add(currentIndex); } } currentIndex++; } } else if (shapefile.Shapes[i].GetType() == typeof(PolyLineZ)) { var p = (PolyLineZ)shapefile.Shapes[i]; for (var z = 0; z < p.Lines.Length; z++) { count = (p.Lines[z].Points.Length); var points = new Vector3[(count)]; firstItem = true; for (var k = 0; k < p.Lines[z].Points.Length; k++) { // 2D Point coordinates. 3d also supported which would add a Z. There's also an optional measure (M) that can be used. var Xcoord = p.Lines[z].Points[k].X; var Ycoord = p.Lines[z].Points[k].Y; if (shapefile.Projection == ShapeFile.Projections.Geo) { lastItem = Coordinates.GeoTo3d(Ycoord, Xcoord); } else if (shapefile.Projection == ShapeFile.Projections.PolarStereo) { lastItem = Coordinates.SterographicTo3d(Xcoord, Ycoord, 1, standardParallel, centralMeridian, offsetX, offsetY, mapScale, north).Vector3; } if (k == 0) { firstItemIndex = currentIndex; firstItem = true; } vertList.Add(lastItem); if (firstItem) { firstItem = false; } else { indexList.Add(currentIndex); currentIndex++; indexList.Add(currentIndex); } } currentIndex++; } } else if (shapefile.Shapes[i].GetType() == typeof(Point)) { var p = (Point)shapefile.Shapes[i]; // 2D Point coordinates. 3d also supported which would add a Z. There's also an optional measure (M) that can be used. var Xcoord = p.X; var Ycoord = p.Y; if (shapefile.Projection == ShapeFile.Projections.Geo) { lastItem = Coordinates.GeoTo3d(Ycoord, Xcoord); } else if (shapefile.Projection == ShapeFile.Projections.PolarStereo) { lastItem = Coordinates.SterographicTo3d(Xcoord, Ycoord, 1, standardParallel, centralMeridian, offsetX, offsetY, mapScale, north).Vector3; } vertList.Add(lastItem); currentIndex++; lines = false; } } shapeVertexCount = vertList.Count; shapeFileVertex = new PositionVertexBuffer11(vertList.Count, RenderContext11.PrepDevice); var verts = (Vector3[])shapeFileVertex.Lock(0, 0); // Lock the buffer (which will return our structs) var indexer = 0; foreach (var vert in vertList) { verts[indexer++] = vert; } shapeFileVertex.Unlock(); shapeIndexCount = indexList.Count; if (lines) { if (indexList.Count > 65500) { isLongIndex = true; shapeFileIndex = new IndexBuffer11(typeof(UInt32), indexList.Count, RenderContext11.PrepDevice); } else { isLongIndex = false; shapeFileIndex = new IndexBuffer11(typeof(short), indexList.Count, RenderContext11.PrepDevice); } if (isLongIndex) { indexer = 0; var indexes = (UInt32[])shapeFileIndex.Lock(); foreach (var indexVal in indexList) { indexes[indexer++] = indexVal; } shapeFileIndex.Unlock(); } else { indexer = 0; var indexes = (short[])shapeFileIndex.Lock(); foreach (var indexVal in indexList) { indexes[indexer++] = (short)indexVal; } shapeFileIndex.Unlock(); } } } renderContext.DepthStencilMode = DepthStencilMode.Off; renderContext.BlendMode = BlendMode.Alpha; SimpleLineShader11.Color = Color.FromArgb((int)(opacity * 255), Color); var mat = (renderContext.World * renderContext.View * renderContext.Projection).Matrix11; mat.Transpose(); SimpleLineShader11.WVPMatrix = mat; SimpleLineShader11.CameraPosition = Vector3d.TransformCoordinate(renderContext.CameraPosition, Matrix3d.Invert(renderContext.World)).Vector3; SimpleLineShader11.ShowFarSide = false; SimpleLineShader11.Sky = false; renderContext.SetVertexBuffer(shapeFileVertex); SimpleLineShader11.Use(renderContext.devContext); if (lines) { renderContext.devContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.LineList; renderContext.SetIndexBuffer(shapeFileIndex); renderContext.devContext.DrawIndexed(shapeFileIndex.Count, 0, 0); } else { renderContext.devContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.PointList; renderContext.devContext.Draw(shapeVertexCount, 0); } renderContext.devContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList; return true; }
public SkyLabel(RenderContext11 renderContext, double ra, double dec, string text, LabelSytle style, double distance) { RA = ra; Dec = dec; Text = text; Style = style; Distance = distance; if (texture == null) { texture = Texture11.FromBitmap(Properties.Resources.circle, 0); } Vector3d up = new Vector3d(); Vector3d textPos = new Vector3d(); if (Earth3d.MainWindow.SolarSystemMode) { pos = Coordinates.RADecTo3d(ra, -dec, distance); up = Coordinates.RADecTo3d(ra, -dec + 90, distance); pos.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI); pos.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth)); up.RotateX(Coordinates.MeanObliquityOfEcliptic(SpaceTimeController.JNow) / 180.0 * Math.PI); up.Add(Planets.GetPlanet3dLocation(SolarSystemObjects.Earth)); } else { pos = Coordinates.RADecTo3d(ra+12, dec, distance); textPos = Coordinates.RADecTo3d(ra + 12, dec + 2, distance); up = Coordinates.RADecTo3d(ra+12, dec + 92, distance); } center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(24); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned Text3d t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { up.Normalize(); textPos.Normalize(); textBatch.Add(new Text3d(textPos, up, text, 20, .0005)); } }
public TimeSeriesPointVertex(Vector3 position, float size, float time, uint color) { Position = position; PointSize = size; Tu = time; Tv = 0; this.color = color; }
private static void Game_OnGameLoad(EventArgs args) { if (Player.ChampionName != "Fizz") return; Q = new Spell(SpellSlot.Q, 550); W = new Spell(SpellSlot.W, Orbwalking.GetRealAutoAttackRange(Player)); E = new Spell(SpellSlot.E, 400); R = new Spell(SpellSlot.R, 1300); F = new Spell(Player.GetSpellSlot("summonerflash"), 425); D = new Spell(Player.GetSpellSlot("summonerignite"), 600); I = new Spell(Player.GetSpellSlot("summonersmite"), 500); E.SetSkillshot(0.25f, 330, float.MaxValue, false, SkillshotType.SkillshotCircle); R.SetSkillshot(0.25f, 80, 1300, true, SkillshotType.SkillshotLine); RRectangle = new Geometry.Polygon.Rectangle(Player.Position, Player.Position, 300); Menu = new Menu(Player.ChampionName, Player.ChampionName, true); var orbwalkerMenu = Menu.AddSubMenu(new Menu("Orbwalker", "Orbwalker")); Orbwalker = new Orbwalking.Orbwalker(orbwalkerMenu); //Combo Menu var combo = new Menu("Combo", "Combo"); Menu.AddSubMenu(combo); combo.AddItem(new MenuItem("ComboText","Combo").SetTooltip("A higher R hitchance leads to a less often casting of R but more chances to hit.")); combo.AddItem(new MenuItem("ComboMode", "Combo mode").SetValue(new StringList(new[] { "R to gapclose", "R in dash range", "R after Dash", "R on dash" }))); combo.AddItem(new MenuItem("HitChancewR", "R hitchance").SetValue(new StringList(new[] { "Medium", "High", "Very High" }))); combo.AddItem(new MenuItem("targetMinHPforR", "Minimum enemy HP(in %) to use R").SetValue(new Slider(35)).SetTooltip("Minimum HP percentage the enemy needs for R to be casted")); combo.AddItem(new MenuItem("useZhonya", "Use Zhonya in combo (Recommended for lategame)").SetValue(true).SetTooltip("Will use Zhonya if owned and active, on each kind of combo. Cannot use zhonya if 'Use E in combo' is not active.")); combo.AddItem(new MenuItem("useQcombo", "Use Q in combo").SetValue(true)); combo.AddItem(new MenuItem("useWcombo", "Use W in combo").SetValue(true)); combo.AddItem(new MenuItem("useEcombo", "Use E in combo").SetValue(true).SetTooltip("Will be casted after an autoattack as priority. Unless Q, W and R are on cooldown and your target is out of autoattack range. Cannot use zhonya if 'Use E in combo' is not active.")); combo.AddItem(new MenuItem("UseEOnlyAfterAA", "Use E only after an autoattack").SetValue(false).SetTooltip("Will not use E without having done an autoattack first.")); combo.AddItem(new MenuItem("useRcombo", "Use R in combo").SetValue(true)); //Harass Menu var harass = new Menu("Harass", "Harass"); Menu.AddSubMenu(harass); harass.AddItem(new MenuItem("harassText", "Harass").SetTooltip("E Mode will not work with EWQ Combo. 'E to mouse position' will cast E towards your mouse, if your mouse position is out of range of your first E damage, it will also cast the second E towards your mouse.")); harass.AddItem(new MenuItem("texttt", "Harass with WQ AA E combo").SetTooltip("Will use WQ if you are in Q range. Then E after an AutoAttack.")); harass.AddItem(new MenuItem("harassEMode", "E mode").SetValue(new StringList(new[] { "E to mouse position", "E to hit the enemy", "E to comeback", "E twice to comeback" }))); harass.AddItem(new MenuItem("useharassQ", "Use Q to harass").SetValue(true)); harass.AddItem(new MenuItem("useharassW", "Use W to harass").SetValue(true)); harass.AddItem(new MenuItem("useharassE", "Use E to harass").SetValue(true)); harass.AddItem(new MenuItem("harassmana", "Minimum mana to harass in %").SetValue(new Slider(0))); harass.AddItem(new MenuItem("useEWQ", "Harass with EE(W)Q Combo").SetValue(false).SetTooltip("If you have enough mana for E(W)Q combo and spells are not on cooldown. Will use E (behind the target but in range for the damage) then W AutoAttack and Q to come back.")); harass.AddItem(new MenuItem("recom", "Recommended to disable 'Priorize farm to harass' in Orbwalker > Misc").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); //LaneClear Menu var lc = new Menu("Laneclear", "Laneclear"); Menu.AddSubMenu(lc); lc.AddItem(new MenuItem("LaneclearText","Laneclear")); lc.AddItem(new MenuItem("laneclearQ", "Use Q to laneclear").SetValue(false)); lc.AddItem(new MenuItem("laneclearW", "Use W to laneclear").SetValue(false)); lc.AddItem(new MenuItem("laneclearE", "Use E to laneclear").SetValue(false)); lc.AddItem(new MenuItem("lanemana", "Minimum mana to farm in %").SetValue(new Slider(0))); //JungleClear Menu var jungle = new Menu("Jungleclear", "Jungleclear"); Menu.AddSubMenu(jungle); jungle.AddItem(new MenuItem("JungleclearText", "Jungleclear")); jungle.AddItem(new MenuItem("jungleclearQ", "Use Q to jungleclear").SetValue(false)); jungle.AddItem(new MenuItem("jungleclearW", "Use W to jungleclear").SetValue(false)); jungle.AddItem(new MenuItem("jungleclearE", "Use E to jungleclear").SetValue(false)); jungle.AddItem(new MenuItem("junglemana", "Minimum mana to jungleclear in %").SetValue(new Slider(0))); //CustomCombo Menu var customCombo = new Menu("Custom Combo's (require a selected target!)", "CustomCombo").SetFontStyle(FontStyle.Bold, fontColor: SharpDX.Color.Yellow); Menu.AddSubMenu(customCombo); customCombo.AddItem(new MenuItem("CustomComboText","Custom Combo's")); customCombo.AddItem(new MenuItem("info", "How to use CustomCombo's :").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); customCombo.AddItem(new MenuItem("info1", "1) Make sure every spells used in the combo are up.").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); customCombo.AddItem(new MenuItem("info2", "2) Select your Target.").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); customCombo.AddItem(new MenuItem("info3", "3) Press combo key until every spells are used.").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); customCombo.AddItem(new MenuItem("info4", "4) Press space key afterwards for ideal follow up.").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); customCombo.AddItem(new MenuItem("lateGameZhonyaCombo", "EE to gapclose RWQ zhonya").SetValue(new KeyBind("G".ToCharArray()[0], KeyBindType.Press)).SetTooltip("Will use E twice to gapclose then RWQ. Zhonya when Q has been casted, if it is owned and active.")); customCombo.AddItem(new MenuItem("lateGameZhonyaComboZhonya", "Use Zhonya with EE to gapclose RWQ").SetValue(true)); customCombo.AddItem(new MenuItem("QminionREWCombo", "Q laneminion/neutral monster/champion to gapclose REW").SetValue(new KeyBind("H".ToCharArray()[0], KeyBindType.Press)).SetTooltip("Will use Q on a minion, neutral monster or champion (unless your target is already in range) to gapclose. Then R after a little delay (for the travel time) and EW on the target.")); customCombo.AddItem(new MenuItem("EFlashCombo", "E Flash on target RWQ zhonya").SetValue(new KeyBind("J".ToCharArray()[0], KeyBindType.Press)).SetTooltip("Will use E once (for the area damage and slow) then Flash on the target before landing and RWQ. Zhonya when Q has been casted, if it is owned and active.")); customCombo.AddItem(new MenuItem("EFlashComboZhonya", "Use Zhonya with E Flash on target RWQ").SetValue(true)); customCombo.AddItem(new MenuItem("Flee", "Flee Key (Flee does not require a target)").SetValue(new KeyBind("Q".ToCharArray()[0], KeyBindType.Press))); customCombo.AddItem(new MenuItem("manualR", "Auto cast R key").SetValue(new KeyBind("K".ToCharArray()[0], KeyBindType.Press)).SetTooltip("Selected targets are always a priority. Else will cast depending on the targets in R range")); customCombo.AddItem(new MenuItem("manualRHitchance", "Auto cast R hitchance").SetValue(new StringList(new[] { "Medium", "High", "Very High" }))); //Anti-Afk var antiAfk = new Menu("Anti-AFK","Anti-AFK"); Menu.AddSubMenu(antiAfk); antiAfk.AddItem(new MenuItem("Anti-AFKText","Anti-AFK")); antiAfk.AddItem(new MenuItem("antiAfk","Anti-AFK").SetValue(false)); //Drawings Menu var drawings = new Menu("Drawings", "Drawings"); Menu.AddSubMenu(drawings); drawings.AddItem(new MenuItem("DrawingsText","Drawings")); drawings.AddItem(new MenuItem("drawComboDamage", "Draw the predicted damage on target").SetValue(false).SetTooltip("Shows the total damage of the active spells(spells not on cooldown) and 1 autoattack. Summoners included (ignite or smite).")); drawings.AddItem(new MenuItem("ComboDamageColor", "Color of the predicted damage").SetValue<Color>(Color.Goldenrod)); drawings.AddItem(new MenuItem("drawQ", "Draw Q range").SetValue(false)); drawings.AddItem(new MenuItem("drawQColor", "Color of the Q range").SetValue<Color>(Color.DarkRed)); drawings.AddItem(new MenuItem("drawE", "Draw E range").SetValue(false)); drawings.AddItem(new MenuItem("drawEColor", "Color of the E range").SetValue<Color>(Color.DarkRed)); drawings.AddItem(new MenuItem("drawEMax", "Draw E maximum range").SetValue(false)); drawings.AddItem(new MenuItem("drawEMaxColor", "Color of the E maximum range").SetValue<Color>(Color.DarkRed)); drawings.AddItem(new MenuItem("drawRr", "Draw R range").SetValue(false)); drawings.AddItem(new MenuItem("drawRrColor", "Color of the R range").SetValue<Color>(Color.DarkRed)); drawings.AddItem(new MenuItem("drawMinionQCombo", "Draw QminionREWCombo helper (Selected Target Only)").SetValue(false).SetTooltip("Shows a rectangle between you and your target. Helps you see on which minion Fizz will dash when pressing the QminionREWCombo key. You need to select a target for it to be shown.")); drawings.AddItem(new MenuItem("drawMinionQComboColor", "Color of the QminionREWCombo helper").SetValue<Color>(Color.CornflowerBlue)); drawings.AddItem(new MenuItem("drawR", "Draw R prediction (Selected Target Only)").SetValue(false).SetTooltip("Draws where the ultimate will be casted. You need to select a target for it to be shown.")); drawings.AddItem(new MenuItem("drawRColor", "Color of the R prediction").SetValue<Color>(Color.Blue)); drawings.AddItem(new MenuItem("drawRHitChance", "Draw Hitchance status text of R (Selected Target Only)").SetValue(false)); drawings.AddItem(new MenuItem("drawRHitChanceColor", "Color of the Hitchance status text").SetValue<Color>(Color.DarkTurquoise)); drawings.AddItem(new MenuItem("drawRHitChanceX", "X screen position of the Hitchance status text").SetValue(new Slider(450, 0, 2000))); drawings.AddItem(new MenuItem("drawRHitChanceY", "Y screen position of the Hitchance status text").SetValue(new Slider(200, 0, 2000))); //Author Menu var about = new Menu("About", "About").SetFontStyle(FontStyle.Regular, fontColor: SharpDX.Color.Gray); Menu.AddSubMenu(about); about.AddItem(new MenuItem("AboutText", "About")); about.AddItem(new MenuItem("Author", "Author: mathieu002").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.White)); about.AddItem(new MenuItem("Credits", "Credits: ChewyMoon,1Shinigamix3,jQuery,Kurisu,Hellsing,detuks")); about.AddItem(new MenuItem("Upvote", "Remember to upvote the assembly if you like it ! GL & HF").SetFontStyle(FontStyle.Italic, fontColor: SharpDX.Color.Goldenrod)); hydra = new Items.Item(3074, 185); tiamat = new Items.Item(3077, 185); cutlass = new Items.Item(3144, 450); botrk = new Items.Item(3153, 450); hextech = new Items.Item(3146, 700); zhonya = new Items.Item(3157); Random = new Random(); harassQCastedPosition = Player.Position; Menu.AddToMainMenu(); Game.PrintChat("<font color='#2CCACE'>Fizz by</font> <font color='#B000FF'>mathieu002</font> <font color='##FFD93B'>Loaded</font>"); OnDoCast(); Game.OnUpdate += OnUpdate; Drawing.OnDraw += OnDraw; }
public bool IsVisible(Vector3 start, Vector3 end) { Vector3 vDirection = end - start; Vector3 vPoint = start; int iStepCount = (int)vDirection.Length(); vDirection /= iStepCount; Leaf pLeaf = new Leaf() { area = -1 }; while (iStepCount > 0) { vPoint += vDirection; pLeaf = GetLeafForPoint(vPoint); if (pLeaf.area != -1) { if ( (pLeaf.contents & ContentsFlag.CONTENTS_SOLID) == ContentsFlag.CONTENTS_SOLID || (pLeaf.contents & ContentsFlag.CONTENTS_DETAIL) == ContentsFlag.CONTENTS_DETAIL) { break; } } iStepCount--; } return (pLeaf.contents & ContentsFlag.CONTENTS_SOLID) != ContentsFlag.CONTENTS_SOLID; }
public Leaf GetLeafForPoint(Vector3 point) { int node = 0; Node pNode; Plane pPlane; float d = 0.0f; while (node >= 0) { pNode = nodes[node]; pPlane = planes[pNode.planenum]; d = Vector3.Dot(point, pPlane.normal) - pPlane.distance; if (d > 0) { node = pNode.children[0]; } else { node = pNode.children[1]; } } return ( (-node - 1) >= 0 && -node - 1 < leafs.Length ? leafs[-node - 1] : new Leaf() { area = -1, contents = ContentsFlag.CONTENTS_EMPTY } ); }
private Plane[] GetPlanes(Stream stream) { Lump lump = header.lumps[(int)LumpType.LUMP_PLANES]; Plane[] planes = new Plane[lump.length / 20]; stream.Position = lump.offset; for (int i = 0; i < planes.Length; i++) { planes[i] = new Plane(); Vector3 normal = new Vector3(); normal.X = UtilityReader.ReadFloat(stream); normal.Y = UtilityReader.ReadFloat(stream); normal.Z = UtilityReader.ReadFloat(stream); planes[i].normal = normal; planes[i].distance = UtilityReader.ReadFloat(stream); planes[i].type = UtilityReader.ReadInt(stream); } return planes; }
private Vector3[] GetVertices(Stream stream) { Lump lump = header.lumps[(int)LumpType.LUMP_VERTEXES]; stream.Position = lump.offset; Vector3[] vertices = new Vector3[(lump.length / 3) / 4]; for (int i = 0; i < vertices.Length; i++) { vertices[i] = new Vector3(); vertices[i].X = UtilityReader.ReadFloat(stream); vertices[i].Y = UtilityReader.ReadFloat(stream); vertices[i].Z = UtilityReader.ReadFloat(stream); } return vertices; }
static void Game_OnUpdate(EventArgs args) { if (Player.IsDead) return; if (Orbwalking.CanMove(100)) { switch (Orbwalker.ActiveMode) { case Orbwalking.OrbwalkingMode.Combo: Combo(); break; case Orbwalking.OrbwalkingMode.Mixed: Harass(); break; case Orbwalking.OrbwalkingMode.LaneClear: Laneclear(); Jungleclear(); break; case Orbwalking.OrbwalkingMode.None: break; } } if (AIO_Menu.Champion.Misc.UseKillsteal) Killsteal(); Q.MinHitChance = AIO_Menu.Champion.Misc.SelectedHitchance; Q.UpdateSourcePosition(BallPosition); W.UpdateSourcePosition(BallPosition, BallPosition); R.UpdateSourcePosition(BallPosition, BallPosition); if (Player.HasBuff("orianaghostself", true)) { BallPosition = ObjectManager.Player.Position; return; } var ballowner = HeroManager.Allies.FirstOrDefault(x => x.IsAlly && !x.IsMe && x.HasBuff("orianaghost", true)); if (ballowner != null) BallPosition = ballowner.Position; }
static void Obj_AI_Hero_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (Player.IsDead) return; if (AIO_Menu.Champion.Misc.getBoolValue("Auto-E") && sender.IsEnemy && args.Target.IsAlly && args.Target.Type == GameObjectType.obj_AI_Hero && sender.Type == GameObjectType.obj_AI_Hero && E.IsReady()) E.CastOnUnit((Obj_AI_Hero)args.Target); if (sender.IsMe && args.SData.Name == Q.Instance.Name) { Utility.DelayAction.Add((int)(BallPosition.Distance(args.End) / 1.2 - 70 - Game.Ping), () => BallPosition = args.End); BallPosition = SharpDX.Vector3.Zero; } if (sender.IsMe && args.SData.Name == E.Instance.Name) BallPosition = SharpDX.Vector3.Zero; }
private static void Combo() { var useQ = (Q.IsReady() && Menu.Item("useQcombo").GetValue<bool>()); var useW = (W.IsReady() && Menu.Item("useWcombo").GetValue<bool>()); var useE = (E.IsReady() && Menu.Item("useEcombo").GetValue<bool>()); var useR = (R.IsReady() && Menu.Item("useRcombo").GetValue<bool>()); var UseEOnlyAfterAA = Menu.Item("UseEOnlyAfterAA").GetValue<bool>(); var useZhonya = (Menu.Item("useZhonya").GetValue<bool>() && zhonya.IsReady() && zhonya.IsOwned()); var gapclose = (Menu.Item("ComboMode").GetValue<StringList>().SelectedIndex == 0); var ondash = (Menu.Item("ComboMode").GetValue<StringList>().SelectedIndex == 1); var afterdash = (Menu.Item("ComboMode").GetValue<StringList>().SelectedIndex == 2); var realondash = (Menu.Item("ComboMode").GetValue<StringList>().SelectedIndex == 3); var m = SelectedTarget; if (!m.IsValidTarget()) { m = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Magical); if (!m.IsValidTarget()) { m = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical); if (!m.IsValidTarget()) { m = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.True); } } } if(m.IsValidTarget()) { //Only use when R is Ready & Q is Ready and target is valid if (ondash && !m.IsZombie && useR && Player.Distance(m.Position) <= 550) { if (useQ && Player.Distance(m.Position) <= Q.Range) { if (useR && m.HealthPercent >= Menu.Item("targetMinHPforR").GetValue<Slider>().Value) { CastRSmart(m); lastRCastTick = Game.Time; } Q.Cast(m); } if (useW && Player.Distance(m.Position) <= 540) { W.Cast(); } if (hydra.IsOwned() && Player.Distance(m) < hydra.Range && hydra.IsReady() && !E.IsReady()) hydra.Cast(); if (tiamat.IsOwned() && Player.Distance(m) < tiamat.Range && tiamat.IsReady() && !E.IsReady()) tiamat.Cast(); } //Only use when R is Ready & Q is Ready if (afterdash && !m.IsZombie && useR) { if (useW && Player.Distance(m.Position) <= 540) W.Cast(); if (useQ && Player.Distance(m.Position) <= Q.Range) { Q.Cast(m); Utility.DelayAction.Add((540 - ping), () => { if (useR && m.HealthPercent >= Menu.Item("targetMinHPforR").GetValue<Slider>().Value) { CastRSmart(m); lastRCastTick = Game.Time; } }); } if (hydra.IsOwned() && Player.Distance(m) < hydra.Range && hydra.IsReady() && !E.IsReady()) hydra.Cast(); if (tiamat.IsOwned() && Player.Distance(m) < tiamat.Range && tiamat.IsReady() && !E.IsReady()) tiamat.Cast(); } if (gapclose && !m.IsZombie && useR) { if (useR && m.HealthPercent >= Menu.Item("targetMinHPforR").GetValue<Slider>().Value) { //if enemy is not facing us, check via movespeed if (!Utility.IsFacing(m, Player)) { if (Player.Distance(m.Position) < (R.Range - m.MoveSpeed) - (165)) { CastRSmart(m); lastRCastTick = Game.Time; } } else { if (Player.Distance(m.Position) <= (R.Range - 200)) { CastRSmart(m); lastRCastTick = Game.Time; } } } if (useQ) Q.Cast(m); if (useW && Player.Distance(m.Position) <= 540) W.Cast(); if (hydra.IsOwned() && Player.Distance(m) < hydra.Range && hydra.IsReady() && !E.IsReady()) hydra.Cast(); if (tiamat.IsOwned() && Player.Distance(m) < tiamat.Range && tiamat.IsReady() && !E.IsReady()) tiamat.Cast(); } if (realondash && !m.IsZombie && useR && Player.Distance(m.Position) <= 550) { if (useQ) Q.Cast(m); if (useR && m.HealthPercent >= Menu.Item("targetMinHPforR").GetValue<Slider>().Value) { if (Player.Distance(m.Position) <= 380) { Utility.DelayAction.Add((500 - ping), () => { CastRSmart(m); lastRCastTick = Game.Time; }); } else { CastRSmart(m); lastRCastTick = Game.Time; } } if (useW && Player.Distance(m.Position) <= 540) { W.Cast(); } if (hydra.IsOwned() && Player.Distance(m) < hydra.Range && hydra.IsReady() && !E.IsReady()) hydra.Cast(); if (tiamat.IsOwned() && Player.Distance(m) < tiamat.Range && tiamat.IsReady() && !E.IsReady()) tiamat.Cast(); } if (useW && Player.Distance(m.Position) <= 540) W.Cast(); if (useQ && Player.Distance(m.Position) <= Q.Range) Q.Cast(m); if (!UseEOnlyAfterAA && E.Instance.Name == "FizzJump" && useE && Player.Distance(m.Position) > 300 && Player.Distance(m.Position) <= E.Range + 270 && !W.IsReady() && !Q.IsReady() && !R.IsReady()) { castPosition = E.GetPrediction(m, false, 1).CastPosition; E.Cast(castPosition); Utility.DelayAction.Add((680 - ping), () => { if (!W.IsReady() && !Q.IsReady() && Player.Distance(m.Position) > 330 && Player.Distance(m.Position) <= 400 + 270) { E.Cast(E.GetPrediction(m, false, 1).CastPosition); } }); if (ondash && useZhonya && canCastZhonyaOnDash) { Utility.DelayAction.Add((2150 - ping), () => { zhonya.Cast(); }); } if (gapclose && useZhonya && canCastZhonyaOnDash) { Utility.DelayAction.Add((2150 - ping), () => { zhonya.Cast(); }); } if (afterdash && useZhonya && canCastZhonyaOnDash) { Utility.DelayAction.Add((2150 - ping), () => { zhonya.Cast(); }); } } } }
private static void Harass() { var useQ = (Menu.Item("useharassQ").GetValue<bool>() && Q.IsReady()); var useW = (Menu.Item("useharassW").GetValue<bool>() && W.IsReady()); var useE = (Menu.Item("useharassE").GetValue<bool>() && E.IsReady()); var m = SelectedTarget; if (!m.IsValidTarget()) { m = TargetSelector.GetTarget(530, TargetSelector.DamageType.Magical); if (!m.IsValidTarget()) { m = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical); if (!m.IsValidTarget()) { m = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.True); } } } if (m.IsValidTarget()) { if (ObjectManager.Player.ManaPercent <= Menu.Item("harassmana").GetValue<Slider>().Value) { return; } #region EWQ Combo //EWQ Combo if (Menu.Item("useEWQ").GetValue<bool>()) { if (Q.IsReady()) { //Do EWQ if (Player.Mana >= Q.ManaCost + E.ManaCost + W.ManaCost || enoughManaEWQ) { if (useE && E.Instance.Name == "FizzJump" && Player.Distance(m.Position) <= 530) { enoughManaEWQ = true; startPos = Player.Position; SharpDX.Vector3 harassEcastPosition = E.GetPrediction(m, false, 1).CastPosition; E.Cast(harassEcastPosition); //Delay for fizzjumptwo Utility.DelayAction.Add((365 - ping), () => E.Cast(E.GetPrediction(m, false, 1).CastPosition.Extend(startPos, -135))); } if (useW && (Player.Distance(m.Position) <= 175)) { W.Cast(); enoughManaEWQ = false; } } //Do EQ if (Player.Mana >= Q.ManaCost + E.ManaCost || enoughManaEQ) { if (useE && E.Instance.Name == "FizzJump" && Player.Distance(m.Position) <= 530) { enoughManaEQ = true; startPos = Player.Position; SharpDX.Vector3 harassEcastPosition3 = E.GetPrediction(m, false, 1).CastPosition; E.Cast(harassEcastPosition3); //Delay for fizzjumptwo Utility.DelayAction.Add((365 - ping), () => { E.Cast(E.GetPrediction(m, false, 1).CastPosition.Extend(startPos, -135)); enoughManaEQ = false; }); } } } } #endregion //Basic Harass WQ AA E else { if (useW && (Player.Distance(m.Position) <= Q.Range)) W.Cast(); if (useQ && (Player.Distance(m.Position) <= Q.Range)) { harassQCastedPosition = Player.Position; Q.Cast(m); } } } }
public void AddTriangle(Vector3 v1, Vector3 v2, Vector3 v3, Color color, Dates date) { trianglePoints.Add(v1); trianglePoints.Add(v2); trianglePoints.Add(v3); triangleColors.Add(color); triangleDates.Add(date); EmptyTriangleBuffer(); }
private static void EFlashCombo() { //E Flash RWQ Combo var m = SelectedTarget; if (m.IsValidTarget()) { Orbwalking.Orbwalk(m ?? null, Game.CursorPos); var distance = Player.Distance(m.Position); if (distance <= (E.Range + F.Range + 165)) { //E if (E.IsReady() && E.Instance.Name == "FizzJump") { //Use E1 castPosition = E.GetPrediction(m, false, 1).CastPosition.Extend(Player.Position, -165); E.Cast(castPosition); Utility.DelayAction.Add((990 - ping), () => isEProcessed = true); } //Flash if (F.IsReady() && !isEProcessed && Player.LastCastedSpellName() == "FizzJump" && Player.Distance(m.Position) <= F.Range + 530 && Player.Distance(m.Position) >= 330) { SharpDX.Vector3 endPosition = F.GetPrediction(m, false, 1).CastPosition.Extend(Player.Position, -135); F.Cast(endPosition); } if (R.IsReady() && !F.IsReady()) { CastRSmart(m); } if (W.IsReady() && !F.IsReady() && Player.LastCastedSpellName() == "FizzMarinerDoom") { W.Cast(); } if (Q.IsReady() && !E.IsReady() && !F.IsReady() && Player.LastCastedSpellName() == "FizzSeastonePassive") { Q.Cast(m); } if (Player.LastCastedSpellName() == "FizzPiercingStrike" && Menu.Item("EFlashComboZhonya").GetValue<bool>()) { //Check if zhonya is active if (zhonya.IsOwned() && zhonya.IsReady()) { zhonya.Cast(); } } } } }
public void Draw(RenderContext11 renderContext, bool space3d) { Vector3d cam = Vector3d.TransformCoordinate(Earth3d.MainWindow.RenderContext11.CameraPosition, Matrix3d.Invert(Earth3d.WorldMatrix)); if (!space3d) { if (Vector3d.Dot(cam, pos) < 0) { return; } } Vector3d temp = pos; if (Earth3d.MainWindow.SolarSystemMode) { temp.Add( Earth3d.MainWindow.viewCamera.ViewTarget); } Matrix3d wvp = renderContext.World * renderContext.View * renderContext.Projection; Vector3 screenPos = Vector3.Project(temp.Vector311, renderContext.ViewPort.TopLeftX, renderContext.ViewPort.TopLeftY,renderContext.ViewPort.Width,renderContext.ViewPort.Height, 0, 1, wvp.Matrix11); // Get the w component of the transformed object position; if it's negative the // object is behind the viewer. double w = wvp.M14 * temp.X + wvp.M24 * temp.Y + wvp.M34 * temp.Z + wvp.M44; if (w < 0.0 && Earth3d.MainWindow.SolarSystemMode) { // Don't show labels that are behind the viewer return; } screenPos = new Vector3((float)(int)screenPos.X, (float)(int)screenPos.Y, 1); Sprite2d.Draw2D(renderContext, texture, new SizeF(20, 20), new PointF(0, 0), 0, new PointF(screenPos.X, screenPos.Y), Color.White); if (Earth3d.MainWindow.SolarSystemMode || Style == LabelSytle.Telrad) { Matrix3d worldMatrix = renderContext.World; Matrix3d viewMatrix = renderContext.View; Matrix3d projectionMatrix = renderContext.Projection; double labelScale = Earth3d.MainWindow.SolarSystemMode ? 8.0 : 30.0; renderContext.World = Matrix3d.Scaling(labelScale, labelScale, 1.0) * Matrix3d.Translation(screenPos.X + 10.0, -screenPos.Y, 0.0) * Matrix3d.Translation(-renderContext.ViewPort.Width / 2, renderContext.ViewPort.Height / 2, 0); renderContext.View = Matrix3d.Identity; renderContext.Projection = Matrix3d.OrthoLH(renderContext.ViewPort.Width, renderContext.ViewPort.Height, 1, -1); renderContext.BlendMode = BlendMode.PremultipliedAlpha; textBatch.Draw(renderContext, 1, Color.White); renderContext.World = worldMatrix; renderContext.View = viewMatrix; renderContext.Projection = projectionMatrix; } else { renderContext.BlendMode = BlendMode.PremultipliedAlpha; textBatch.Draw(renderContext, 1, Color.White); } //todo11 Implement this //sprite.Begin(SpriteFlags.AlphaBlend | SpriteFlags.SortTexture); //sprite.Draw(texture, rect, center, screenPos, Color.White); //Rectangle recttext = new Rectangle((int)(screenPos.X + 15), (int)(screenPos.Y - 8), 0, 0); //Earth3d.MainWindow.labelFont.DrawText(sprite, Text, recttext, //DrawTextFormat.NoClip, System.Drawing.Color.White); //sprite.End(); }
public SkyLabel(RenderContext11 renderContext, Vector3d point, string text, LabelSytle style) { Text = text; Style = style; if (texture == null) { texture = Texture11.FromBitmap(Properties.Resources.circle, 0); } pos = point; center = new Vector3(9, 9, 0); textBatch = new Text3dBatch(80); if (style == LabelSytle.Telrad) { // Telrad-style labels are always screen-aligned Text3d t3 = new Text3d(new Vector3d(0, 0, 0.1), new Vector3d(0, 1, 0), text, 20, .01); t3.alignment = Text3d.Alignment.Left; textBatch.Add(t3); } else { // This will produce sky or orbit aligned text textBatch.Add(new Text3d(pos, new Vector3d(0,1,0), text, 20, .01)); } }
public static Matrix RotationMatrixFromRotationVector(Matrix rotationVector) { double angle = rotationVector.Norm(); var axis = new SharpDX.Vector3((float)(rotationVector[0] / angle), (float)(rotationVector[1] / angle), (float)(rotationVector[2] / angle)); // Why the negative sign? SharpDX returns a post-multiply matrix. Instead of transposing to get the pre-multiply matrix we just invert the input rotation. var sR = SharpDX.Matrix.RotationAxis(axis, -(float)angle); var R = new Matrix(3, 3); for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) R[i, j] = sR[i, j]; return R; }
public void DrawPlaceMarks() { // todo11 port this Maybe instancing later? Matrix projection = Earth3d.MainWindow.RenderContext11.Projection.Matrix11; Matrix view = Earth3d.MainWindow.RenderContext11.View.Matrix11; Matrix world = Earth3d.MainWindow.RenderContext11.World.Matrix11; Matrix3d worldD = Earth3d.MainWindow.RenderContext11.World; Matrix wvp = (world * view * projection); try { Vector3 center = new Vector3(0f, 0f, 0); foreach (KmlPlacemark placemark in Placemarks) { if (placemark.ShouldDisplay()) { SharpDX.Direct3D11.Viewport vp = Earth3d.MainWindow.RenderContext11.ViewPort; double alt = placemark.Point.altitude + EGM96Geoid.Height(placemark.Point.latitude, placemark.Point.longitude); Vector3d point3d = Coordinates.GeoTo3dDouble(placemark.Point.latitude, placemark.Point.longitude, 1 + (alt / Earth3d.MainWindow.RenderContext11.NominalRadius)); Vector3 point = Vector3.Project(point3d.Vector311, vp.TopLeftX, vp.TopLeftY, vp.Width, vp.Height, 0, 1, wvp); // point.Z = 1; KmlStyle style = placemark.Style.GetStyle(placemark.Selected); Texture11 texture = style.IconStyle.Icon.Texture; if (String.IsNullOrEmpty(style.IconStyle.Icon.Href)) { texture = Star; } double sizeFactor = 1; if (placemark.Selected) { double ticks = HiResTimer.TickCount; double elapsedSeconds = ((double)(ticks - TicksAtLastSelect)) / HiResTimer.Frequency; sizeFactor = 1 + .3 * (Math.Sin(elapsedSeconds * 15) * Math.Max(0, (1 - elapsedSeconds))); } point3d.TransformCoordinate(worldD); Vector3d dist = Earth3d.MainWindow.RenderContext11.CameraPosition - point3d; double distance = dist.Length() * Earth3d.MainWindow.RenderContext11.NominalRadius; dist.Normalize(); double dot = Vector3d.Dot(point3d, dist); // if (dot > -.2) { double baseSize = Math.Min(40, 25 * ((2 * Math.Atan(.5 * (5884764 / distance))) / .7853)) * sizeFactor; float size = (float)baseSize * style.IconStyle.Scale; //todo fix this with real centers and offset by KML data placemark.hitTestRect = new Rectangle((int)(point.X - (size / 2)), (int)(point.Y - (size / 2)), (int)(size + .5), (int)(size + .5)); if (texture != null) { center = new Vector3((float)texture.Width / 2f, (float)texture.Height / 2f, 0); Sprite2d.Draw2D(Earth3d.MainWindow.RenderContext11, texture, new SizeF(size, size), new PointF(center.X, center.Y), (float)(style.IconStyle.Heading * Math.PI / 180f), new PointF(point.X, point.Y), Color.White); } if (style.LabelStyle.Color.A > 0 && style.LabelStyle.Scale > 0) { Rectangle recttext = new Rectangle((int)(point.X + (size / 2) + 10), (int)(point.Y - (size / 2)), 1000, 100); //todo11 Earth3d.MainWindow.labelFont.DrawText(null, placemark.Name, recttext, DrawTextFormat.NoClip, style.LabelStyle.Color); } } } } } finally { } }
public void AddLine(Vector3 v1, Vector3 v2) { linePoints.Add(new Vector3d(v1)); linePoints.Add(new Vector3d(v2)); EmptyLineBuffer(); }