• 5429阅读
  • 2回复

GLC_lib载入3DXML的问题(已解决) [复制链接]

上一主题 下一主题
离线jackyrain
 

只看楼主 倒序阅读 楼主  发表于: 2011-03-27
在GLC_lib的第9个例子中,载入dar或obj文件都没问题,为什么载入3dxml文件就报错呢?
载入3dxml文件时报错:
"---------------------------------------------------------------------"
"GLC_3dxmlToWorld::setStreamReaderToFile File :/\CATRepImage.3dxml not found"
"---------------------------------------------------------------------"
"GLC_3dxmlToWorld::setStreamReaderToFile File :/\CATMaterialRef.3dxml not found"
"---------------------------------------------------------------------"
"GLC_3dxmlToWorld::loadProductStructure Element ProctStructure Not found in :a.3dxml"

大家帮帮忙,谢谢!
[ 此帖被jackyrain在2011-03-28 09:54重新编辑 ]
离线jackyrain

只看该作者 1楼 发表于: 2011-03-27
源码如下:
void GLWidget::createScene()
{
    // Load the 3DXML
//        QFile democles(":Democles.dae");
//        QFile democles(":tree.obj");
        QFile democles(":a.3dxml");

        m_World= GLC_Factory::instance()->createWorldFromFile(democles);

        m_ShuttleBoundingBox= m_World.boundingBox();

        GLC_StructOccurence* pRoot= m_World.rootOccurence();

        QImage texture(QString(":particle.png"));
        GLC_3DRep pointSprite;
        const float min= -20000.0f;
        const float max= 20000.0f;
        for (int i= 0; i < 300; ++i)
        {
                QColor currentColor;
                currentColor.setRedF(getRandomMinMax(0.4, 1.0));
                currentColor.setGreenF(getRandomMinMax(0.4, 0.7));
                currentColor.setBlueF(getRandomMinMax(0.4, 1.0));

                GLC_Material* pMaterial= GLC_Factory::instance()->createMaterial(texture);
                pMaterial->setDiffuseColor(currentColor);

                pointSprite= GLC_Factory::instance()->createPointSprite(getRandomMinMax(5.0f, 10.0f), pMaterial);

                GLC_StructReference* pStructReference= new GLC_StructReference(new GLC_3DRep(pointSprite));
                GLC_StructInstance* pStructInstance= new GLC_StructInstance(pStructReference);

                GLC_Point3d position(getRandomMinMax(min, max), getRandomMinMax(min, max), getRandomMinMax(min, max));
                const double norm= position.length();
                if ((norm > max) || (norm < (max / 2))) position.setLength(max);
                pStructInstance->translate(position);

                pRoot->addChild(pStructInstance);
        }

}

载入3DXML和载入dae/obj文件是不是有什么不同啊?我是新手,请大家帮帮忙,先谢谢了。
离线jackyrain

只看该作者 2楼 发表于: 2011-03-28
问了laumaya了,只要从路径访问3dxml就可以了。3dxml不能从resource访问
快速回复
限100 字节
 
上一个 下一个