[Interest] How to load 3D scene with QSceneLoader

dns.botond at gmail.com dns.botond at gmail.com
Fri Sep 14 05:15:53 CEST 2018


Hi,

This was it. I thought QUrl would default to local path. Now I seem to
remember to have made this assumption in the past as well and then be
suprised. Is should start to learn. :)

Thanks for your help.

Botond

On Thu, 2018-09-13 at 21:55 +0100, Mike Krus wrote:
> Hi
> 
> that doesn’t look like a valid url you are loading there…
> try QUrl(“file:///home/botond/Desktop/castle_on_hill.dae”) ?
> 
> Mike
> 
> > On 13 Sep 2018, at 18:24, Botond D <dns.botond at gmail.com> wrote:
> > 
> > Hi,
> > 
> > I've been struggling to load a 3D scene from a Collada (DAE) file.
> > I've been experimenting with the following piece of code:
> > 
> > Qt3DCore::QEntity *importScene()
> > {
> >     // Root entity
> >     Qt3DCore::QEntity *rootEntity = new Qt3DCore::QEntity;
> > 
> >     auto importedScene = new Qt3DCore::QEntity(rootEntity);
> >     auto loader = new Qt3DRender::QSceneLoader;
> >     loader-
> > >setSource(QUrl("/home/botond/Desktop/castle_on_hill.dae"));
> >     QObject::connect(loader,
> > &Qt3DRender::QSceneLoader::statusChanged, []
> > (Qt3DRender::QSceneLoader::Status s) {
> >         std::cout << "status: " << s << std::endl;
> >     });
> > 
> >     Qt3DCore::QTransform *transform = new Qt3DCore::QTransform;
> >     transform->setScale3D(QVector3D(1.5, 1, 0.5));
> > 
> >     importedScene->addComponent(loader);
> >     importedScene->addComponent(transform);
> > 
> >     return rootEntity;
> > }
> > 
> > However nothing is rendered and no status change is detected. What
> > am I doing wrong? What is the intended usage of `QSceneLoader`?
> > 
> > Thanks,
> > Botond
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> 
> --
> Mike Krus | mike.krus at kdab.com | Senior Software Engineer
> KDAB (UK) Ltd., a KDAB Group company
> Tel: UK Office +44 1625 809908   Mobile +44 7833 491941
> KDAB - The Qt Experts, C++, OpenGL Experts
> 





More information about the Interest mailing list