示例#1
0
void Bullet::shutdown()
{
    // Delete any remaining joints
    while (!joints_.empty())
        deleteJoint(joints_[0]);

    // Delete all bodies
    while (!bodies_.empty())
        deleteBody(bodies_[0]);

    // Delete all body templates
    while (!bodyTemplates_.empty())
        deleteBodyTemplate(bodyTemplates_[0]);

    delete dynamicsWorld_;
    dynamicsWorld_ = nullptr;

    delete solver_;
    solver_ = nullptr;

    delete dispatcher_;
    dispatcher_ = nullptr;

    delete collisionConfiguration_;
    collisionConfiguration_ = nullptr;

    delete broadphase_;
    broadphase_ = nullptr;

    delete ghostPairCallback_;
    ghostPairCallback_ = nullptr;
}
DrawingWindow::DrawingWindow(QVector<QPointF> *customRulePoints, QWidget *parent) : QGraphicsView(parent)
{
    //Connect main window with this one by custome rule points vector
    this->customRulePoints = customRulePoints;

    //Create drawing scene
    drawingScene = new QGraphicsScene;
    drawingScene->setSceneRect(0,0,1000,1000);
    setScene(drawingScene);

    //Configure button that create new joint of custom rule
    createJointButton = new QPushButton("New joint", this);
    connect(createJointButton,SIGNAL(clicked()),
            this,SLOT(createJoint()));

    //Configure button that delete last created joint of custom rule
    deleteJointButton = new QPushButton("Delete joint", this);
    connect(deleteJointButton,SIGNAL(clicked()),
            this,SLOT(deleteJoint()));

    //Configure button that accepts and save custom rule
    acceptCustomRule = new QPushButton("Accept", this);
    connect(acceptCustomRule,SIGNAL(clicked()),
            this,SLOT(acceptRule()));

    //Configure button that cancel and restore previous custom rule
    cancelCustomRule = new QPushButton("Cancel", this);
    connect(cancelCustomRule,SIGNAL(clicked()),
            this,SLOT(cancelRule()));

    //Place all buttons in one widget with vertical layout
    drawingSceneWidget = new QWidget;
    drawingSceneWidget->resize(200, 200);
    drawingSceneWidget->setLayout(&drawingSceneLayout);
    drawingSceneLayout.addWidget(createJointButton);
    drawingSceneLayout.addWidget(deleteJointButton);
    drawingSceneLayout.addWidget(acceptCustomRule);
    drawingSceneLayout.addWidget(cancelCustomRule);
    drawingScene->addWidget(drawingSceneWidget);

    //Make scene dynamically redraw
    connect(drawingScene,SIGNAL(changed(QList<QRectF>)),
        this,SLOT(redraw()));

    //Draw line showing custom rule
    customRule = new QGraphicsPathItem();
    customRule->setPath(createPath(joints));
    drawingScene->addItem(customRule);

    //Make it draws smooth and resize
    setRenderHint(QPainter::Antialiasing);
    resize(1000,1000);
}
示例#3
0
void CSkeleton::deleteJoint(Joint_handle hJoint, bool deleteChildren/* = true*/)
{
	detachJoint(hJoint);
	if(deleteChildren && children[hJoint].size() > 0)
	{
		Joint_handle_iterator jh_it, jh_end = children[hJoint].end();
		for(jh_it = children[hJoint].begin(); jh_it != jh_end; ++jh_it)
			deleteJoint(*jh_it, true);
	}
	else
	{
		joints.erase(joints.begin() + hJoint);
		globals.erase(globals.begin() + hJoint);
		children.erase(children.begin() + hJoint);
		parents.erase(parents.begin() + hJoint);
	}
}