public static void AddBoundingBox(Vector3[] corners, Color color, float life)
        {
            // Get a DebugShape we can use to draw the box
            DebugShape shape = GetShapeForLines(12, life);

            // Fill in the vertices for the bottom of the box
            shape.Vertices[0] = new VertexPositionColor(corners[0], color);
            shape.Vertices[1] = new VertexPositionColor(corners[1], color);
            shape.Vertices[2] = new VertexPositionColor(corners[1], color);
            shape.Vertices[3] = new VertexPositionColor(corners[2], color);
            shape.Vertices[4] = new VertexPositionColor(corners[2], color);
            shape.Vertices[5] = new VertexPositionColor(corners[3], color);
            shape.Vertices[6] = new VertexPositionColor(corners[3], color);
            shape.Vertices[7] = new VertexPositionColor(corners[0], color);

            // Fill in the vertices for the top of the box
            shape.Vertices[8]  = new VertexPositionColor(corners[4], color);
            shape.Vertices[9]  = new VertexPositionColor(corners[5], color);
            shape.Vertices[10] = new VertexPositionColor(corners[5], color);
            shape.Vertices[11] = new VertexPositionColor(corners[6], color);
            shape.Vertices[12] = new VertexPositionColor(corners[6], color);
            shape.Vertices[13] = new VertexPositionColor(corners[7], color);
            shape.Vertices[14] = new VertexPositionColor(corners[7], color);
            shape.Vertices[15] = new VertexPositionColor(corners[4], color);

            // Fill in the vertices for the vertical sides of the box
            shape.Vertices[16] = new VertexPositionColor(corners[0], color);
            shape.Vertices[17] = new VertexPositionColor(corners[4], color);
            shape.Vertices[18] = new VertexPositionColor(corners[1], color);
            shape.Vertices[19] = new VertexPositionColor(corners[5], color);
            shape.Vertices[20] = new VertexPositionColor(corners[2], color);
            shape.Vertices[21] = new VertexPositionColor(corners[6], color);
            shape.Vertices[22] = new VertexPositionColor(corners[3], color);
            shape.Vertices[23] = new VertexPositionColor(corners[7], color);
        }
        public static void AddLine(Vector3 a, Vector3 b, Color color, float life)
        {
            DebugShape shape = GetShapeForLines(1, life);

            shape.Vertices[0] = new VertexPositionColor(a, color);
            shape.Vertices[1] = new VertexPositionColor(b, color);
        }
        public static void AddBoundingSphere(BoundingSphere sphere, Color color, float life)

        {
            // Get a DebugShape we can use to draw the sphere

            DebugShape shape = GetShapeForLines(sphereLineCount, life);



            // Iterate our unit sphere vertices

            for (int i = 0; i < unitSphere.Length; i++)

            {
                // Compute the vertex position by transforming the point by the radius and center of the sphere

                Vector3 vertPos = unitSphere[i] * sphere.Radius + sphere.Center;



                // Add the vertex to the shape

                shape.Vertices[i] = new VertexPositionColor(vertPos, color);
            }
        }
        public static void AddBoundingFrustum(BoundingFrustum frustum, Color color, float life)
        {
            DebugShape shape = GetShapeForLines(12, life);

            frustum.GetCorners(corners);

            shape.Vertices[0] = new VertexPositionColor(corners[0], color);
            shape.Vertices[1] = new VertexPositionColor(corners[1], color);
            shape.Vertices[2] = new VertexPositionColor(corners[1], color);
            shape.Vertices[3] = new VertexPositionColor(corners[2], color);
            shape.Vertices[4] = new VertexPositionColor(corners[2], color);
            shape.Vertices[5] = new VertexPositionColor(corners[3], color);
            shape.Vertices[6] = new VertexPositionColor(corners[3], color);
            shape.Vertices[7] = new VertexPositionColor(corners[0], color);

            shape.Vertices[8]  = new VertexPositionColor(corners[4], color);
            shape.Vertices[9]  = new VertexPositionColor(corners[5], color);
            shape.Vertices[10] = new VertexPositionColor(corners[5], color);
            shape.Vertices[11] = new VertexPositionColor(corners[6], color);
            shape.Vertices[12] = new VertexPositionColor(corners[6], color);
            shape.Vertices[13] = new VertexPositionColor(corners[7], color);
            shape.Vertices[14] = new VertexPositionColor(corners[7], color);
            shape.Vertices[15] = new VertexPositionColor(corners[4], color);

            shape.Vertices[16] = new VertexPositionColor(corners[0], color);
            shape.Vertices[17] = new VertexPositionColor(corners[4], color);
            shape.Vertices[18] = new VertexPositionColor(corners[1], color);
            shape.Vertices[19] = new VertexPositionColor(corners[5], color);
            shape.Vertices[20] = new VertexPositionColor(corners[2], color);
            shape.Vertices[21] = new VertexPositionColor(corners[6], color);
            shape.Vertices[22] = new VertexPositionColor(corners[3], color);
            shape.Vertices[23] = new VertexPositionColor(corners[7], color);
        }
Example #5
0
 public override void BindToScene(Scene scene)
 {
     base.BindToScene(scene);
     m_debugShape = new DebugShape();
     m_debugShape.BindToScene(scene);
     m_debugShape.RelateGameObject = m_gameObject;
     UpdateSensor();
 }
Example #6
0
        public void DrawDebugItem(DebugShape shape)
        {
            var factory = DebugDrawFactory.Get();

            foreach (var item in _items)
            {
                factory.DrawDebugItem(shape, DebugItem.Converter(item));
            }
        }
Example #7
0
 public override void BindToScene(Scene scene)
 {
     base.BindToScene(scene);
     if (Mgr <GameEngine> .Singleton._gameEngineMode == GameEngine.GameEngineMode.MapEditor)
     {
         m_debugShape = new DebugShape();
         m_debugShape.BindToScene(scene);
     }
 }
        /// <summary>
        /// Adds a line to be rendered for a set amount of time.
        /// </summary>
        /// <param name="a">The first point of the line.</param>
        /// <param name="b">The second point of the line.</param>
        /// <param name="color">The color in which to draw the line.</param>
        /// <param name="life">The amount of time, in seconds, to keep rendering the line.</param>
        public static void AddLine(Vector3 a, Vector3 b, Color color, float life)
        {
            // Get a DebugShape we can use to draw the line
            DebugShape shape = GetShapeForLines(1, life);

            // Add the two vertices to the shape
            shape.Vertices[0] = new VertexPositionColor(a, color);
            shape.Vertices[1] = new VertexPositionColor(b, color);
        }
        public static void AddLineList(List <Vector3> lines, Color color, float life)
        {
            DebugShape shape = GetShapeForLines(lines.Count / 2, life);

            for (int i = 0; i < lines.Count; i += 2)
            {
                shape.Vertices[i]     = new VertexPositionColor(lines[i], color);
                shape.Vertices[i + 1] = new VertexPositionColor(lines[i + 1], color);
            }
        }
Example #10
0
 protected void UpdateDebugShape()
 {
     if (m_debugShape == null)
     {
         m_debugShape = new DebugShape();
         m_debugShape.BindToScene(m_gameObject.Scene);
     }
     m_debugShape.DiffuseColor = Color.Green;
     UpdateDebugShapeVertex();
 }
        public static void AddBoundingSphere(BoundingSphere sphere, Color color, float life)
        {
            DebugShape shape = GetShapeForLines(sphereLineCount, life);

            for (int i = 0; i < unitSphere.Length; i++)
            {
                Vector3 vertPos = unitSphere[i] * sphere.Radius + sphere.Center;

                shape.Vertices[i] = new VertexPositionColor(vertPos, color);
            }
        }
        public static void AddTriangle(Vector3 a, Vector3 b, Vector3 c, Color color, float life)
        {
            DebugShape shape = GetShapeForLines(3, life);

            shape.Vertices[0] = new VertexPositionColor(a, color);
            shape.Vertices[1] = new VertexPositionColor(b, color);
            shape.Vertices[2] = new VertexPositionColor(b, color);
            shape.Vertices[3] = new VertexPositionColor(c, color);
            shape.Vertices[4] = new VertexPositionColor(c, color);
            shape.Vertices[5] = new VertexPositionColor(a, color);
        }
        /// <summary>
        /// Adds a triangle to be rendered for a set amount of time.
        /// </summary>
        /// <param name="a">The first vertex of the triangle.</param>
        /// <param name="b">The second vertex of the triangle.</param>
        /// <param name="c">The third vertex of the triangle.</param>
        /// <param name="color">The color in which to draw the triangle.</param>
        /// <param name="life">The amount of time, in seconds, to keep rendering the triangle.</param>
        public static void AddTriangle(Vector3 a, Vector3 b, Vector3 c, Color color, float life)
        {
            // Get a DebugShape we can use to draw the triangle
            DebugShape shape = GetShapeForLines(3, life);

            // Add the vertices to the shape
            shape.Vertices[0] = new VertexPositionColor(a, color);
            shape.Vertices[1] = new VertexPositionColor(b, color);
            shape.Vertices[2] = new VertexPositionColor(b, color);
            shape.Vertices[3] = new VertexPositionColor(c, color);
            shape.Vertices[4] = new VertexPositionColor(c, color);
            shape.Vertices[5] = new VertexPositionColor(a, color);
        }
        public void DrawBoundingSphere(BoundingSphere sphere, Camera camera)
        {
            DebugShape shape = GetShapeForLines(sphereLineCount, 0);

            for (int i = 0; i < unitSphere.Length; i++)
            {
                Vector3 vertPos = unitSphere[i] * sphere.Radius + sphere.Center;

                shape.Vertices[i] = new VertexPositionColor(vertPos, Color.Red);
            }

            Draw(camera);
            Clear();
        }
        private void decompileFlow(ShapeInfo info, ref DebugTrace trace)
        {
            DebugShape shape = new DebugShape();

            shape.shapeText = info.shapeText;
            shape.ShapeID   = info.ShapeID;
            shape.shapeType = info.shapeType;
            trace.TraceDetails.Add(shape);

            foreach (ShapeInfo child in info.children)
            {
                this.decompileFlow(child, ref trace);
            }
        }
Example #16
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            if (this.dgOrchestration.SelectedRows.Count > 0)
            {
                DataGridViewRow dr = this.dgOrchestration.SelectedRows[0];

                string serviceName  = (string)dr.Cells["ServiceName"].Value;
                string debugSymbols = (string)dr.Cells["DebugSymbols"].Value;

                string destPath;
                destPath = Path.Combine(this._targetFolder, this._requestedFileName);
                FileInfo fi = new FileInfo(destPath);

                int i = 0;
                while (fi.Exists)
                {
                    i++;
                    destPath = Path.Combine(this._targetFolder,
                                            String.Format("{0}-{2}{1}", fi.Name.Replace(fi.Extension, ""), fi.Extension, i));
                    fi = new FileInfo(destPath);
                }

                DebugTrace originalTrace = BTSOrchestrationExplorer.GetDebugTrace(serviceName, debugSymbols, FlatteningPrefixType.ParentName);
                DebugTrace trace         = new DebugTrace();
                foreach (DataGridViewRow row in this.dgDebugShapes.Rows)
                {
                    if (Boolean.Parse((string)row.Cells["AddToScenario"].Value))
                    {
                        DebugShape shape = originalTrace.TraceDetails.Single(s => s.ShapeID.ToString() == (string)row.Cells["ShapeID"].Value);
                        shape.Completed   = Boolean.Parse((string)row.Cells["MustComplete"].Value);
                        shape.RepeatCount = Int32.Parse((string)row.Cells["RepeatCount"].Value);
                        trace.TraceDetails.Add(shape);
                    }
                }
                trace.Export(destPath);

                if (this._project != null)
                {
                    EnvDTE.ProjectItem item = this._project.ProjectItems.AddFromFile(destPath);

                    EnvDTE.Property prop = item.Properties.Item("BuildAction");
                    prop.Value = 2;

                    Tools.AddConfigKeys(this._project, this.txtDTAServerName.Text, this.txtDTADBName.Text, "BizTalkMgmtDb");
                }

                this.Close();
            }
        }
        private static DebugShape GetShapeForLines(int lineCount, float life)
        {
            DebugShape shape = null;


            int vertCount = lineCount * 2;

            if (shape == null)
            {
                shape = new DebugShape {
                    Vertices = new VertexPositionColor[vertCount]
                };
                activeShapes.Add(shape);
            }

            shape.LineCount = lineCount;
            shape.Lifetime  = life;

            return(shape);
        }
        public void DrawBoundingBox(BoundingBox box, Camera camera)
        {
            DebugShape shape = GetShapeForLines(12, 0);

            box.GetCorners(corners);

            Color color = Color.Red;

            shape.Vertices[0] = new VertexPositionColor(corners[0], color);
            shape.Vertices[1] = new VertexPositionColor(corners[1], color);
            shape.Vertices[2] = new VertexPositionColor(corners[1], color);
            shape.Vertices[3] = new VertexPositionColor(corners[2], color);
            shape.Vertices[4] = new VertexPositionColor(corners[2], color);
            shape.Vertices[5] = new VertexPositionColor(corners[3], color);
            shape.Vertices[6] = new VertexPositionColor(corners[3], color);
            shape.Vertices[7] = new VertexPositionColor(corners[0], color);

            shape.Vertices[8]  = new VertexPositionColor(corners[4], color);
            shape.Vertices[9]  = new VertexPositionColor(corners[5], color);
            shape.Vertices[10] = new VertexPositionColor(corners[5], color);
            shape.Vertices[11] = new VertexPositionColor(corners[6], color);
            shape.Vertices[12] = new VertexPositionColor(corners[6], color);
            shape.Vertices[13] = new VertexPositionColor(corners[7], color);
            shape.Vertices[14] = new VertexPositionColor(corners[7], color);
            shape.Vertices[15] = new VertexPositionColor(corners[4], color);

            shape.Vertices[16] = new VertexPositionColor(corners[0], color);
            shape.Vertices[17] = new VertexPositionColor(corners[4], color);
            shape.Vertices[18] = new VertexPositionColor(corners[1], color);
            shape.Vertices[19] = new VertexPositionColor(corners[5], color);
            shape.Vertices[20] = new VertexPositionColor(corners[2], color);
            shape.Vertices[21] = new VertexPositionColor(corners[6], color);
            shape.Vertices[22] = new VertexPositionColor(corners[3], color);
            shape.Vertices[23] = new VertexPositionColor(corners[7], color);

            Draw(camera);
            Clear();
        }
        private static DebugShape GetShapeForLines(int lineCount, float life)
        {
            DebugShape shape = null;

            // We go through our cached list trying to find a shape that contains
            // a large enough array to hold our desired line count. If we find such
            // a shape, we move it from our cached list to our active list and break
            // out of the loop.
            int vertCount = lineCount * 2;

            for (int i = 0; i < cachedShapes.Count; i++)
            {
                if (cachedShapes[i].Vertices.Length >= vertCount)
                {
                    shape = cachedShapes[i];
                    cachedShapes.RemoveAt(i);
                    activeShapes.Add(shape);
                    break;
                }
            }

            // If we didn't find a shape in our cache, we create a new shape and add it
            // to the active list.
            if (shape == null)
            {
                shape = new DebugShape {
                    Vertices = new VertexPositionColor[vertCount]
                };
                activeShapes.Add(shape);
            }

            // Set the line count and lifetime of the shape based on our parameters.
            shape.LineCount = lineCount;
            shape.Lifetime  = life;

            return(shape);
        }
Example #20
0
        private static DebugShape GetShapeForLines(int lineCount, float life)
        {
            DebugShape shape = null;

            // We go through our cached list trying to find a shape that contains
            // a large enough array to hold our desired line count. If we find such
            // a shape, we move it from our cached list to our active list and break
            // out of the loop.
            int vertCount = lineCount * 2;
            for (int i = 0; i < CachedShapes.Count; i++)
            {
                if (CachedShapes[i].Vertices.Length >= vertCount)
                {
                    shape = CachedShapes[i];
                    CachedShapes.RemoveAt(i);
                    ActiveShapes.Add(shape);
                    break;
                }
            }

            // If we didn't find a shape in our cache, we create a new shape and add it
            // to the active list.
            if (shape == null)
            {
                shape = new DebugShape { Vertices = new VertexPositionColor[vertCount] };
                ActiveShapes.Add(shape);
            }

            // Set the line count and lifetime of the shape based on our parameters.
            shape.LineCount = lineCount;
            shape.Lifetime = life;

            return shape;
        }
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        //[TestMethod]
        public void TestProcess_Standard()
        {
            SubmitMockMessage1WayStep smm = new SubmitMockMessage1WayStep("Mock submission test"); // TODO: Initialize to an appropriate value

            smm.DestURI    = "http://*****:*****@"C:\Temp\BizWTF\BizWTF.SubmissionTest - Enveloppe.xml";

            //WaitStep ws1 = new WaitStep("Wait until process starts");
            //ws1.Seconds = 1;

            SynchronizeProcessDebugStep sp = new SynchronizeProcessDebugStep("Test synchro : BizWTF.Sample.Processes.Processes.TestOrch1");

            sp.ProcessName           = "BizWTF.Sample.Processes.TestOrch1";
            sp.TargetContextProperty = "ServiceInstanceID";
            sp.ContextProps.Add(new ControlProperty(BTSProperties.messageType.Name.Namespace,
                                                    BTSProperties.messageType.Name.Name,
                                                    "http://BizWTF.Sample.Processes.Demo#Demo"));
            sp.XPathProps.Add(new ControlField("/*[local-name()='Demo']/*[local-name()='Field1']", "Test1"));

            ForceTrackedMessageCopyJobStep ftmc = new ForceTrackedMessageCopyJobStep("Wait until tracking job executes");

            GetProcessDebugStep gp = new GetProcessDebugStep("Orchestration query : BizWTF.Sample.Processes.Processes.TestOrch1");

            gp.ProcessName           = sp.ProcessName;
            gp.SourceContextProperty = "ServiceInstanceID";
            gp.TargetContextProperty = "OrchestrationInstanceInfo";
            gp.ContextProps.Add(new ControlProperty(BTSProperties.messageType.Name.Namespace,
                                                    BTSProperties.messageType.Name.Name,
                                                    "http://BizWTF.Sample.Processes.Demo#Demo"));
            gp.XPathProps.Add(new ControlField("/*[local-name()='Demo']/*[local-name()='Field1']", "Test1"));

            TestProcessDebugStep tp = new TestProcessDebugStep("Orchestration test : BizWTF.Sample.Processes.Processes.TestOrch1");

            tp.SourceContextProperty = "OrchestrationInstanceInfo";
            DebugTrace expectedTrace = new DebugTrace();
            DebugShape shape         = new DebugShape();

            shape.shapeType = ShapeTypes.ReceiveShape;
            shape.shapeText = "Rcv input msg";
            shape.ShapeID   = new Guid("5386ed66-aca3-4f68-af0b-d5c9f042a7f6");
            expectedTrace.TraceDetails.Add(shape);
            shape           = new DebugShape();
            shape.shapeType = ShapeTypes.DelayShape;
            shape.shapeText = "Delay 10s";
            shape.ShapeID   = new Guid("5e08ebcc-ac83-4b52-a48f-d4f94b723c9e");
            expectedTrace.TraceDetails.Add(shape);
            shape           = new DebugShape();
            shape.shapeType = ShapeTypes.SendShape;
            shape.shapeText = "Send output msg";
            shape.ShapeID   = new Guid("345b65b4-a222-4703-b55a-946bd4550d11");
            expectedTrace.TraceDetails.Add(shape);
            tp.Scenario = expectedTrace;


            TimeLine            tl = new TimeLine();
            List <TimeLineStep> ts = new List <TimeLineStep>();

            ts.Add(new TimeLineStep(smm));
            //ts.Add(new TimeLineStep(ws1));
            ts.Add(new TimeLineStep(sp));
            ts.Add(new TimeLineStep(ftmc));
            ts.Add(new TimeLineStep(gp));
            ts.Add(new TimeLineStep(tp));
            tl.Steps = ts;

            tl.ExportTimeLine(@"C:\Projects\BizWTF\BizWTF.Testing.Sample\Resources\TimeLine1.xml");

            tl.Execute();
        }
 private static int CachedShapesSort(DebugShape s1, DebugShape s2)
 {
     return(s1.Vertices.Length.CompareTo(s2.Vertices.Length));
 }
        public void Draw(Camera _camera)
        {
            if (_camera != null)
            {
                effect.View       = _camera.View;
                effect.Projection = _camera.Projection;

                int vertexCount = 0;
                foreach (var shape in activeShapes)
                {
                    vertexCount += shape.LineCount * 2;
                }

                if (vertexCount > 0)
                {
                    if (verts.Length < vertexCount)
                    {
                        verts = new VertexPositionColor[vertexCount * 2];
                    }

                    int lineCount = 0;
                    int vertIndex = 0;
                    foreach (DebugShape shape in activeShapes)
                    {
                        lineCount += shape.LineCount;
                        int shapeVerts = shape.LineCount * 2;
                        for (int i = 0; i < shapeVerts; i++)
                        {
                            verts[vertIndex++] = shape.Vertices[i];
                        }
                    }

                    effect.CurrentTechnique.Passes[0].Apply();

                    int vertexOffset = 0;
                    while (lineCount > 0)
                    {
                        int linesToDraw = Math.Min(lineCount, 65535);

                        GameUtilities.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

                        GameUtilities.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, verts, vertexOffset, linesToDraw);

                        vertexOffset += linesToDraw * 2;

                        lineCount -= linesToDraw;
                    }
                }


                bool resort = false;
                for (int i = activeShapes.Count - 1; i >= 0; i--)
                {
                    DebugShape s = activeShapes[i];

                    if (s.Lifetime <= 0)
                    {
                        cachedShapes.Add(s);
                        activeShapes.RemoveAt(i);
                        resort = true;
                    }
                }

                if (resort)
                {
                    cachedShapes.Sort(CachedShapesSort);
                }
            }
        }
        private static DebugShape GetShapeForLines(int lineCount, float life)
        {
            DebugShape shape = null;

            int vertCount = lineCount * 2;

            if (shape == null)
            {
                shape = new DebugShape { Vertices = new VertexPositionColor[vertCount] };
                activeShapes.Add(shape);
            }

            shape.LineCount = lineCount;
            shape.Lifetime = life;

            return shape;
        }
        /// <summary>
        /// Draws the shapes that were added to the renderer and are still alive.
        /// </summary>
        /// <param name="gameTime">The current game timestamp.</param>
        internal static void Draw(float elapsedTime)
        {
            // Update our effect with the matrices.
            effect.View       = State.ViewMatrix;
            effect.Projection = State.ProjectionMatrix;

            // Calculate the total number of vertices we're going to be rendering.
            int vertexCount = 0;

            foreach (var shape in activeShapes)
            {
                vertexCount += shape.LineCount * 2;
            }

            // If we have some vertices to draw
            if (vertexCount > 0)
            {
                // Make sure our array is large enough
                if (verts.Length < vertexCount)
                {
                    // If we have to resize, we make our array twice as large as necessary so
                    // we hopefully won't have to resize it for a while.
                    verts = new VertexPositionColor[vertexCount * 2];
                }

                // Now go through the shapes again to move the vertices to our array and
                // add up the number of lines to draw.
                int lineCount = 0;
                int vertIndex = 0;
                foreach (DebugShape shape in activeShapes)
                {
                    lineCount += shape.LineCount;
                    int shapeVerts = shape.LineCount * 2;
                    for (int i = 0; i < shapeVerts; i++)
                    {
                        verts[vertIndex++] = shape.Vertices[i];
                    }
                }

                // Start our effect to begin rendering.
                effect.CurrentTechnique.Passes[0].Apply();

                // We draw in a loop because the Reach profile only supports 65,535 primitives. While it's
                // not incredibly likely, if a game tries to render more than 65,535 lines we don't want to
                // crash. We handle this by doing a loop and drawing as many lines as we can at a time, capped
                // at our limit. We then move ahead in our vertex array and draw the next set of lines.
                int vertexOffset = 0;
                while (lineCount > 0)
                {
                    // Figure out how many lines we're going to draw
                    int linesToDraw = Math.Min(lineCount, 65535);

                    // Draw the lines
                    State.Device.DrawUserPrimitives(PrimitiveType.LineList, verts, vertexOffset, linesToDraw);

                    // Move our vertex offset ahead based on the lines we drew
                    vertexOffset += linesToDraw * 2;

                    // Remove these lines from our total line count
                    lineCount -= linesToDraw;
                }
            }

            // Go through our active shapes and retire any shapes that have expired to the
            // cache list.
            bool resort = false;

            for (int i = activeShapes.Count - 1; i >= 0; i--)
            {
                DebugShape s = activeShapes[i];
                s.Lifetime -= elapsedTime;
                if (s.Lifetime <= 0)
                {
                    cachedShapes.Add(s);
                    activeShapes.RemoveAt(i);
                    resort = true;
                }
            }

            // If we move any shapes around, we need to resort the cached list
            // to ensure that the smallest shapes are first in the list.
            if (resort)
            {
                cachedShapes.Sort(CachedShapesSort);
            }
        }
Example #26
0
 private static int CachedShapesSort(DebugShape s1, DebugShape s2)
 {
     return s1.Vertices.Length.CompareTo(s2.Vertices.Length);
 }