Implement this abstract class to allow JBox2d to automatically draw your physics for debugging purposes. Not intended to replace your own custom rendering routines!
コード例 #1
0
ファイル: BroadPhase.cs プロジェクト: gerich-home/box2dnet
 public void DrawTree(DebugDraw argDraw)
 {
     m_tree.DrawTree(argDraw);
 }
コード例 #2
0
ファイル: World.cs プロジェクト: thdtjsdn/box2dnet
        /// <summary>
        /// Construct a world object.
        /// </summary>
        /// <param name="gravity">the world gravity vector.</param>
        /// <param name="doSleep">improve performance by not simulating inactive bodies.</param>
        public World(Vec2 gravity, IWorldPool argPool)
        {
            contactStacks = new ContactRegister[ShapeTypesCount][];
            for (int i = 0; i < ShapeTypesCount; i++)
            {
                contactStacks[i] = new ContactRegister[ShapeTypesCount];
            }

            pool = argPool;
            m_destructionListener = null;
            m_debugDraw = null;

            m_bodyList = null;
            m_jointList = null;

            m_bodyCount = 0;
            m_jointCount = 0;

            m_warmStarting = true;
            m_continuousPhysics = true;
            m_subStepping = false;
            m_stepComplete = true;

            m_allowSleep = true;
            m_gravity.set_Renamed(gravity);

            m_flags = CLEAR_FORCES;

            m_inv_dt0 = 0f;

            m_contactManager = new ContactManager(this);
            m_profile = new Profile();

            initializeRegisters();
        }
コード例 #3
0
ファイル: DynamicTree.cs プロジェクト: thdtjsdn/box2dnet
        public virtual void drawTree(DebugDraw argDraw, int nodeId, int spot, int height)
        {
            TreeNode node = m_nodes[nodeId];
            node.aabb.getVertices(drawVecs);

            color.set_Renamed(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
            argDraw.drawPolygon(drawVecs, 4, color);

            argDraw.ViewportTranform.getWorldToScreen(node.aabb.upperBound, textVec);
            argDraw.drawString(textVec.x, textVec.y, nodeId + "-" + (spot + 1) + "/" + height, color);

            if (node.child1 != TreeNode.NULL_NODE)
            {
                drawTree(argDraw, node.child1, spot + 1, height);
            }
            if (node.child2 != TreeNode.NULL_NODE)
            {
                drawTree(argDraw, node.child2, spot + 1, height);
            }
        }
コード例 #4
0
ファイル: DynamicTree.cs プロジェクト: thdtjsdn/box2dnet
 public virtual void drawTree(DebugDraw argDraw)
 {
     if (m_root == TreeNode.NULL_NODE)
     {
         return;
     }
     int height = computeHeight();
     drawTree(argDraw, m_root, 0, height);
 }
コード例 #5
0
ファイル: DynamicTree.cs プロジェクト: gerich-home/box2dnet
        public void DrawTree(DebugDraw argDraw, int nodeId, int spot, int height)
        {
            TreeNode node = m_nodes[nodeId];
            node.AABB.GetVertices(drawVecs);

            color.Set(1, (height - spot) * 1f / height, (height - spot) * 1f / height);
            argDraw.DrawPolygon(drawVecs, 4, color);

            argDraw.ViewportTranform.GetWorldToScreen(node.AABB.UpperBound, textVec);
            argDraw.DrawString(textVec.X, textVec.Y, nodeId + "-" + (spot + 1) + "/" + height, color);

            if (node.Child1 != TreeNode.NULL_NODE)
            {
                DrawTree(argDraw, node.Child1, spot + 1, height);
            }
            if (node.Child2 != TreeNode.NULL_NODE)
            {
                DrawTree(argDraw, node.Child2, spot + 1, height);
            }
        }
コード例 #6
0
ファイル: BroadPhase.cs プロジェクト: thdtjsdn/box2dnet
 public virtual void drawTree(DebugDraw argDraw)
 {
     m_tree.drawTree(argDraw);
 }