osg qt fbx

 

void TeslaManage::loadModelFile(QString &filename)
{
    file_node = osgDB::readNodeFile(std::string((const char *)filename.toLocal8Bit()));
    root->addChild(file_node);
    root->addChild(createLight());
    
    viewer->setSceneData(root);
    viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
    //_viewer->setCameraManipulator(new osgGA::TrackballManipulator);
    viewer->addEventHandler(new osgViewer::WindowSizeHandler());

    //添加操作器
    viewer->setCameraManipulator(new osgGA::TrackballManipulator());

    GraphicsWindowQt* gcQT = dynamic_cast<GraphicsWindowQt*>(graphicsContext);
    if (gcQT) {
        pWgt = gcQT->getGLWidget();
        //this->tesla_manage_ui.listWidget.addItem(pWgt);

        //this->tesla_manage_ui.listWidget->addItem(pWgt);
        //this->tesla_manage_ui.openGLWidget = gcQT->getGLWidget();
        //this->tesla_manage_ui.widget = gcQT->getGLWidget();
        //ui.horizontalLayout->addWidget(pWgt);
        //this->tesla_manage_ui.verticalLayout->addWidget(pWgt);
        this->tesla_manage_ui.horizontalLayout_3->addWidget(pWgt);
    }

    connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeUpdate()));
    _timer->start(5);
}

 

 

posted @ 2019-07-13 12:25  西北逍遥  阅读(485)  评论(0编辑  收藏  举报