Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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++;
                }
            }
        }
Exemplo n.º 5
0
        public void DebugDraw()
        {
            MatrixD  viewMatrix = MySector.MainCamera.ViewMatrix;
            Vector3D?nullable   = null;

            foreach (MyHighLevelPrimitive local1 in this.m_pathNodes)
            {
                Vector3D down = MyGravityProviderSystem.CalculateTotalGravityInPoint(local1.WorldPosition);
                if (Vector3D.IsZero(down, 0.001))
                {
                    down = Vector3D.Down;
                }
                down.Normalize();
                MyHighLevelPrimitive local2   = local1;
                Vector3D             position = local2.WorldPosition + (down * -10.0);
                MyRenderProxy.DebugDrawSphere(position, 1f, Color.IndianRed, 1f, false, false, true, false);
                MyRenderProxy.DebugDrawLine3D(local2.WorldPosition, position, Color.IndianRed, Color.IndianRed, false, false);
                if (nullable != null)
                {
                    MyRenderProxy.DebugDrawLine3D(position, nullable.Value, Color.IndianRed, Color.IndianRed, false, false);
                }
                nullable = new Vector3D?(position);
            }
            MyRenderProxy.DebugDrawSphere(this.m_startPoint, 0.5f, Color.HotPink, 1f, false, false, true, false);
            if (this.m_goal != null)
            {
                this.m_goal.DebugDraw();
            }
            if (MyFakes.DEBUG_DRAW_FOUND_PATH)
            {
                Vector3D?nullable2 = null;
                for (int i = 0; i < this.m_expandedPath.Count; i++)
                {
                    Vector3D position = new Vector3D(this.m_expandedPath[i]);
                    float    w        = (float)this.m_expandedPath[i].W;
                    Color    color    = (i == (this.m_expandedPath.Count - 1)) ? Color.OrangeRed : Color.Orange;
                    MyRenderProxy.DebugDrawPoint(position, color, false, false);
                    MyRenderProxy.DebugDrawText3D(position + (viewMatrix.Right * 0.10000000149011612), w.ToString(), color, 0.7f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false);
                    if (nullable2 != null)
                    {
                        MyRenderProxy.DebugDrawLine3D(nullable2.Value, position, Color.Pink, Color.Pink, false, false);
                    }
                    nullable2 = new Vector3D?(position);
                }
            }
        }
Exemplo n.º 6
0
 public virtual unsafe void DebugDraw()
 {
     if (this.AgentEntity != null)
     {
         MyAiTargetBase aiTargetBase = this.m_actions.AiTargetBase;
         if ((aiTargetBase != null) && aiTargetBase.HasTarget())
         {
             MyRenderProxy.DebugDrawPoint(aiTargetBase.TargetPosition, Color.Aquamarine, false, false);
             if ((this.BotEntity != null) && (aiTargetBase.TargetEntity != null))
             {
                 string text = null;
                 text = (aiTargetBase.TargetType != MyAiTargetEnum.CUBE) ? $"Target:{aiTargetBase.TargetEntity.ToString()}" : $"Target:{aiTargetBase.GetTargetBlock()}";
                 Vector3D center  = this.BotEntity.PositionComp.WorldAABB.Center;
                 double * numPtr1 = (double *)ref center.Y;
                 numPtr1[0] += this.BotEntity.PositionComp.WorldAABB.HalfExtents.Y + 0.20000000298023224;
                 MyRenderProxy.DebugDrawText3D(center, text, Color.Red, 1f, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP, -1, false);
             }
         }
         this.m_botLogic.DebugDraw();
     }
 }
Exemplo n.º 7
0
 public override void Draw()
 {
     base.Draw();
     if (MyDebugDrawSettings.DEBUG_DRAW_METEORITS_DIRECTIONS)
     {
         Vector3D m_currDir = GetCorrectedDirection(MySector.DirectionToSunNormalized);
         MyRenderProxy.DebugDrawPoint(m_meteorHitPos, Color.White, false);
         MyRenderProxy.DebugDrawText3D(m_meteorHitPos, "Hit position", Color.White, 0.5f, false);
         MyRenderProxy.DebugDrawLine3D(m_tgtPos, m_tgtPos + 10 * MySector.DirectionToSunNormalized, Color.Yellow, Color.Yellow, false);
         MyRenderProxy.DebugDrawText3D(m_tgtPos + 10 * MySector.DirectionToSunNormalized, "Sun direction (sd)", Color.Yellow, 0.5F, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);
         MyRenderProxy.DebugDrawLine3D(m_tgtPos, m_tgtPos + 10 * m_currDir, Color.Red, Color.Red, false);
         MyRenderProxy.DebugDrawText3D(m_tgtPos + 10 * m_currDir, "Current meteorits direction (cd)", Color.Red, 0.5F, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP);
         if (MyGravityProviderSystem.IsPositionInNaturalGravity(m_tgtPos))
         {
             MyRenderProxy.DebugDrawLine3D(m_tgtPos, m_tgtPos + 10 * m_normalSun, Color.Blue, Color.Blue, false);
             MyRenderProxy.DebugDrawText3D(m_tgtPos + 10 * m_normalSun, "Perpendicular to sd and n0 ", Color.Blue, 0.5F, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
             MyRenderProxy.DebugDrawLine3D(m_tgtPos, m_tgtPos + 10 * m_pltTgtDir, Color.Green, Color.Green, false);
             MyRenderProxy.DebugDrawText3D(m_tgtPos + 10 * m_pltTgtDir, "Dir from center of planet to target (n0)", Color.Green, 0.5F, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
             MyRenderProxy.DebugDrawLine3D(m_tgtPos, m_tgtPos + 10 * m_mirrorDir, Color.Purple, Color.Purple, false);
             MyRenderProxy.DebugDrawText3D(m_tgtPos + 10 * m_mirrorDir, "Horizon in plane n0 and sd (ho)", Color.Purple, 0.5F, false, MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
         }
     }
 }