public void CollectComponents(ulong packedCoord, List <int> output)
 {
     MyNavmeshComponents.CellInfo cellInfo = new MyNavmeshComponents.CellInfo();
     if (m_navmeshComponents.TryGetCell(packedCoord, out cellInfo))
     {
         for (int i = 0; i < cellInfo.ComponentNum; ++i)
         {
             output.Add(cellInfo.StartingIndex + i);
         }
     }
 }
        public void DebugDraw()
        {
            if (MyFakes.DEBUG_DRAW_NAVMESH_EXPLORED_HL_CELLS)
            {
                foreach (var cell in m_exploredCells)
                {
                    BoundingBoxD cellAABB;
                    Vector3I     cellCopy = cell;

                    MyVoxelCoordSystems.GeometryCellCoordToWorldAABB(m_mesh.VoxelMapReferencePosition, ref cellCopy, out cellAABB);

                    VRageRender.MyRenderProxy.DebugDrawAABB(cellAABB, Color.Sienna, 1.0f, 1.0f, false);
                }
            }

            if (MyFakes.DEBUG_DRAW_NAVMESH_FRINGE_HL_CELLS)
            {
                foreach (var packedCoord in m_navmeshComponents.GetPresentCells())
                {
                    MyCellCoord coord = new MyCellCoord();
                    coord.SetUnpack(packedCoord);
                    Vector3I cellCoord = coord.CoordInLod;

                    if (m_exploredCells.Contains(ref cellCoord))
                    {
                        MyNavmeshComponents.CellInfo cellInfo = new MyNavmeshComponents.CellInfo();
                        if (m_navmeshComponents.TryGetCell(packedCoord, out cellInfo))
                        {
                            for (int i = 0; i < cellInfo.ComponentNum; ++i)
                            {
                                int componentIndex = cellInfo.StartingIndex + i;
                                var primitive      = m_mesh.HighLevelGroup.GetPrimitive(componentIndex);
                                foreach (var direction in Base6Directions.EnumDirections)
                                {
                                    var dirFlag = Base6Directions.GetDirectionFlag(direction);
                                    if (cellInfo.ExploredDirections.HasFlag(dirFlag))
                                    {
                                        continue;
                                    }

                                    if (m_exploredCells.Contains(cellCoord + Base6Directions.GetIntVector(direction)))
                                    {
                                        continue;
                                    }

                                    Vector3 dirVec = Base6Directions.GetVector(direction);
                                    VRageRender.MyRenderProxy.DebugDrawLine3D(primitive.WorldPosition, primitive.WorldPosition + dirVec * 3.0f, Color.Red, Color.Red, false);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void DebugDraw()
 {
     if (MyFakes.DEBUG_DRAW_NAVMESH_EXPLORED_HL_CELLS)
     {
         foreach (Vector3I vectori in this.m_exploredCells)
         {
             BoundingBoxD xd;
             MyVoxelCoordSystems.GeometryCellCoordToWorldAABB(this.m_mesh.VoxelMapReferencePosition, ref vectori, out xd);
             MyRenderProxy.DebugDrawAABB(xd, Color.Sienna, 1f, 1f, false, false, false);
         }
     }
     if (MyFakes.DEBUG_DRAW_NAVMESH_FRINGE_HL_CELLS)
     {
         foreach (ulong num in this.m_navmeshComponents.GetPresentCells())
         {
             MyCellCoord coord = new MyCellCoord();
             coord.SetUnpack(num);
             Vector3I coordInLod = coord.CoordInLod;
             if (this.m_exploredCells.Contains(ref coordInLod))
             {
                 MyNavmeshComponents.CellInfo cellInfo = new MyNavmeshComponents.CellInfo();
                 if (this.m_navmeshComponents.TryGetCell(num, out cellInfo))
                 {
                     int num2 = 0;
                     while (num2 < cellInfo.ComponentNum)
                     {
                         int index = cellInfo.StartingIndex + num2;
                         MyHighLevelPrimitive        primitive      = this.m_mesh.HighLevelGroup.GetPrimitive(index);
                         Base6Directions.Direction[] enumDirections = Base6Directions.EnumDirections;
                         int num4 = 0;
                         while (true)
                         {
                             if (num4 >= enumDirections.Length)
                             {
                                 num2++;
                                 break;
                             }
                             Base6Directions.Direction      dir           = enumDirections[num4];
                             Base6Directions.DirectionFlags directionFlag = Base6Directions.GetDirectionFlag(dir);
                             if (!cellInfo.ExploredDirections.HasFlag(directionFlag) && !this.m_exploredCells.Contains((Vector3I)(coordInLod + Base6Directions.GetIntVector(dir))))
                             {
                                 Vector3 vector = Base6Directions.GetVector(dir);
                                 MyRenderProxy.DebugDrawLine3D(primitive.WorldPosition, primitive.WorldPosition + (vector * 3f), Color.Red, Color.Red, false, false);
                             }
                             num4++;
                         }
                     }
                 }
             }
         }
     }
 }
        public void DebugDraw()
        {
            if (MyFakes.DEBUG_DRAW_NAVMESH_EXPLORED_HL_CELLS)
            {
                foreach (var cell in m_exploredCells)
                {
                    BoundingBoxD cellAABB;
                    Vector3I cellCopy = cell;

                    MyVoxelCoordSystems.GeometryCellCoordToWorldAABB(m_mesh.VoxelMapReferencePosition, ref cellCopy, out cellAABB);

                    VRageRender.MyRenderProxy.DebugDrawAABB(cellAABB, Color.Sienna, 1.0f, 1.0f, false);
                }
            }

            if (MyFakes.DEBUG_DRAW_NAVMESH_FRINGE_HL_CELLS)
            {
                foreach (var packedCoord in m_navmeshComponents.GetPresentCells())
                {
                    MyCellCoord coord = new MyCellCoord();
                    coord.SetUnpack(packedCoord);
                    Vector3I cellCoord = coord.CoordInLod;

                    if (m_exploredCells.Contains(ref cellCoord))
                    {
                        MyNavmeshComponents.CellInfo cellInfo = new MyNavmeshComponents.CellInfo();
                        if (m_navmeshComponents.TryGetCell(packedCoord, out cellInfo))
                        {
                            for (int i = 0; i < cellInfo.ComponentNum; ++i)
                            {
                                int componentIndex = cellInfo.StartingIndex + i;
                                var primitive = m_mesh.HighLevelGroup.GetPrimitive(componentIndex);
                                foreach (var direction in Base6Directions.EnumDirections)
                                {
                                    var dirFlag = Base6Directions.GetDirectionFlag(direction);
                                    if (cellInfo.ExploredDirections.HasFlag(dirFlag))
                                    {
                                        continue;
                                    }

                                    if (m_exploredCells.Contains(cellCoord + Base6Directions.GetIntVector(direction)))
                                    {
                                        continue;
                                    }

                                    Vector3 dirVec = Base6Directions.GetVector(direction);
                                    VRageRender.MyRenderProxy.DebugDrawLine3D(primitive.WorldPosition, primitive.WorldPosition + dirVec * 3.0f, Color.Red, Color.Red, false);
                                }
                            }
                        }
                    }
                }
            }
        }
 public void CollectComponents(ulong packedCoord, List<int> output)
 {
     MyNavmeshComponents.CellInfo cellInfo = new MyNavmeshComponents.CellInfo();
     if (m_navmeshComponents.TryGetCell(packedCoord, out cellInfo))
     {
         for (int i = 0; i < cellInfo.ComponentNum; ++i)
         {
             output.Add(cellInfo.StartingIndex + i);
         }
     }
 }