public void drawTree(DebugDraw argDraw)
 {
     m_tree.drawTree(argDraw);
 }
Example #2
0
        public World(Vec2 gravity, IWorldPool pool, BroadPhase broadPhase)
        {
            this.pool = pool;
            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(gravity);

            m_flags = CLEAR_FORCES;

            m_inv_dt0 = 0f;

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

            m_particleSystem = new ParticleSystem(this);

            for (int i = 0; i < contactStacks.Length; i++)
            {
                contactStacks[i] = new ContactRegister[Enum.GetValues(typeof (ShapeType)).Length];
            }

            initializeRegisters();
        }
Example #3
0
 /**
    * Register a routine for debug drawing. The debug draw functions are called inside with
    * World.DrawDebugData method. The debug draw object is owned by you and must remain in scope.
    *
    * @param debugDraw
    */
 public void setDebugDraw(DebugDraw debugDraw)
 {
     m_debugDraw = debugDraw;
 }
Example #4
0
        public void drawTree(DebugDraw argDraw, DynamicTreeNode node, int spot, int height)
        {
            node.aabb.getVertices(drawVecs);

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

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

            if (node.child1 != null)
            {
                drawTree(argDraw, node.child1, spot + 1, height);
            }
            if (node.child2 != null)
            {
                drawTree(argDraw, node.child2, spot + 1, height);
            }
        }
Example #5
0
 public void drawTree(DebugDraw argDraw)
 {
     if (m_root == null)
     {
         return;
     }
     int height = computeHeight();
     drawTree(argDraw, m_root, 0, height);
 }
        public void drawTree(DebugDraw argDraw, int node, int spot, int height)
        {
            AABB a = m_aabb[node];
            a.getVertices(drawVecs);

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

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

            int c1 = m_child1[node];
            int c2 = m_child2[node];
            if (c1 != NULL_NODE)
            {
                drawTree(argDraw, c1, spot + 1, height);
            }
            if (c2 != NULL_NODE)
            {
                drawTree(argDraw, c2, spot + 1, height);
            }
        }