Exemplo n.º 1
0
 public void DebugDraw()
 {
     foreach (MyGridPhysics physics in Static.m_optimizedGrids)
     {
         MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(physics.Entity.LocalAABB, physics.Entity.WorldMatrix), Color.Yellow, 1f, false, false, false);
     }
 }
Exemplo n.º 2
0
        private void DebugDrawAABB(BoundingBox aabb, Matrix localMatrix)
        {
            Matrix matrix = (Matrix.CreateScale((Vector3)(2f * aabb.HalfExtents)) * localMatrix) * base.PositionComp.WorldMatrix;

            MyRenderProxy.DebugDrawAxis(MatrixD.Normalize(matrix), 0.1f, false, false, false);
            MyRenderProxy.DebugDrawOBB(matrix, Color.Green, 0.1f, false, false, true, false);
        }
Exemplo n.º 3
0
 public override void Draw()
 {
     base.Draw();
     if (OnDraw != null)
     {
         try
         {
             OnDraw();
         }
         catch (Exception)
         {
             OnDraw = null;
         }
     }
     foreach (Tuple <BoundingBoxD, Color> tuple in AABBsToDraw)
     {
         MyRenderProxy.DebugDrawAABB(tuple.Item1, tuple.Item2, 1f, 1f, false, false, false);
     }
     foreach (Tuple <Matrix, Color> tuple2 in MatricesToDraw)
     {
         MyRenderProxy.DebugDrawAxis(tuple2.Item1, 1f, false, false, false);
         MyRenderProxy.DebugDrawOBB(tuple2.Item1, tuple2.Item2, 1f, false, false, true, false);
     }
     foreach (Tuple <Vector3, Vector3, Color> tuple3 in LinesToDraw)
     {
         MyRenderProxy.DebugDrawLine3D(tuple3.Item1, tuple3.Item2, tuple3.Item3, tuple3.Item3, false, false);
     }
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public override void Draw()
        {
            base.Draw();
            if (OnDraw != null)
            {
                try
                {
                    OnDraw();
                }
                catch (Exception e)
                {
                    OnDraw = null;
                }
            }

            foreach (var entry in AABBsToDraw)
            {
                MyRenderProxy.DebugDrawAABB(entry.Item1, entry.Item2, 1f, 1f, false);
            }

            foreach (var entry in MatricesToDraw)
            {
                MyRenderProxy.DebugDrawAxis(entry.Item1, 1f, false);
                MyRenderProxy.DebugDrawOBB(entry.Item1, entry.Item2, 1f, false, false);
            }
        }
Exemplo n.º 6
0
        private void DebugDrawOBB(MyOrientedBoundingBox obb, Matrix localMatrix)
        {
            Matrix matrix = (Matrix.CreateFromTransformScale(obb.Orientation, obb.Center, (Vector3)(2f * obb.HalfExtent)) * localMatrix) * base.PositionComp.WorldMatrix;

            MyRenderProxy.DebugDrawAxis(MatrixD.Normalize(matrix), 0.1f, false, false, false);
            MyRenderProxy.DebugDrawOBB(matrix, Vector3.One, 0.1f, false, false, true, false);
        }
        public void DebugDraw()
        {
            var mat = MatrixD.Invert(m_worldInv);
            MyOrientedBoundingBoxD obb = new MyOrientedBoundingBoxD(MatrixD.CreateScale(m_halfExtents) * mat);

            MyRenderProxy.DebugDrawOBB(obb, Color.Red, 0.3f, false, false);
        }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
        public override void DebugDraw()
        {
            MyOrientedBoundingBoxD bbox = new MyOrientedBoundingBoxD(Center, m_halfExtents, m_orientation);
            var red = new Vector3(1, 0, 0);

            MyRenderProxy.DebugDrawOBB(bbox, red, 0.6f, true, false);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
            }
        }
        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);
        }
 // Draw OBB and highlight it white if selected
 private void DrawOBB(MyOrientedBoundingBoxD obb, Color color, float alpha, int identificationIndex)
 {
     if (identificationIndex == m_selected)
     {
         MyRenderProxy.DebugDrawOBB(obb, Color.White, 0.2f, false, false);
     }
     else
     {
         MyRenderProxy.DebugDrawOBB(obb, color, alpha, false, false);
     }
 }
Exemplo n.º 14
0
        public override void DebugDraw()
        {
            if (m_boxes != null)
                for (int i = 0; i < m_boxes.Count; i++)
                {
                    var b = m_boxes[i];
                    b.Center += Sector.WorldPos;

                    MyRenderProxy.DebugDrawOBB(b, Color.Aquamarine, .3f, true, true);
                }
}
Exemplo n.º 15
0
        public void DebugDraw()
        {
            MatrixD    matrix      = MatrixD.Invert(this.m_worldInv);
            Quaternion orientation = Quaternion.CreateFromRotationMatrix(matrix.GetOrientation());

            foreach (BoundingBox box in this.m_segments)
            {
                Vector3D halfExtents = new Vector3D(box.Size) * 0.51;
                Vector3D center      = Vector3D.Transform(new Vector3D(box.Min + box.Max) * 0.5, matrix);
                MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(center, halfExtents, orientation), Color.Red, 0.5f, false, false, false);
            }
        }
Exemplo n.º 16
0
        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);
            }
        }
Exemplo n.º 17
0
 public void DebugDraw()
 {
     this.m_navmeshOBBs.DebugDraw();
     this.m_navInputMesh.DebugDraw();
     MyRenderProxy.DebugDrawOBB(this.m_extendedBaseOBB, Color.White, 0f, true, false, false);
     using (List <BoundingBoxD> .Enumerator enumerator = this.m_groundCaptureAABBs.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             MyRenderProxy.DebugDrawAABB(enumerator.Current, Color.Yellow, 1f, 1f, true, false, false);
         }
     }
 }
Exemplo n.º 18
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);
            }
        }
        public override void Draw()
        {
            if (!m_enabled)
            {
                return;
            }

            if (this.m_selectedCoordSys == 0)// && this.m_lastSelectedCoordSys != 0)
            {
                this.m_drawBoundingBox = false;
            }
            else if (this.m_selectedCoordSys != 0)// && this.m_lastSelectedCoordSys == 0)
            {
                this.m_drawBoundingBox = true;
            }


            if (m_drawBoundingBox)
            {
                MyLocalCoordSys coordSys = this.GetCoordSysById(m_selectedCoordSys);
                if (coordSys != null)
                {
                    coordSys.Draw();
                }
            }

            base.Draw();

            if (!MyFakes.ENABLE_DEBUG_DRAW_COORD_SYS)
            {
                return;
            }

            // DEBUG DRAW BELOW

            foreach (MyLocalCoordSys coordSys in m_localCoordSystems.Values)
            {
                MyRenderProxy.DebugDrawSphere(coordSys.Origin.Position, 0.05f, Color.Orange, 1.0f, false);
                MyRenderProxy.DebugDrawLine3D(coordSys.Origin.Position, coordSys.Origin.Position + coordSys.Origin.Rotation.Forward, Color.Red, Color.Red, false);
                MyRenderProxy.DebugDrawLine3D(coordSys.Origin.Position, coordSys.Origin.Position + coordSys.Origin.Rotation.Up, Color.Green, Color.Green, false);
                MyRenderProxy.DebugDrawLine3D(coordSys.Origin.Position, coordSys.Origin.Position + coordSys.Origin.Rotation.Right, Color.Blue, Color.Blue, false);

                MyRenderProxy.DebugDrawLine3D(coordSys.Origin.Position, coordSys.Origin.Position + coordSys.Origin.TransformMatrix.Forward, Color.OrangeRed, Color.OrangeRed, false);
                MyRenderProxy.DebugDrawLine3D(coordSys.Origin.Position, coordSys.Origin.Position + coordSys.Origin.TransformMatrix.Up, Color.GreenYellow, Color.GreenYellow, false);
                MyRenderProxy.DebugDrawLine3D(coordSys.Origin.Position, coordSys.Origin.Position + coordSys.Origin.TransformMatrix.Right, Color.BlueViolet, Color.BlueViolet, false);

                MyRenderProxy.DebugDrawOBB(coordSys.BoundingBox, Color.Orange, 0.1f, true, false);
            }
        }
        public void DebugDraw()
        {
            MatrixD    mat         = MatrixD.Invert(m_worldInv);
            Quaternion orientation = Quaternion.CreateFromRotationMatrix(mat.GetOrientation());

            foreach (var segment in m_segments)
            {
                Vector3D halfExtents = new Vector3D(segment.Size) * 0.51;
                Vector3D center      = new Vector3D(segment.Min + segment.Max) * 0.5;
                center = Vector3D.Transform(center, mat);

                var obb = new MyOrientedBoundingBoxD(center, halfExtents, orientation);
                MyRenderProxy.DebugDrawOBB(obb, Color.Red, 0.5f, false, false);
            }
        }
Exemplo n.º 21
0
        public static void DebugDrawChunk(this VRage.Game.Voxels.IMyStorage self, Vector3I start, Vector3I end, Color?c = new Color?())
        {
            if (c == null)
            {
                c = new Color?(Color.Blue);
            }
            BoundingBoxD box = new BoundingBoxD((Vector3D)start, end + 1);

            box.Translate((Vector3D)(-(self.Size * 0.5) - 0.5));
            foreach (MyVoxelBase base2 in from x in MySession.Static.VoxelMaps.Instances
                     where ReferenceEquals(x.Storage, self)
                     select x)
            {
                MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(box, base2.WorldMatrix), c.Value, 0.5f, true, true, false);
            }
        }
Exemplo n.º 22
0
        public void DebugDraw()
        {
            int index = 0;

            while (index < this.m_obbs.Length)
            {
                int num2 = 0;
                while (true)
                {
                    if (num2 >= this.m_obbs[0].Length)
                    {
                        index++;
                        break;
                    }
                    if (this.m_obbs[index][num2] != null)
                    {
                        MyRenderProxy.DebugDrawOBB(this.m_obbs[index][num2].Value, Color.Red, 0f, true, false, false);
                    }
                    num2++;
                }
            }
            MyRenderProxy.DebugDrawOBB(this.BaseOBB, Color.White, 0f, true, false, false);
            if (this.m_obbs[0][0] != null)
            {
                MyRenderProxy.DebugDrawSphere(this.m_obbs[0][0].Value.Center, 5f, Color.Yellow, 0f, true, false, true, false);
            }
            if (this.m_obbs[0][this.OBBsPerLine - 1] != null)
            {
                MyRenderProxy.DebugDrawSphere(this.m_obbs[0][this.OBBsPerLine - 1].Value.Center, 5f, Color.Green, 0f, true, false, true, false);
            }
            if (this.m_obbs[this.OBBsPerLine - 1][this.OBBsPerLine - 1] != null)
            {
                MyRenderProxy.DebugDrawSphere(this.m_obbs[this.OBBsPerLine - 1][this.OBBsPerLine - 1].Value.Center, 5f, Color.Blue, 0f, true, false, true, false);
            }
            if (this.m_obbs[this.OBBsPerLine - 1][0] != null)
            {
                MyRenderProxy.DebugDrawSphere(this.m_obbs[this.OBBsPerLine - 1][0].Value.Center, 5f, Color.White, 0f, true, false, true, false);
            }
            MyOrientedBoundingBoxD?nullable  = this.m_obbs[0][0];
            MyOrientedBoundingBoxD?nullable2 = this.m_obbs[this.OBBsPerLine - 1][0];
            MyOrientedBoundingBoxD?nullable3 = this.m_obbs[this.OBBsPerLine - 1][this.OBBsPerLine - 1];

            MyRenderProxy.DebugDrawSphere(GetOBBCorner(nullable.Value, OBBCorner.LowerBackLeft), 5f, Color.White, 0f, true, false, true, false);
            MyRenderProxy.DebugDrawSphere(GetOBBCorner(nullable2.Value, OBBCorner.LowerBackRight), 5f, Color.White, 0f, true, false, true, false);
            MyRenderProxy.DebugDrawSphere(GetOBBCorner(nullable3.Value, OBBCorner.LowerFrontRight), 5f, Color.White, 0f, true, false, true, false);
        }
Exemplo n.º 23
0
        public override void DebugDraw()
        {
            if (MyDebugDrawSettings.DEBUG_DRAW_MODEL_DUMMIES)
            {
                Quaternion orientation;
                Vector3D   pos;
                Vector3    halfExtents;
                foreach (var srcMatrix in m_langingGear.LockPositions)
                {
                    m_langingGear.GetBoxFromMatrix(srcMatrix, out halfExtents, out pos, out orientation);

                    var m = Matrix.CreateFromQuaternion(orientation);
                    m.Translation = pos;
                    m             = Matrix.CreateScale(halfExtents * 2 * new Vector3(2.0f, 1.0f, 2.0f)) * m;
                    MyRenderProxy.DebugDrawOBB(m, Color.Yellow.ToVector3(), 1.0f, false, false);
                }
            }
        }
Exemplo n.º 24
0
        public static void DebugDrawChunk(this IMyStorage self, Vector3I start, Vector3I end, Color?c = null)
        {
            if (!c.HasValue)
            {
                c = Color.Blue;
            }

            var vmaps = MySession.Static.VoxelMaps.Instances.Where(x => x.Storage == self);

            var box = new BoundingBoxD(start, end + 1);

            box.Translate(-((Vector3D)self.Size * .5) - .5);

            foreach (var map in vmaps)
            {
                MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(box, map.WorldMatrix), c.Value, 0.5f, true, true);
            }
        }
        public void DebugDraw()
        {
            if (MyPlanetEnvironmentSessionComponent.DebugDrawSectors)
            {
                if (MyPlanetEnvironmentSessionComponent.DebugDrawDynamicObjectClusters)
                {
                    using (var batch = MyRenderProxy.DebugDrawBatchAABB(MatrixD.Identity, new Color(Color.Green, 0.2f), true, true))
                    {
                        foreach (var box in m_sectorBoxes)
                        {
                            BoundingBoxD bb = box;
                            batch.Add(ref bb);
                        }
                    }
                }
            }

            if (MyPlanetEnvironmentSessionComponent.DebugDrawProxies)
            {
                foreach (var proxy in Proxies.Values)
                {
                    proxy.DebugDraw();
                }

                foreach (var proxy in OutgoingProxies.Values)
                {
                    proxy.DebugDraw(true);
                }
            }

            if (MyPlanetEnvironmentSessionComponent.DebugDrawCollisionCheckers)
            {
                if (m_obstructorsPerSector != null)
                {
                    foreach (var obbList in m_obstructorsPerSector.Values)
                    {
                        foreach (var obb in obbList)
                        {
                            MyRenderProxy.DebugDrawOBB(obb, Color.Red, 0.1f, true, true);
                        }
                    }
                }
            }
        }
Exemplo n.º 26
0
 public override unsafe void DebugDraw()
 {
     if (MyDebugDrawSettings.DEBUG_DRAW_ROTORS)
     {
         Vector3    vector;
         Vector3D   vectord;
         Quaternion quaternion;
         this.m_motor.ComputeTopQueryBox(out vectord, out vector, out quaternion);
         MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(vectord, vector, quaternion), Color.Green.ToVector3(), 1f, false, false, false);
         if (this.m_motor.Rotor != null)
         {
             MyRenderProxy.DebugDrawSphere(Vector3D.Transform(this.m_motor.DummyPosition, this.m_motor.CubeGrid.WorldMatrix) + (Vector3D.Transform((this.m_motor.Rotor as MyMotorRotor).WheelDummy, this.m_motor.RotorGrid.WorldMatrix) - this.m_motor.RotorGrid.WorldMatrix.Translation), 0.1f, Color.Green, 1f, false, false, true, false);
             BoundingSphere  boundingSphere = this.m_motor.Rotor.Model.BoundingSphere;
             BoundingSphere *spherePtr1     = (BoundingSphere *)ref boundingSphere;
             spherePtr1->Center = (Vector3)Vector3D.Transform(boundingSphere.Center, this.m_motor.Rotor.WorldMatrix);
             MyRenderProxy.DebugDrawSphere(boundingSphere.Center, boundingSphere.Radius, Color.Red, 1f, false, false, true, false);
         }
     }
 }
Exemplo n.º 27
0
        private static unsafe bool DrawTerrainLimits(MyPlanet planet, MyOrientedBoundingBoxD obb)
        {
            float    num;
            float    num2;
            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())
            {
                return(false);
            }
            Vector3D vectord = obb.Orientation.Up * num;

            obb.Center       = vectord + (((obb.Orientation.Up * num2) - vectord) * 0.5);
            obb.HalfExtent.Y = (num2 - num) * 0.5f;
            MyRenderProxy.DebugDrawOBB(new MyOrientedBoundingBoxD(obb.Center, obb.HalfExtent, obb.Orientation), Color.Blue, 0f, true, false, false);
            return(true);
        }
            public override void Draw()
            {
                base.Draw();

                if (MySession.Static == null)
                {
                    m_list.ClearList();
                }

                m_list.ApplyChanges();

                Text("Queried Out Areas: {0}", m_list.Count);

                foreach (var info in m_list)
                {
                    MyRenderProxy.DebugDrawOBB(info.Bounds, Color.Cyan, .2f, true, true);

                    //MyRenderProxy.DebugDrawText3D(info.Bounds.Center, string.Format("{0}: {1}", info.Body.StorageName, info.Id), Color.Cyan, .8f, true);
                }
            }
Exemplo n.º 29
0
        internal void DebugDraw(Vector3I sectorPos, float sectorSize)
        {
            using (m_instancePartsLock.AcquireSharedUsing())
            {
                foreach (var idata in m_instanceParts.Values)
                {
                    using (idata.InstanceBufferLock.AcquireSharedUsing())
                    {
                        foreach (var entry in idata.InstanceData)
                        {
                            var ii = entry.Value;
                            var itemWorldPosition = Vector3D.Transform(ii.LocalMatrix.Translation, m_sectorMatrix);



                            //var dist = (itemWorldPosition - Sandbox.Game.World.MySector.MainCamera.Position).Length();
                            //if (dist < 30)

                            //BoundingBoxD bb = idata.ModelBox.Transform(ii.LocalMatrix);
                            MyRenderProxy.DebugDrawOBB(Matrix.Rescale(ii.LocalMatrix * m_sectorMatrix, idata.ModelBox.HalfExtents * 2), Color.OrangeRed, .5f, true, true);

                            var dist = Vector3D.Distance(MySector.MainCamera.Position, itemWorldPosition);
                            if (dist < 250)
                            {
                                MyRenderProxy.DebugDrawText3D(itemWorldPosition, idata.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);
        }
Exemplo n.º 30
0
 protected void DebugDrawDummies(MyModel model)
 {
     if (model != null)
     {
         float    num  = 0f;
         Vector3D zero = Vector3D.Zero;
         if (MySector.MainCamera != null)
         {
             num  = MyDebugDrawSettings.DEBUG_DRAW_MODEL_DUMMIES_DISTANCE * MyDebugDrawSettings.DEBUG_DRAW_MODEL_DUMMIES_DISTANCE;
             zero = MySector.MainCamera.WorldMatrix.Translation;
         }
         foreach (KeyValuePair <string, MyModelDummy> pair in model.Dummies)
         {
             MatrixD matrix = pair.Value.Matrix * this.Entity.PositionComp.WorldMatrix;
             if ((num == 0f) || (Vector3D.DistanceSquared(zero, matrix.Translation) <= num))
             {
                 MyRenderProxy.DebugDrawText3D(matrix.Translation, pair.Key, Color.White, 0.7f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false);
                 MyRenderProxy.DebugDrawAxis(MatrixD.Normalize(matrix), 0.1f, false, false, false);
                 MyRenderProxy.DebugDrawOBB(matrix, Vector3.One, 0.1f, false, false, true, false);
             }
         }
     }
 }