public override bool DebugDraw() { if (MyDebugDrawSettings.DEBUG_DRAW_CONNECTORS_AND_MERGE_BLOCKS) { Matrix WorldMatrix = m_shipMergeBlock.PositionComp.WorldMatrix; MyRenderProxy.DebugDrawLine3D(m_shipMergeBlock.Physics.RigidBody.Position, m_shipMergeBlock.Physics.RigidBody.Position + m_shipMergeBlock.WorldMatrix.Right, Color.Green, Color.Green, false); MyRenderProxy.DebugDrawSphere(Vector3.Transform(m_shipMergeBlock.Position * m_shipMergeBlock.CubeGrid.GridSize, Matrix.Invert(m_shipMergeBlock.WorldMatrix)), 1, Color.Green, 1, false); MyRenderProxy.DebugDrawSphere(m_shipMergeBlock.WorldMatrix.Translation, 0.2f, m_shipMergeBlock.InConstraint ? Color.Yellow : Color.Orange, 1, false); if (m_shipMergeBlock.InConstraint) { MyRenderProxy.DebugDrawSphere(m_shipMergeBlock.Other.WorldMatrix.Translation, 0.2f, Color.Yellow, 1, false); MyRenderProxy.DebugDrawLine3D(m_shipMergeBlock.WorldMatrix.Translation, m_shipMergeBlock.Other.WorldMatrix.Translation, Color.Yellow, Color.Yellow, false); } MyRenderProxy.DebugDrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + m_shipMergeBlock.CubeGrid.WorldMatrix.GetDirectionVector(Base6Directions.GetDirection(m_shipMergeBlock.PositionComp.LocalMatrix.Right)), Color.Red, Color.Red, false); MyRenderProxy.DebugDrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + m_shipMergeBlock.CubeGrid.WorldMatrix.GetDirectionVector(Base6Directions.GetDirection(m_shipMergeBlock.PositionComp.LocalMatrix.Up)), Color.Green, Color.Green, false); MyRenderProxy.DebugDrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + m_shipMergeBlock.CubeGrid.WorldMatrix.GetDirectionVector(Base6Directions.GetDirection(m_shipMergeBlock.PositionComp.LocalMatrix.Backward)), Color.Blue, Color.Blue, false); MyRenderProxy.DebugDrawLine3D(WorldMatrix.Translation, WorldMatrix.Translation + m_shipMergeBlock.CubeGrid.WorldMatrix.GetDirectionVector(m_shipMergeBlock.OtherRight), Color.Violet, Color.Violet, false); MyRenderProxy.DebugDrawText3D(WorldMatrix.Translation, "Bodies: " + m_shipMergeBlock.GridCount, Color.White, 1.0f, false); if (m_shipMergeBlock.Other != null) { float x = (float)Math.Exp(-((WorldMatrix.Translation - m_shipMergeBlock.Other.WorldMatrix.Translation).Length() - m_shipMergeBlock.CubeGrid.GridSize) * 6.0f); MyRenderProxy.DebugDrawText3D(WorldMatrix.Translation + m_shipMergeBlock.CubeGrid.WorldMatrix.GetDirectionVector(Base6Directions.GetDirection(m_shipMergeBlock.PositionComp.LocalMatrix.Up)) * 0.5f, x.ToString("0.00"), Color.Red, 1.0f, false); } } return(true); }
internal void DebugDraw(Vector3I sectorPos, float sectorSize) { using (m_instancePartsLock.AcquireSharedUsing()) { foreach (var part in m_instanceParts.Values) { foreach (var data in part.InstanceData) { var itemWorldPosition = Vector3D.Transform(data.InstanceData.LocalMatrix.Translation, m_sectorMatrix); var dist = (itemWorldPosition - Sandbox.Game.World.MySector.MainCamera.Position).Length(); if (dist < 30) { MyRenderProxy.DebugDrawText3D(itemWorldPosition, part.SubtypeId.ToString(), Color.White, 0.7f, true); } } } } //BoundingBoxD bb = new BoundingBoxD(sectorPos * sectorSize, (sectorPos + Vector3I.One) * sectorSize); //BoundingBoxD bb2 = new BoundingBoxD(m_AABB.Min, m_AABB.Max); //bb2.Min = Vector3D.Max(bb2.Min, bb.Min); //bb2.Max = Vector3D.Min(bb2.Max, bb.Max); //MyRenderProxy.DebugDrawAABB(bb, Color.Orange, 1.0f, 1.0f, true); //MyRenderProxy.DebugDrawAABB(bb2, Color.OrangeRed, 1.0f, 1.0f, true); MyRenderProxy.DebugDrawAABB(SectorWorldBox, Color.OrangeRed, 1.0f, 1.0f, true); }
internal void DebugDraw(Vector3I sectorPos, float sectorSize) { using (this.m_instancePartsLock.AcquireSharedUsing()) { foreach (MyModelInstanceData data in this.m_instanceParts.Values) { using (data.InstanceBufferLock.AcquireSharedUsing()) { foreach (KeyValuePair <int, MyInstanceData> pair in data.InstanceData) { MyInstanceData data2 = pair.Value; Matrix localMatrix = data2.LocalMatrix; Vector3D vectord = Vector3D.Transform(localMatrix.Translation, this.m_sectorMatrix); BoundingBox modelBox = data.ModelBox; MyRenderProxy.DebugDrawOBB(Matrix.Rescale(data2.LocalMatrix * this.m_sectorMatrix, modelBox.HalfExtents * 2f), Color.OrangeRed, 0.5f, true, true, true, false); if (Vector3D.Distance(MySector.MainCamera.Position, vectord) < 250.0) { MyRenderProxy.DebugDrawText3D(vectord, data.SubtypeId.ToString(), Color.White, 0.7f, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } } } } } MyRenderProxy.DebugDrawAABB(this.SectorWorldBox, Color.OrangeRed, 1f, 1f, true, false, false); }
public override bool DebugDraw() { base.DebugDraw(); if (MyDebugDrawSettings.DEBUG_DRAW_BLOCK_NAMES && m_terminal.CustomName != null && MySession.Static.ControlledEntity != null) { var character = (MySession.Static.ControlledEntity as Sandbox.Game.Entities.Character.MyCharacter); Vector3D disp = character == null ? Vector3D.Zero : character.WorldMatrix.Up; Vector3D pos = m_terminal.PositionComp.WorldMatrix.Translation + disp * m_terminal.CubeGrid.GridSize * 0.4f; Vector3D viewerPos = MySession.Static.ControlledEntity.Entity.WorldMatrix.Translation; var dist = (pos - viewerPos).Length(); if (dist > 35.0f) { return(true); } Color c = Color.LightSteelBlue; c.A = dist < 15.0f ? (byte)255 : (byte)((15.0f - dist) * 12.75f); var size = Math.Min(8.0f / dist, 1.0f); MyRenderProxy.DebugDrawText3D(pos, "<- " + m_terminal.CustomName.ToString(), c, (float)size, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); } return(true); }
void DrawTrashAdminView() { float metric; var state = MyTrashRemoval.GetTrashState(m_grid, MyTrashRemoval.PreviewSettings); var color = Color.Green; var aabb = m_grid.PositionComp.WorldAABB; if (state != MyTrashRemovalFlags.None) { color = Color.Red; string name = MyTrashRemoval.GetName(state); if (state == MyTrashRemovalFlags.WithBlockCount) { name = string.Format(name, MyTrashRemoval.PreviewSettings.BlockCountThreshold); if (m_grid.BlocksCount < MyTrashRemoval.PreviewSettings.BlockCountThreshold) { color = Color.Green; } } else if (state == MyTrashRemovalFlags.DistanceFromPlayer) { name = string.Format(name, MyTrashRemoval.PreviewSettings.PlayerDistanceThreshold); } MyRenderProxy.DebugDrawText3D(aabb.Center, name, color, 0.7f, false, VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } MyRenderProxy.DebugDrawAABB(aabb, color, 1, 1, false); }
public override void DebugDraw() { if (MyDebugDrawSettings.DEBUG_DRAW_COCKPIT) { if (this.m_cockpit.AiPilot != null) { this.m_cockpit.AiPilot.DebugDraw(); } MyRenderProxy.DebugDrawText3D(this.m_cockpit.PositionComp.WorldMatrix.Translation, this.m_cockpit.IsShooting() ? "PEW!" : "", Color.Red, 2f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); if (this.m_cockpit.Pilot != null) { foreach (Vector3I vectori in this.m_cockpit.NeighbourPositions) { Vector3D vectord; if (this.m_cockpit.IsNeighbourPositionFree(vectori, out vectord)) { MyRenderProxy.DebugDrawSphere(vectord, 0.3f, Color.Green, 1f, false, false, true, false); } else { MyRenderProxy.DebugDrawSphere(vectord, 0.3f, Color.Red, 1f, false, false, true, false); } } } } }
private void DebugDrawPath(PathInfo pathInfo, float offset, int index) { #if ENHANCED_DEBUG for (int i = 0; i < pathInfo.PathNodes.Count - 1; i++) { var startNode = pathInfo.PathNodes[i]; var endNode = pathInfo.PathNodes[i + 1]; var startPosition = Vector3D.Transform(startNode.Pos * m_grid.GridSize, m_grid.WorldMatrix); var endPosition = Vector3D.Transform(endNode.Pos * m_grid.GridSize, m_grid.WorldMatrix); var offsetVector = new Vector3(offset); //MyRenderProxy.DebugDrawLine3D(startPosition + offsetVector, endPosition + offsetVector, Color.Red, Color.Red, false); DrawSlidingLine(endPosition + offsetVector, startPosition + offsetVector, Color.White, Color.Red); if (startNode.IsStatic) { MyRenderProxy.DebugDrawSphere(startPosition + offsetVector, 0.5f, Color.Gray, 1, false); } if (i == pathInfo.PathNodes.Count - 2) { MyRenderProxy.DebugDrawText3D(endPosition + offsetVector, index.ToString() + " (" + pathInfo.Ratio + ")", Color.White, 0.5f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); } } #endif }
internal void DebugDraw() { string text = $"CubeParts:{this.m_cubeParts.Count}, EdgeParts{this.m_edgeInfosNew.Count}"; MyRenderProxy.DebugDrawText3D(this.m_boundingBox.Center + this.m_gridRenderComponent.Container.Entity.PositionComp.WorldMatrix.Translation, text, Color.Red, 0.75f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); MyRenderProxy.DebugDrawOBB((Matrix.CreateScale(this.m_boundingBox.Size) * Matrix.CreateTranslation(this.m_boundingBox.Center)) * this.m_gridRenderComponent.Container.Entity.PositionComp.WorldMatrix, Color.Red.ToVector3(), 0.25f, true, true, true, false); }
public override unsafe void DebugDraw() { base.DebugDraw(); if ((MyDebugDrawSettings.DEBUG_DRAW_BLOCK_NAMES && (this.m_terminal.CustomName != null)) && (MySession.Static.ControlledEntity != null)) { Vector3D up; MyCharacter controlledEntity = MySession.Static.ControlledEntity as MyCharacter; if (controlledEntity != null) { up = controlledEntity.WorldMatrix.Up; } else { up = Vector3D.Zero; } Vector3D vectord = up; Vector3D worldCoord = this.m_terminal.PositionComp.WorldMatrix.Translation + ((vectord * this.m_terminal.CubeGrid.GridSize) * 0.40000000596046448); double num = (worldCoord - MySession.Static.ControlledEntity.Entity.WorldMatrix.Translation).Length(); if (num <= 35.0) { Color *colorPtr1; Color lightSteelBlue = Color.LightSteelBlue; colorPtr1.A = (num < 15.0) ? ((byte)0xff) : ((byte)((15.0 - num) * 12.75)); colorPtr1 = (Color *)ref lightSteelBlue; MyRenderProxy.DebugDrawText3D(worldCoord, "<- " + this.m_terminal.CustomName.ToString(), lightSteelBlue, (float)Math.Min((double)(8.0 / num), (double)1.0), false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, -1, false); } } }
public override void DebugDraw() { base.DebugDraw(); if (this.HumanoidEntity != null) { this.HumanoidActions.AiTargetBase.DebugDraw(); MatrixD xd = this.HumanoidEntity.GetHeadMatrix(true, true, false, true, false); if (this.HumanoidActions.AiTargetBase.HasTarget()) { Vector3D vectord; float num; this.HumanoidActions.AiTargetBase.DrawLineToTarget(xd.Translation); this.HumanoidActions.AiTargetBase.GetTargetPosition(xd.Translation, out vectord, out num); if (vectord != Vector3D.Zero) { MyRenderProxy.DebugDrawSphere(vectord, 0.3f, Color.Red, 0.4f, false, false, true, false); MyRenderProxy.DebugDrawText3D(vectord, "GetTargetPosition", Color.Red, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } } MyRenderProxy.DebugDrawAxis(this.HumanoidEntity.PositionComp.WorldMatrix, 1f, false, false, false); MatrixD xd2 = xd; xd2.Translation = Vector3.Zero; Matrix.Transpose((Matrix)xd2).Translation = xd.Translation; } }
public override void Draw() { base.Draw(); Text("Node Allocs/Deallocs from last update: {0}", m_allocs); foreach (var handler in m_sortedHandlers) { MyRenderProxy.DebugDraw6FaceConvex(handler.FrustumBounds, new Color(My2DClipmapHelpers.LodColors[handler.Lod], 1), 0.2f, true, true); } m_activeClipmap = 0; for (; m_activeClipmap < m_tree.Length; m_activeClipmap++) { var t = m_tree[m_activeClipmap]; var wpos = Vector3.Transform(m_tree[m_activeClipmap].LastPosition, m_tree[m_activeClipmap].WorldMatrix); MyRenderProxy.DebugDrawSphere(wpos, 500, Color.Red, 1, true); MyRenderProxy.DebugDrawText3D(wpos, ((Base6Directions.Direction)m_activeClipmap).ToString(), Color.Blue, 1, true); // local space basis var center = t.WorldMatrix.Translation; Vector3D right = Vector3D.Transform(Vector3D.Right * 10000, t.WorldMatrix); Vector3D up = Vector3D.Transform(Vector3D.Up * 10000, t.WorldMatrix); MyRenderProxy.DebugDrawText3D(center, ((Base6Directions.Direction)m_activeClipmap).ToString(), Color.Blue, 1, true); MyRenderProxy.DebugDrawLine3D(center, up, Color.Green, Color.Green, true); MyRenderProxy.DebugDrawLine3D(center, right, Color.Red, Color.Red, true); } }
public void DebugDraw() { if (!MyDebugDrawSettings.DEBUG_DRAW_CONVEYORS) { return; } Vector3 pos = (ConnectingPosition1.LocalGridPosition + ConnectingPosition1.VectorDirection * 0.5f) * CubeBlock.CubeGrid.GridSize; Vector3 pos2 = (ConnectingPosition2.LocalGridPosition + ConnectingPosition2.VectorDirection * 0.5f) * CubeBlock.CubeGrid.GridSize; pos = Vector3.Transform(pos, CubeBlock.CubeGrid.WorldMatrix); pos2 = Vector3.Transform(pos2, CubeBlock.CubeGrid.WorldMatrix); Color color = ConveyorLine.IsFunctional ? Color.Orange : Color.DarkRed; color = ConveyorLine.IsWorking ? Color.GreenYellow : color; MyRenderProxy.DebugDrawLine3D(pos, pos2, color, color, false); if (ConveyorLine == null) { return; } if (MyDebugDrawSettings.DEBUG_DRAW_CONVEYORS_LINE_IDS) { MyRenderProxy.DebugDrawText3D((pos + pos2) * 0.5f, ConveyorLine.GetHashCode().ToString(), color, 0.5f, false); } }
public override void DebugDraw() { if (MyDebugDrawSettings.DEBUG_DRAW_CONNECTORS_AND_MERGE_BLOCKS) { MyRenderProxy.DebugDrawSphere(this.m_shipConnector.ConstraintPositionWorld(), 0.05f, Color.Red, 1f, false, false, true, false); MyRenderProxy.DebugDrawText3D(this.m_shipConnector.PositionComp.WorldMatrix.Translation, this.m_shipConnector.DetectedGridCount.ToString(), Color.Red, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } }
private void DrawCube(float size, KeyValuePair <Vector3I, Element> c, ref Color color, string text) { var local = Matrix.CreateScale(size * 1.02f) * Matrix.CreateTranslation(c.Key * size /*+ new Vector3(0, -c.Value.CurrentOffset / 20.0f, 0)*/); Matrix box = local * m_grid.WorldMatrix; MyRenderProxy.DebugDrawOBB(box, color.ToVector3(), 0.5f, true, true); MyRenderProxy.DebugDrawText3D(box.Translation, text, c.Value.Cubes.Count > 1 ? Color.Black : Color.White, 0.5f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); }
private unsafe void DebugDrawInternal() { if (this.m_navmeshOBBs != null) { this.m_navmeshOBBs.DebugDraw(); } if (this.DrawNavmesh) { this.DrawPersistentDebugNavmesh(false); } if (this.DrawPhysicalMesh) { this.DebugDrawPhysicalShapes(); } Vector3D position = MySession.Static.ControlledEntity.ControllerInfo.Controller.Player.GetPosition(); double * numPtr1 = (double *)ref position.Y; numPtr1[0] += 2.4000000953674316; MyRenderProxy.DebugDrawText3D(position, $"X: {Math.Round(position.X, 2)} Y: {Math.Round(position.Y, 2)} Z: {Math.Round(position.Z, 2)}", Color.Red, 1f, true, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); if (this.m_lastGroundMeshQuery.Count > 0) { MyRenderProxy.DebugDrawSphere(this.m_lastGroundMeshQuery[0].Center, 1f, Color.Yellow, 1f, true, false, true, false); foreach (BoundingBoxD xd2 in this.m_lastGroundMeshQuery) { MyRenderProxy.DebugDrawOBB(xd2.Matrix, Color.Yellow, 0f, true, false, true, false); } if (this.m_navmeshOBBs != null) { float num; float num2; foreach (MyNavmeshOBBs.OBBCoords coords in this.m_debugDrawIntersectedOBBs) { MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(coords.OBB.Center, new Vector3(coords.OBB.HalfExtent.X, coords.OBB.HalfExtent.Y / 2.0, coords.OBB.HalfExtent.Z), coords.OBB.Orientation), Color.White, 0f, true, false, false); } MyOrientedBoundingBoxD obb = this.m_navmeshOBBs.GetOBB(0, 0).Value; MyPlanet planet = this.GetPlanet(obb.Center); Vector3 *points = (Vector3 *)stackalloc byte[(((IntPtr)4) * sizeof(Vector3))]; GetMiddleOBBPoints(obb, ref points); planet.Provider.Shape.GetBounds(points, 4, out num, out num2); if (num.IsValid() && num2.IsValid()) { Vector3D vectord2 = obb.Orientation.Up * num2; MyRenderProxy.DebugDrawSphere(obb.Orientation.Up * num, 1f, Color.Blue, 0f, true, false, true, false); MyRenderProxy.DebugDrawSphere(vectord2, 1f, Color.Blue, 0f, true, false, true, false); } DrawTerrainLimits(planet, obb); } MyRenderProxy.DebugDrawSphere(this.m_meshCenter, 2f, Color.Red, 0f, true, false, true, false); } if ((this.m_polygons != null) && (this.m_pathfindingDebugTarget != null)) { Vector3D vectord3 = -Vector3D.Normalize(MyGravityProviderSystem.CalculateTotalGravityInPoint(this.m_pathfindingDebugTarget.Value)); MyRenderProxy.DebugDrawSphere(this.m_pathfindingDebugTarget.Value + (1.5 * vectord3), 0.2f, Color.Red, 0f, true, false, true, false); } }
public void DebugDraw(ref MatrixD drawMatrix) { for (int i = 0; i < m_vertices.Count; ++i) { MyRenderProxy.DebugDrawLine3D(m_vertices[i].Coord, m_vertices[m_vertices[i].Next].Coord, Color.DarkRed, Color.DarkRed, false); MyRenderProxy.DebugDrawPoint(m_vertices[i].Coord, Color.Red, false); MyRenderProxy.DebugDrawText3D(m_vertices[i].Coord + Vector3.Right * 0.05f, i.ToString() + "/" + m_vertices.Count.ToString(), Color.Red, 0.45f, false); } }
public override void DebugDraw() { if (MyDebugDrawSettings.DEBUG_DRAW_CONNECTORS_AND_MERGE_BLOCKS) { MyRenderProxy.DebugDrawSphere(m_shipConnector.ConstraintPositionWorld(), 0.05f, Color.Red, 1, false); //MyRenderProxy.DebugDrawText3D(this.WorldMatrix.Translation, m_connectionPosition.ToString(), Color.Red, 1.0f, false); //MyRenderProxy.DebugDrawText3D(this.WorldMatrix.Translation, m_connectorMode == Mode.Connector ? "Connector" : "Ejector", Color.Red, 1.0f, false); MyRenderProxy.DebugDrawText3D(m_shipConnector.PositionComp.WorldMatrix.Translation, m_shipConnector.DetectedGridCount.ToString(), Color.Red, 1.0f, false); } }
internal static void DebugDrawBlockGroups <TNode, TGroupData>(MyGroups <TNode, TGroupData> groups) where TGroupData : IGroupData <TNode>, new() where TNode : MySlimBlock { int hue = 0; BoundingBoxD aabb1, aabb2; foreach (var g in groups.Groups) { Color color = new Vector3((hue++ % 15) / 15.0f, 1, 1).HSVtoColor(); foreach (var m in g.Nodes) { try { m.NodeData.GetWorldBoundingBox(out aabb1); foreach (var child in m.Children) { m_tmpBlocksDebugHelper.Add(child); } // This is O(n^2), but it's only debug draw foreach (var child in m_tmpBlocksDebugHelper) { MyGroups <TNode, TGroupData> .Node node = null; int count = 0; foreach (var c in m.Children) { if (child == c) { node = c; count++; } } node.NodeData.GetWorldBoundingBox(out aabb2); MyRenderProxy.DebugDrawLine3D(aabb1.Center, aabb2.Center, color, color, false); MyRenderProxy.DebugDrawText3D((aabb1.Center + aabb2.Center) * 0.5f, count.ToString(), color, 1.0f, false); } var lightColor = new Color(color.ToVector3() + 0.25f); MyRenderProxy.DebugDrawSphere(aabb1.Center, 0.2f, lightColor.ToVector3(), 0.5f, false, true); MyRenderProxy.DebugDrawText3D(aabb1.Center, m.LinkCount.ToString(), lightColor, 1.0f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } finally { m_tmpBlocksDebugHelper.Clear(); } } } }
public void DebugDraw(Matrix worldMatrix) { if (!MyDebugDrawSettings.DEBUG_DRAW_RESOURCE_RECEIVERS) { return; } Vector3 position = worldMatrix.Translation + worldMatrix.Up; MyRenderProxy.DebugDrawText3D(position, ToString(), Color.White, 0.5f, true, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); }
internal void DebugDraw() { string text = String.Format("CubeParts:{0}, EdgeParts{1}", m_cubeParts.Count, m_edgeInfosNew.Count); MyRenderProxy.DebugDrawText3D(m_boundingBox.Center + m_gridRenderComponent.Container.Entity.PositionComp.WorldMatrix.Translation, text, Color.Red, 0.75f, false); var localMatrix = Matrix.CreateScale(m_boundingBox.Size) * Matrix.CreateTranslation(m_boundingBox.Center); var matrix = localMatrix * m_gridRenderComponent.Container.Entity.PositionComp.WorldMatrix; MyRenderProxy.DebugDrawOBB(matrix, Color.Red.ToVector3(), 0.25f, true, true); }
private void DrawCube(float size, Vector3I pos, ref Color color, string text) { var local = Matrix.CreateScale(size * 1.02f) * Matrix.CreateTranslation(pos * size); Matrix box = local * m_grid.WorldMatrix; MyRenderProxy.DebugDrawOBB(box, color.ToVector3(), 0.5f, true, true); if (DrawText && text != null && text != "0.00" && (Vector3D.Distance(box.Translation, Sandbox.Game.World.MySector.MainCamera.Position) < 30)) { MyRenderProxy.DebugDrawText3D(box.Translation, text, Color.White, 0.5f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER); } }
private int m_hasParallelWorkPending; // Has to be int because interlocked does not work on bools. #endregion #endregion public new void DebugDraw() { if (LodLevel < 0 && !HasPhysics) { return; } Color color = Color.Red; if (MyPlanetEnvironmentSessionComponent.ActiveSector == this) { color = Color.LimeGreen; if (DataView != null) { if (MyPlanetEnvironmentSessionComponent.DebugDrawActiveSectorItems) { for (int index = 0; index < DataView.Items.Count; index++) { var item = DataView.Items[index]; var pos = item.Position + SectorCenter; MyRuntimeEnvironmentItemInfo def; Owner.GetDefinition((ushort)item.DefinitionIndex, out def); MyRenderProxy.DebugDrawText3D(pos, string.Format("{0} i{1} m{2} d{3}", def.Type.Name, index, item.ModelIndex, item.DefinitionIndex), color, 0.7f, true); } } if (MyPlanetEnvironmentSessionComponent.DebugDrawActiveSectorProvider) { foreach (var log in DataView.LogicalSectors) { log.DebugDraw(DataView.Lod); } } } } else if (HasPhysics && LodLevel == -1) { color = Color.RoyalBlue; } var center = (Bounds[4] + Bounds[7]) / 2; if (MyPlanetEnvironmentSessionComponent.ActiveSector == this || Vector3D.DistanceSquared(center, MySector.MainCamera.Position) < MyPlanetEnvironmentSessionComponent.DebugDrawDistance * MyPlanetEnvironmentSessionComponent.DebugDrawDistance) { var label = ToString(); MyRenderProxy.DebugDrawText3D(center, label, color, 1, true); } MyRenderProxy.DebugDraw6FaceConvex(Bounds, color, 1, true, false); }
internal static void DebugDrawBlockGroups <TNode, TGroupData>(MyGroups <TNode, TGroupData> groups) where TNode : MySlimBlock where TGroupData : IGroupData <TNode>, new() { int num = 0; using (HashSet <MyGroups <TNode, TGroupData> .Group> .Enumerator enumerator = groups.Groups.GetEnumerator()) { while (enumerator.MoveNext()) { num++; Color colorFrom = new Vector3(((float)(num % 15)) / 15f, 1f, 1f).HSVtoColor(); HashSetReader <MyGroups <TNode, TGroupData> .Node> nodes = enumerator.Current.Nodes; foreach (MyGroups <TNode, TGroupData> .Node node in nodes) { try { BoundingBoxD xd; node.NodeData.GetWorldBoundingBox(out xd, false); SortedDictionaryValuesReader <long, MyGroups <TNode, TGroupData> .Node> children = node.Children; foreach (MyGroups <TNode, TGroupData> .Node node2 in children) { m_tmpBlocksDebugHelper.Add(node2); } foreach (object obj2 in m_tmpBlocksDebugHelper) { BoundingBoxD xd2; MyGroups <TNode, TGroupData> .Node node3 = null; int num2 = 0; children = node.Children; foreach (MyGroups <TNode, TGroupData> .Node node4 in children) { if (obj2 == node4) { node3 = node4; num2++; } } node3.NodeData.GetWorldBoundingBox(out xd2, false); MyRenderProxy.DebugDrawLine3D(xd.Center, xd2.Center, colorFrom, colorFrom, false, false); MyRenderProxy.DebugDrawText3D((xd.Center + xd2.Center) * 0.5, num2.ToString(), colorFrom, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } Color color = new Color(colorFrom.ToVector3() + 0.25f); MyRenderProxy.DebugDrawSphere(xd.Center, 0.2f, color.ToVector3(), 0.5f, false, true, true, false); MyRenderProxy.DebugDrawText3D(xd.Center, node.LinkCount.ToString(), color, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, -1, false); } finally { m_tmpBlocksDebugHelper.Clear(); } } } } }
public void DebugDraw() { if (MyFakes.DEBUG_DRAW_NAVMESH_LINKS && MyFakes.DEBUG_DRAW_NAVMESH_HIERARCHY) { foreach (KeyValuePair <MyVoxelPathfinding.CellId, List <MyNavigationPrimitive> > pair in this.m_voxelLinkDictionary) { Vector3I pos = pair.Key.Pos; BoundingBoxD worldAABB = new BoundingBoxD(); MyVoxelCoordSystems.GeometryCellCoordToWorldAABB(pair.Key.VoxelMap.PositionLeftBottomCorner, ref pos, out worldAABB); MyRenderProxy.DebugDrawText3D(worldAABB.Center, "LinkNum: " + pair.Value.Count, Color.Red, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } } }
public override void DebugDraw() { MatrixD positionAndOrientation = base.Parent.PositionAndOrientation; Vector3 forwardVector = base.Parent.ForwardVector; Vector3 vector2 = Vector3.Cross((Vector3)positionAndOrientation.Up, forwardVector); Color colorFrom = this.m_hitLeft ? Color.Orange : Color.Green; MyRenderProxy.DebugDrawLine3D(positionAndOrientation.Translation + positionAndOrientation.Up, ((positionAndOrientation.Translation + positionAndOrientation.Up) + (forwardVector * 0.1f)) + (vector2 * 1.3f), colorFrom, colorFrom, true, false); MyRenderProxy.DebugDrawText3D(positionAndOrientation.Translation + (positionAndOrientation.Up * 3.0), "Hit LT: " + this.m_hitLeftFraction.ToString(), colorFrom, 0.7f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); colorFrom = this.m_hitRight ? Color.Orange : Color.Green; MyRenderProxy.DebugDrawLine3D(positionAndOrientation.Translation + positionAndOrientation.Up, ((positionAndOrientation.Translation + positionAndOrientation.Up) + (forwardVector * 0.1f)) - (vector2 * 1.3f), colorFrom, colorFrom, true, false); MyRenderProxy.DebugDrawText3D(positionAndOrientation.Translation + (positionAndOrientation.Up * 3.2000000476837158), "Hit RT: " + this.m_hitRightFraction.ToString(), colorFrom, 0.7f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); }
public override bool DebugDraw() { foreach (var sec in m_items.Sectors) { sec.Value.DebugDraw(sec.Key, m_items.m_definition.SectorSize); if (sec.Value.IsValid) { var box = sec.Value.SectorBox; MyRenderProxy.DebugDrawText3D(box.Center, m_items.Definition.Id.SubtypeName + " Sector: " + sec.Key, Color.SaddleBrown, 1.0f, true); } } return(true); }
public void DebugDraw(bool lite) { var lastTimestamp = MyAIComponent.Static.Pathfinding.LastHighLevelTimestamp; foreach (var entry in m_primitives) { if (lite) { MyRenderProxy.DebugDrawPoint(entry.Value.WorldPosition, Color.CadetBlue, false); } else { var primitive = entry.Value; Vector3D offset = MySector.MainCamera.WorldMatrix.Down * 0.3f; float dist = (float)Vector3D.Distance(primitive.WorldPosition, MySector.MainCamera.Position); float textSize = 7.0f / dist; if (textSize > 30.0f) { textSize = 30.0f; } if (textSize < 0.5f) { textSize = 0.5f; } if (dist < 100) { List <IMyHighLevelPrimitiveObserver> observingPaths = null; if (m_primitiveObservers.TryGetValue(entry.Key, out observingPaths)) { MyRenderProxy.DebugDrawText3D(primitive.WorldPosition + offset, observingPaths.Count.ToString(), Color.Red, textSize * 3.0f, false); } //MyRenderProxy.DebugDrawSphere(primitive.WorldPosition, 0.2f, Color.CadetBlue, 1.0f, false); MyRenderProxy.DebugDrawText3D(primitive.WorldPosition + offset, entry.Key.ToString(), Color.CadetBlue, textSize, false); } for (int i = 0; i < primitive.GetOwnNeighborCount(); ++i) { var primitive2 = primitive.GetOwnNeighbor(i) as MyHighLevelPrimitive; MyRenderProxy.DebugDrawLine3D(primitive.WorldPosition, primitive2.WorldPosition, Color.CadetBlue, Color.CadetBlue, false); } if (primitive.PathfindingData.GetTimestamp() == lastTimestamp) { MyRenderProxy.DebugDrawSphere(primitive.WorldPosition, 0.5f, Color.DarkRed, 1.0f, false); } } } }
public override void Draw() { base.Draw(); foreach (var line in m_lines) { MyRenderProxy.DebugDrawLine3D(line.From, line.To, line.ColorFrom, line.ColorTo, line.DepthRead); } if (ShowDebugDrawTests) { Vector3D position = new Vector3D(1000000000.0, 1000000000.0, 1000000000.0); MyRenderProxy.DebugDrawLine3D(position, position + Vector3D.Up, Color.Red, Color.Blue, true); position += Vector3D.Left; MyRenderProxy.DebugDrawLine3D(position, position + Vector3D.Up, Color.Red, Color.Blue, false); MyRenderProxy.DebugDrawLine2D(new Vector2(10, 10), new Vector2(50, 50), Color.Red, Color.Blue); position += Vector3D.Left; MyRenderProxy.DebugDrawPoint(position, Color.White, true); position += Vector3D.Left; MyRenderProxy.DebugDrawPoint(position, Color.White, false); position += Vector3D.Left; MyRenderProxy.DebugDrawSphere(position, 0.5f, Color.White, 1.0f, true); position += Vector3D.Left; MyRenderProxy.DebugDrawAABB(new BoundingBoxD(position - Vector3D.One * 0.5, position + Vector3D.One * 0.5), Color.White, 1.0f, 1.0f, true); position += Vector3D.Left; //MyRenderProxy.DebugDrawCone(position, Vector3D.Up, Vector3D.One, Color.Yellow, true); position += Vector3D.Left; MyRenderProxy.DebugDrawAxis(MatrixD.CreateFromTransformScale(Quaternion.Identity, position, Vector3D.One * 0.5), 1.0f, true); position += Vector3D.Left; MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(position, Vector3D.One * 0.5, Quaternion.Identity), Color.White, 1.0f, true, false); position += Vector3D.Left; MyRenderProxy.DebugDrawCylinder(MatrixD.CreateFromTransformScale(Quaternion.Identity, position, Vector3D.One * 0.5), Color.White, 1.0f, true, true); position += Vector3D.Left; MyRenderProxy.DebugDrawTriangle(position, position + Vector3D.Up, position + Vector3D.Left, Color.White, true, true); position += Vector3D.Left; var msg = MyRenderProxy.PrepareDebugDrawTriangles(); msg.AddTriangle(position, position + Vector3D.Up, position + Vector3D.Left); msg.AddTriangle(position, position + Vector3D.Left, position - Vector3D.Up); MyRenderProxy.DebugDrawTriangles(msg, MatrixD.Identity, Color.White, true, true); position += Vector3D.Left; MyRenderProxy.DebugDrawCapsule(position, position + Vector3D.Up, 0.5f, Color.White, true); MyRenderProxy.DebugDrawText2D(new Vector2(100, 100), "text", Color.Green, 1.0f); position += Vector3D.Left; MyRenderProxy.DebugDrawText3D(position, "3D Text", Color.Blue, 1.0f, true); } }
public static CastHit?GetClosestFootSupportPosition(MyEntity characterEntity, MyEntity characterTool, Vector3 from, Vector3 up, Vector3 footDimension, Matrix WorldMatrix, float castDownLimit, float castUpLimit, uint raycastFilterLayer = 0) { bool flag = false; CastHit hit = new CastHit(); MatrixD matrix = WorldMatrix; Vector3 zero = Vector3.Zero; matrix.Translation = Vector3.Zero; zero = (Vector3)Vector3.Transform(zero, matrix); matrix.Translation = (from + (up * castUpLimit)) + zero; Vector3 vector1 = new Vector3(0f, footDimension.Y / 2f, 0f); Vector3 vector4 = new Vector3(0f, footDimension.Y / 2f, -footDimension.Z); Vector3 worldCoord = from + (up * castUpLimit); Vector3 pointTo = from - (up * castDownLimit); if (MyDebugDrawSettings.ENABLE_DEBUG_DRAW && MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_RAYCASTLINE) { MyRenderProxy.DebugDrawText3D(worldCoord + zero, "Cast line", Color.White, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); MyRenderProxy.DebugDrawLine3D(worldCoord + zero, pointTo + zero, Color.White, Color.White, false, false); } if (MyFakes.ENABLE_FOOT_IK_USE_HAVOK_RAYCAST) { MyPhysics.HitInfo info; if (MyDebugDrawSettings.ENABLE_DEBUG_DRAW && MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_RAYCASTLINE) { MyRenderProxy.DebugDrawText3D(worldCoord, "Raycast line", Color.Green, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); MyRenderProxy.DebugDrawLine3D(worldCoord, pointTo, Color.Green, Color.Green, false, false); } if (MyPhysics.CastRay(worldCoord, pointTo, out info, raycastFilterLayer, true)) { flag = true; if (MyDebugDrawSettings.ENABLE_DEBUG_DRAW && MyDebugDrawSettings.DEBUG_DRAW_CHARACTER_IK_RAYCASTHITS) { MyRenderProxy.DebugDrawSphere(info.Position, 0.02f, Color.Green, 1f, false, false, true, false); MyRenderProxy.DebugDrawText3D(info.Position, "RayCast hit", Color.Green, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } if (Vector3.Dot((Vector3)info.Position, up) > Vector3.Dot(hit.Position, up)) { hit.Position = (Vector3)info.Position; hit.Normal = info.HkHitInfo.Normal; } } } if (flag) { return(new CastHit?(hit)); } return(null); }
public void DebugDraw(bool lite) { long lastHighLevelTimestamp = MyCestmirPathfindingShorts.Pathfinding.LastHighLevelTimestamp; foreach (KeyValuePair <int, MyHighLevelPrimitive> pair in this.m_primitives) { if (lite) { MyRenderProxy.DebugDrawPoint(pair.Value.WorldPosition, Color.CadetBlue, false, false); continue; } MyHighLevelPrimitive primitive = pair.Value; Vector3D vectord = MySector.MainCamera.WorldMatrix.Down * 0.30000001192092896; float num2 = (float)Vector3D.Distance(primitive.WorldPosition, MySector.MainCamera.Position); float scale = 7f / num2; if (scale > 30f) { scale = 30f; } if (scale < 0.5f) { scale = 0.5f; } if (num2 < 100f) { List <IMyHighLevelPrimitiveObserver> list = null; if (this.m_primitiveObservers.TryGetValue(pair.Key, out list)) { MyRenderProxy.DebugDrawText3D(primitive.WorldPosition + vectord, list.Count.ToString(), Color.Red, scale * 3f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } MyRenderProxy.DebugDrawText3D(primitive.WorldPosition + vectord, pair.Key.ToString(), Color.CadetBlue, scale, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false); } int index = 0; while (true) { if (index >= primitive.GetOwnNeighborCount()) { if (primitive.PathfindingData.GetTimestamp() == lastHighLevelTimestamp) { MyRenderProxy.DebugDrawSphere(primitive.WorldPosition, 0.5f, Color.DarkRed, 1f, false, false, true, false); } break; } MyHighLevelPrimitive ownNeighbor = primitive.GetOwnNeighbor(index) as MyHighLevelPrimitive; MyRenderProxy.DebugDrawLine3D(primitive.WorldPosition, ownNeighbor.WorldPosition, Color.CadetBlue, Color.CadetBlue, false, false); index++; } } }