Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get bounding box QSceneLoader ?
Qt 6.11 is out! See what's new in the release blog

Get bounding box QSceneLoader ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 216 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nicholas_yueN Offline
    nicholas_yueN Offline
    nicholas_yue
    wrote on last edited by
    #1

    After loading a scene, how do we determine the bounding box of all the geometry in the loaded scene ?

        // Scene loader
        Qt3DCore::QEntity *sceneLoaderEntity = new Qt3DCore::QEntity(sceneRoot);
        Qt3DRender::QSceneLoader *sceneLoader = new Qt3DRender::QSceneLoader(sceneLoaderEntity);
        SceneWalker sceneWalker(sceneLoader);
        QObject::connect(sceneLoader, &Qt3DRender::QSceneLoader::statusChanged, &sceneWalker, &SceneWalker::onStatusChanged);
        sceneLoaderEntity->addComponent(sceneLoader);
    
        QStringList args = QCoreApplication::arguments();
        QUrl sourceFileName;
        if (args.count() <= 1) {
            QWidget *container = new QWidget();
            QFileDialog dialog;
            dialog.setFileMode(QFileDialog::AnyFile);
            sourceFileName = dialog.getOpenFileUrl(container, QStringLiteral("Open a scene file"));
        } else {
            sourceFileName = QUrl::fromLocalFile(args[1]);
        }
    
        if (sourceFileName.isEmpty())
            return 0;
    
        sceneLoader->setSource(sourceFileName);
    
        view.setRootEntity(sceneRoot);
        view.show();
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved