From 3be1d4fd1e39d67ff086504c9d16a37a38296005 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 4 Jun 2015 12:54:03 +0200 Subject: Examples: added license files gltf/LICENSE.md is from 4fb289da, https://github.com/KhronosGroup/glTF/blob/master/LICENSE.md (excluding third-party licenses - only glTF graphical assets are used in the examples). Task-number: QTBUG-45612 Change-Id: I66c7d7d3ef2ae8ad10feb74a1e7be41d6ac281ad Reviewed-by: Sami Makkonen Reviewed-by: Sean Harmer --- examples/qt3d/exampleresources/assets/LICENSE | 5 ++++ .../qt3d/exampleresources/assets/gltf/LICENSE.md | 33 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 examples/qt3d/exampleresources/assets/LICENSE create mode 100644 examples/qt3d/exampleresources/assets/gltf/LICENSE.md (limited to 'examples/qt3d') diff --git a/examples/qt3d/exampleresources/assets/LICENSE b/examples/qt3d/exampleresources/assets/LICENSE new file mode 100644 index 000000000..8d2cfc6c9 --- /dev/null +++ b/examples/qt3d/exampleresources/assets/LICENSE @@ -0,0 +1,5 @@ +cubemaps: See cubemaps/miramar/README.TXT + +gltf: See gltf/LICENSE.md + +textures: See textures/pattern_09/readme.txt diff --git a/examples/qt3d/exampleresources/assets/gltf/LICENSE.md b/examples/qt3d/exampleresources/assets/gltf/LICENSE.md new file mode 100644 index 000000000..25e13f1d6 --- /dev/null +++ b/examples/qt3d/exampleresources/assets/gltf/LICENSE.md @@ -0,0 +1,33 @@ +This license is for the example glTF code, not the [specification](specification/README.md) and [schema](specification). + +Original work Copyright (c) 2012, Motorola Mobility, Inc. +All Rights Reserved. +BSD License. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + - Neither the name of Motorola Mobility nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +Additional contributions copyright their respective contributors (also BSD License): + * Fabrice Robinet + * Analytical Graphics, Inc. -- cgit v1.2.3 From 0eec20fc1e5ee4822bd8560eb6c3c551879528ea Mon Sep 17 00:00:00 2001 From: Mika Salmela Date: Wed, 10 Jun 2015 13:00:38 +0300 Subject: Reshape torus-cpp example to be basicshapes-cpp Leave the cylinder-cpp example to show minimal code for setting up a basic element. Reshape torus-cpp to show several shapes available. Change-Id: Ic9dd7cb54258b5eb442ee0492ef4fc2e4b30f836 Reviewed-by: Sean Harmer --- examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro | 14 ++ .../qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc | 32 ++++ examples/qt3d/basicshapes-cpp/main.cpp | 187 +++++++++++++++++++++ examples/qt3d/basicshapes-cpp/scenemodifier.cpp | 178 ++++++++++++++++++++ examples/qt3d/basicshapes-cpp/scenemodifier.h | 78 +++++++++ examples/qt3d/qt3d.pro | 4 +- examples/qt3d/torus-cpp/doc/src/torus-cpp.qdoc | 32 ---- examples/qt3d/torus-cpp/main.cpp | 134 --------------- examples/qt3d/torus-cpp/torus-cpp.pro | 9 - 9 files changed, 491 insertions(+), 177 deletions(-) create mode 100644 examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro create mode 100644 examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc create mode 100644 examples/qt3d/basicshapes-cpp/main.cpp create mode 100644 examples/qt3d/basicshapes-cpp/scenemodifier.cpp create mode 100644 examples/qt3d/basicshapes-cpp/scenemodifier.h delete mode 100644 examples/qt3d/torus-cpp/doc/src/torus-cpp.qdoc delete mode 100644 examples/qt3d/torus-cpp/main.cpp delete mode 100644 examples/qt3d/torus-cpp/torus-cpp.pro (limited to 'examples/qt3d') diff --git a/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro b/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro new file mode 100644 index 000000000..546715fca --- /dev/null +++ b/examples/qt3d/basicshapes-cpp/basicshapes-cpp.pro @@ -0,0 +1,14 @@ +!include( ../examples.pri ) { + error( "Couldn't find the examples.pri file!" ) +} + +QT += 3dcore 3drenderer 3dinput +QT += widgets + +SOURCES += main.cpp \ + scenemodifier.cpp + +HEADERS += \ + scenemodifier.h + + diff --git a/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc b/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc new file mode 100644 index 000000000..f408bc43b --- /dev/null +++ b/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc @@ -0,0 +1,32 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example basicshapes-cpp + \title Qt3D: Basic Shapes C++ Example + \ingroup qt3d-examples-cpp +*/ diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp new file mode 100644 index 000000000..3aa42f7f8 --- /dev/null +++ b/examples/qt3d/basicshapes-cpp/main.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "scenemodifier.h" + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + Qt3D::Window *view = new Qt3D::Window(); + QWidget *container = QWidget::createWindowContainer(view); + + QSize screenSize = view->screen()->size(); + container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.5)); + container->setMaximumSize(screenSize); + container->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + container->setFocusPolicy(Qt::StrongFocus); + + QWidget *widget = new QWidget; + QHBoxLayout *hLayout = new QHBoxLayout(widget); + QVBoxLayout *vLayout = new QVBoxLayout(); + vLayout->setAlignment(Qt::AlignTop); + hLayout->addWidget(container, 1); + hLayout->addLayout(vLayout); + + widget->setWindowTitle(QStringLiteral("Basic shapes")); + + Qt3D::QAspectEngine engine; + engine.registerAspect(new Qt3D::QRenderAspect()); + Qt3D::QInputAspect *input = new Qt3D::QInputAspect; + engine.registerAspect(input); + engine.initialize(); + QVariantMap data; + data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast(view))); + data.insert(QStringLiteral("eventSource"), QVariant::fromValue(view)); + engine.setData(data); + + // Root entity + Qt3D::QEntity *rootEntity = new Qt3D::QEntity(); + + // Camera + Qt3D::QCamera *cameraEntity = new Qt3D::QCamera(rootEntity); + cameraEntity->setObjectName(QStringLiteral("cameraEntity")); + + cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f); + cameraEntity->setPosition(QVector3D(0, 0, -20.0f)); + cameraEntity->setUpVector(QVector3D(0, 1, 0)); + cameraEntity->setViewCenter(QVector3D(0, 0, 0)); + input->setCamera(cameraEntity); + + // FrameGraph + Qt3D::QFrameGraph *frameGraph = new Qt3D::QFrameGraph(); + Qt3D::QForwardRenderer *forwardRenderer = new Qt3D::QForwardRenderer(); + + forwardRenderer->setCamera(cameraEntity); + forwardRenderer->setClearColor(QColor(QRgb(0x4d4d4f))); + frameGraph->setActiveFrameGraph(forwardRenderer); + + // Setting the FrameGraph + rootEntity->addComponent(frameGraph); + + // Scenemodifier + SceneModifier *modifier = new SceneModifier(rootEntity); + + // Set root object of the scene + engine.setRootEntity(rootEntity); + + // Create control widgets + QCommandLinkButton *info = new QCommandLinkButton(); + info->setText(QStringLiteral("Qt3D ready-made meshes")); + info->setDescription(QStringLiteral("Qt3D provides several ready-made meshes, like torus, cylinder, cube and sphere.")); + info->setIconSize(QSize(0,0)); + + QCheckBox *torusCB = new QCheckBox(widget); + torusCB->setChecked(true); + torusCB->setText(QStringLiteral("Torus")); + + QCheckBox *cylinderCB = new QCheckBox(widget); + cylinderCB->setChecked(true); + cylinderCB->setText(QStringLiteral("Cylinder")); + + QCheckBox *cuboidCB = new QCheckBox(widget); + cuboidCB->setChecked(true); + cuboidCB->setText(QStringLiteral("Cuboid")); + + QCheckBox *sphereCB = new QCheckBox(widget); + sphereCB->setChecked(true); + sphereCB->setText(QStringLiteral("Sphere")); + + vLayout->addWidget(info); + vLayout->addWidget(torusCB); + vLayout->addWidget(cylinderCB); + vLayout->addWidget(cuboidCB); + vLayout->addWidget(sphereCB); + + QObject::connect(torusCB, &QCheckBox::stateChanged, + modifier, &SceneModifier::enableTorus); + QObject::connect(cylinderCB, &QCheckBox::stateChanged, + modifier, &SceneModifier::enableCylinder); + QObject::connect(cuboidCB, &QCheckBox::stateChanged, + modifier, &SceneModifier::enableCuboid); + QObject::connect(sphereCB, &QCheckBox::stateChanged, + modifier, &SceneModifier::enableSphere); + + torusCB->setChecked(true); + cylinderCB->setChecked(true); + cuboidCB->setChecked(true); + sphereCB->setChecked(true); + + // Show window + widget->show(); + widget->resize(1280, 600); + + // Update the aspect ratio + QSize widgetSize = container->size(); + float aspectRatio = float(widgetSize.width()) / float(widgetSize.height()); + cameraEntity->lens()->setPerspectiveProjection(45.0f, aspectRatio, 0.1f, 1000.0f); + + return app.exec(); +} diff --git a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp new file mode 100644 index 000000000..030db1596 --- /dev/null +++ b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp @@ -0,0 +1,178 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "scenemodifier.h" + +#include + +SceneModifier::SceneModifier(Qt3D::QEntity *rootEntity) + : m_rootEntity(rootEntity) +{ + // Torus shape data + m_torus = new Qt3D::QTorusMesh(); + m_torus->setRadius(1.0f); + m_torus->setMinorRadius(0.4f); + m_torus->setRings(100); + m_torus->setSlices(20); + + // TorusMesh Transform + Qt3D::QScaleTransform *torusScale = new Qt3D::QScaleTransform(); + Qt3D::QTranslateTransform *torusTranslation = new Qt3D::QTranslateTransform(); + Qt3D::QRotateTransform *torusRotation = new Qt3D::QRotateTransform(); + Qt3D::QTransform *torusTransforms = new Qt3D::QTransform(); + + torusScale->setScale3D(QVector3D(2.0f, 2.0f, 2.0f)); + torusTranslation->setTranslation(QVector3D(1.7f, 1.7f, 0.0f)); + torusRotation->setAngleDeg(25.0f); + torusRotation->setAxis(QVector3D(0, 1, 0)); + + torusTransforms->addTransform(torusRotation); + torusTransforms->addTransform(torusTranslation); + torusTransforms->addTransform(torusScale); + + Qt3D::QPhongMaterial *torusMaterial = new Qt3D::QPhongMaterial(); + torusMaterial->setDiffuse(QColor(QRgb(0xbeb32b))); + + // Torus + m_torusEntity = new Qt3D::QEntity(m_rootEntity); + m_torusEntity->addComponent(m_torus); + m_torusEntity->addComponent(torusMaterial); + m_torusEntity->addComponent(torusTransforms); + + // Cylinder shape data + Qt3D::QCylinderMesh *cylinder = new Qt3D::QCylinderMesh(); + cylinder->setRadius(1); + cylinder->setLength(3); + cylinder->setRings(100); + cylinder->setSlices(20); + + // CylinderMesh Transform + Qt3D::QScaleTransform *cylinderScale = new Qt3D::QScaleTransform(); + Qt3D::QRotateTransform *cylinderRotation = new Qt3D::QRotateTransform(); + Qt3D::QTranslateTransform *cylinderTranslation = new Qt3D::QTranslateTransform(); + Qt3D::QTransform *cylinderTransforms = new Qt3D::QTransform(); + + cylinderScale->setScale3D(QVector3D(1.5f, 1.5f, 1.5f)); + cylinderTranslation->setTranslation(QVector3D(-2.6f, 2.4f, -1.5)); + cylinderRotation->setAngleDeg(45.0f); + cylinderRotation->setAxis(QVector3D(1, 0, 0)); + + cylinderTransforms->addTransform(cylinderTranslation); + cylinderTransforms->addTransform(cylinderRotation); + cylinderTransforms->addTransform(cylinderScale); + + Qt3D::QPhongMaterial *cylinderMaterial = new Qt3D::QPhongMaterial(); + cylinderMaterial->setDiffuse(QColor(QRgb(0x928327))); + + // Cylinder + m_cylinderEntity = new Qt3D::QEntity(m_rootEntity); + m_cylinderEntity->addComponent(cylinder); + m_cylinderEntity->addComponent(cylinderMaterial); + m_cylinderEntity->addComponent(cylinderTransforms); + + // Cuboid shape data + Qt3D::QCuboidMesh *cuboid = new Qt3D::QCuboidMesh(); + + // CuboidMesh Transform + Qt3D::QScaleTransform *cuboidScale = new Qt3D::QScaleTransform(); + Qt3D::QTranslateTransform *cuboidTranslation = new Qt3D::QTranslateTransform(); + Qt3D::QTransform *cuboidTransforms = new Qt3D::QTransform(); + + cuboidScale->setScale3D(QVector3D(4.0f, 4.0f, 4.0f)); + cuboidTranslation->setTranslation(QVector3D(0.9f, -0.9f, 0.0f)); + + cuboidTransforms->addTransform(cuboidTranslation); + cuboidTransforms->addTransform(cuboidScale); + + Qt3D::QPhongMaterial *cuboidMaterial = new Qt3D::QPhongMaterial(); + cuboidMaterial->setDiffuse(QColor(QRgb(0x665423))); + + //Cuboid + m_cuboidEntity = new Qt3D::QEntity(m_rootEntity); + m_cuboidEntity->addComponent(cuboid); + m_cuboidEntity->addComponent(cuboidMaterial); + m_cuboidEntity->addComponent(cuboidTransforms); + + // Sphere shape data + Qt3D::QSphereMesh *sphereMesh = new Qt3D::QSphereMesh(); + sphereMesh->setRings(20); + sphereMesh->setSlices(20); + sphereMesh->setRadius(2); + + // Sphere mesh transform + Qt3D::QScaleTransform *sphereScale = new Qt3D::QScaleTransform(); + Qt3D::QTranslateTransform *sphereTranslation = new Qt3D::QTranslateTransform(); + Qt3D::QTransform *sphereTransforms = new Qt3D::QTransform(); + + sphereScale->setScale3D(QVector3D(1.3f, 1.3f, 1.3f)); + sphereTranslation->setTranslation(QVector3D(-2.9f, -2.9f, 0.0f)); + + sphereTransforms->addTransform(sphereTranslation); + sphereTransforms->addTransform(sphereScale); + + Qt3D::QPhongMaterial *sphereMaterial = new Qt3D::QPhongMaterial(); + sphereMaterial->setDiffuse(QColor(QRgb(0xa69929))); + + // Sphere + m_sphereEntity = new Qt3D::QEntity(m_rootEntity); + m_sphereEntity->addComponent(sphereMesh); + m_sphereEntity->addComponent(sphereMaterial); + m_sphereEntity->addComponent(sphereTransforms); +} + +SceneModifier::~SceneModifier() +{ +} + +void SceneModifier::enableTorus(bool enabled) +{ + m_torusEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR); +} + +void SceneModifier::enableCylinder(bool enabled) +{ + m_cylinderEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR); +} + +void SceneModifier::enableCuboid(bool enabled) +{ + m_cuboidEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR); +} + +void SceneModifier::enableSphere(bool enabled) +{ + m_sphereEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR); +} diff --git a/examples/qt3d/basicshapes-cpp/scenemodifier.h b/examples/qt3d/basicshapes-cpp/scenemodifier.h new file mode 100644 index 000000000..ba4718401 --- /dev/null +++ b/examples/qt3d/basicshapes-cpp/scenemodifier.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SCENEMODIFIER_H +#define SCENEMODIFIER_H + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +class SceneModifier : public QObject +{ + Q_OBJECT + +public: + explicit SceneModifier(Qt3D::QEntity *rootEntity); + ~SceneModifier(); + +public slots: + void enableTorus(bool enabled); + void enableCylinder(bool enabled); + void enableCuboid(bool enabled); + void enableSphere(bool enabled); + +private: + Qt3D::QEntity *m_rootEntity; + Qt3D::QTorusMesh *m_torus; + Qt3D::QEntity *m_cylinderEntity; + Qt3D::QEntity *m_torusEntity; + Qt3D::QEntity *m_cuboidEntity; + Qt3D::QEntity *m_sphereEntity; +}; + +#endif // SCENEMODIFIER_H + diff --git a/examples/qt3d/qt3d.pro b/examples/qt3d/qt3d.pro index 5882ad38b..2894e4760 100644 --- a/examples/qt3d/qt3d.pro +++ b/examples/qt3d/qt3d.pro @@ -9,7 +9,6 @@ SUBDIRS += \ cpp_example \ multiviewport \ torus-qml \ - torus-cpp \ cylinder-qml \ cylinder-cpp \ bigmodel-qml \ @@ -34,4 +33,5 @@ SUBDIRS += \ # TODO Port the old examples to new APIs #SUBDIRS += qt3d -qtHaveModule(widgets): SUBDIRS += assimp-cpp +qtHaveModule(widgets): SUBDIRS += assimp-cpp \ + basicshapes-cpp diff --git a/examples/qt3d/torus-cpp/doc/src/torus-cpp.qdoc b/examples/qt3d/torus-cpp/doc/src/torus-cpp.qdoc deleted file mode 100644 index 76f6d9782..000000000 --- a/examples/qt3d/torus-cpp/doc/src/torus-cpp.qdoc +++ /dev/null @@ -1,32 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example torus-cpp - \title Qt3D: Torus C++ Example - \ingroup qt3d-examples-cpp -*/ diff --git a/examples/qt3d/torus-cpp/main.cpp b/examples/qt3d/torus-cpp/main.cpp deleted file mode 100644 index b2cf5b24b..000000000 --- a/examples/qt3d/torus-cpp/main.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -int main(int argc, char **argv) -{ - QGuiApplication app(argc, argv); - - Qt3D::Window view; - Qt3D::QAspectEngine engine; - engine.registerAspect(new Qt3D::QRenderAspect()); - Qt3D::QInputAspect *input = new Qt3D::QInputAspect; - engine.registerAspect(input); - engine.initialize(); - QVariantMap data; - data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast(&view))); - data.insert(QStringLiteral("eventSource"), QVariant::fromValue(&view)); - engine.setData(data); - - // Root entity - Qt3D::QEntity *rootEntity = new Qt3D::QEntity(); - - // Camera - Qt3D::QCamera *cameraEntity = new Qt3D::QCamera(rootEntity); - cameraEntity->setObjectName(QStringLiteral("cameraEntity")); - - cameraEntity->lens()->setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f); - cameraEntity->setPosition(QVector3D(0, 0, -20.0f)); - cameraEntity->setUpVector(QVector3D(0, 1, 0)); - cameraEntity->setViewCenter(QVector3D(0, 0, 0)); - input->setCamera(cameraEntity); - - // FrameGraph - Qt3D::QFrameGraph *frameGraph = new Qt3D::QFrameGraph(); - Qt3D::QForwardRenderer *forwardRenderer = new Qt3D::QForwardRenderer(); - - forwardRenderer->setCamera(cameraEntity); - forwardRenderer->setClearColor(Qt::black); - frameGraph->setActiveFrameGraph(forwardRenderer); - - // Torus shape data - Qt3D::QTorusMesh *torus = new Qt3D::QTorusMesh(); - torus->setRadius(5); - torus->setMinorRadius(1); - torus->setRings(100); - torus->setSlices(20); - - // TorusMesh Transform - Qt3D::QScaleTransform *torusScale = new Qt3D::QScaleTransform(); - Qt3D::QRotateTransform *torusRotation = new Qt3D::QRotateTransform(); - Qt3D::QTransform *torusTransforms = new Qt3D::QTransform(); - - torusScale->setScale3D(QVector3D(1.5f, 1.0f, 0.5f)); - torusRotation->setAngleDeg(45.0f); - torusRotation->setAxis(QVector3D(1, 0, 0)); - - torusTransforms->addTransform(torusScale); - torusTransforms->addTransform(torusRotation); - - // Torus - Qt3D::QEntity *torusEntity = new Qt3D::QEntity(rootEntity); - torusEntity->addComponent(torus); - torusEntity->addComponent(torusTransforms); - - // Setting the FrameGraph - rootEntity->addComponent(frameGraph); - - // Set root object of the scene - engine.setRootEntity(rootEntity); - // Show window - view.show(); - - return app.exec(); -} diff --git a/examples/qt3d/torus-cpp/torus-cpp.pro b/examples/qt3d/torus-cpp/torus-cpp.pro deleted file mode 100644 index eeefc5c22..000000000 --- a/examples/qt3d/torus-cpp/torus-cpp.pro +++ /dev/null @@ -1,9 +0,0 @@ -!include( ../examples.pri ) { - error( "Couldn't find the examples.pri file!" ) -} - -QT += 3dcore 3drenderer 3dinput - -SOURCES += main.cpp - - -- cgit v1.2.3 From b21dfb2db3b48192e05dfdca9fdb85ed4bca02f2 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 11 Jun 2015 14:55:32 +0100 Subject: Use Qt3D.Renderer rather than Render This should make the documentation and code terminology consistent throughout. We can rename the source directories at a later date if needed. Task-number: QTBUG-46622 Change-Id: I2737e54192341808f4a0270ad19ba70f6c4af589 Reviewed-by: Kai Koehne Reviewed-by: Giuseppe D'Angelo --- examples/qt3d/anaglyph-rendering/StereoCamera.qml | 2 +- examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml | 2 +- examples/qt3d/anaglyph-rendering/main.qml | 2 +- examples/qt3d/assimp/main.qml | 2 +- examples/qt3d/bigmodel-qml/MyEntity.qml | 2 +- examples/qt3d/bigmodel-qml/main.qml | 2 +- examples/qt3d/controls/Logo.qml | 2 +- examples/qt3d/cylinder-qml/main.qml | 2 +- examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml | 2 +- examples/qt3d/deferred-renderer-qml/FinalEffect.qml | 2 +- examples/qt3d/deferred-renderer-qml/GBuffer.qml | 2 +- examples/qt3d/deferred-renderer-qml/SceneEffect.qml | 2 +- examples/qt3d/deferred-renderer-qml/main.qml | 2 +- examples/qt3d/enabled-qml/main.qml | 2 +- examples/qt3d/gltf/main.qml | 2 +- examples/qt3d/keyboardinput-qml/main.qml | 2 +- examples/qt3d/loader-qml/CuboidEntity.qml | 2 +- examples/qt3d/loader-qml/SphereEntity.qml | 2 +- examples/qt3d/loader-qml/main.qml | 2 +- examples/qt3d/materials/Barrel.qml | 2 +- examples/qt3d/materials/BasicCamera.qml | 2 +- examples/qt3d/materials/Chest.qml | 2 +- examples/qt3d/materials/HousePlant.qml | 2 +- examples/qt3d/materials/PlaneEntity.qml | 2 +- examples/qt3d/materials/RenderableEntity.qml | 2 +- examples/qt3d/materials/SortedForwardRenderer.qml | 2 +- examples/qt3d/materials/TrefoilKnot.qml | 2 +- examples/qt3d/materials/main.qml | 2 +- examples/qt3d/multiviewport/main.qml | 2 +- examples/qt3d/playground-qml/AdsEffect.qml | 2 +- examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml | 2 +- examples/qt3d/playground-qml/ComplexTechnique.qml | 2 +- examples/qt3d/playground-qml/DetailView.qml | 2 +- examples/qt3d/playground-qml/MainView.qml | 2 +- examples/qt3d/playground-qml/MyForwardRenderer.qml | 2 +- examples/qt3d/playground-qml/RenderableEntity.qml | 2 +- examples/qt3d/playground-qml/main.qml | 2 +- examples/qt3d/scene3d/AnimatedEntity.qml | 2 +- examples/qt3d/shadow-map-qml/AdsEffect.qml | 2 +- examples/qt3d/shadow-map-qml/AdsMaterial.qml | 2 +- examples/qt3d/shadow-map-qml/GroundPlane.qml | 2 +- examples/qt3d/shadow-map-qml/Light.qml | 2 +- examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml | 2 +- examples/qt3d/shadow-map-qml/Toyplane.qml | 2 +- examples/qt3d/shadow-map-qml/Trefoil.qml | 2 +- examples/qt3d/shadow-map-qml/main.qml | 2 +- examples/qt3d/simple-qml/main.qml | 2 +- examples/qt3d/simple-shaders-qml/main.qml | 2 +- examples/qt3d/skybox/Skybox.qml | 2 +- examples/qt3d/skybox/main.qml | 2 +- examples/qt3d/tessellation-modes/BasicCamera.qml | 2 +- examples/qt3d/tessellation-modes/TessellatedQuad.qml | 2 +- examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml | 2 +- examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml | 2 +- examples/qt3d/tessellation-modes/main.qml | 2 +- examples/qt3d/torus-qml/main.qml | 2 +- examples/qt3d/wave/Background.qml | 2 +- examples/qt3d/wave/BackgroundEffect.qml | 2 +- examples/qt3d/wave/BasicCamera.qml | 2 +- examples/qt3d/wave/Wave.qml | 2 +- examples/qt3d/wave/WaveEffect.qml | 2 +- examples/qt3d/wave/WaveForwardRenderer.qml | 2 +- examples/qt3d/wave/WaveMaterial.qml | 2 +- examples/qt3d/wave/main.qml | 2 +- examples/qt3d/wireframe/BasicCamera.qml | 2 +- examples/qt3d/wireframe/TrefoilKnot.qml | 2 +- examples/qt3d/wireframe/WireframeEffect.qml | 2 +- examples/qt3d/wireframe/WireframeMaterial.qml | 2 +- examples/qt3d/wireframe/main.qml | 2 +- 69 files changed, 69 insertions(+), 69 deletions(-) (limited to 'examples/qt3d') diff --git a/examples/qt3d/anaglyph-rendering/StereoCamera.qml b/examples/qt3d/anaglyph-rendering/StereoCamera.qml index c91d81ddf..3098ba367 100644 --- a/examples/qt3d/anaglyph-rendering/StereoCamera.qml +++ b/examples/qt3d/anaglyph-rendering/StereoCamera.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml b/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml index 46164fc60..b958255ee 100644 --- a/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml +++ b/examples/qt3d/anaglyph-rendering/StereoFrameGraph.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Viewport { diff --git a/examples/qt3d/anaglyph-rendering/main.qml b/examples/qt3d/anaglyph-rendering/main.qml index bf1dd211c..aaa253f3c 100644 --- a/examples/qt3d/anaglyph-rendering/main.qml +++ b/examples/qt3d/anaglyph-rendering/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.4 as QQ2 Entity { diff --git a/examples/qt3d/assimp/main.qml b/examples/qt3d/assimp/main.qml index f9807491c..6ebbe8afd 100644 --- a/examples/qt3d/assimp/main.qml +++ b/examples/qt3d/assimp/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { diff --git a/examples/qt3d/bigmodel-qml/MyEntity.qml b/examples/qt3d/bigmodel-qml/MyEntity.qml index fd30c1071..8e0e819bc 100644 --- a/examples/qt3d/bigmodel-qml/MyEntity.qml +++ b/examples/qt3d/bigmodel-qml/MyEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/bigmodel-qml/main.qml b/examples/qt3d/bigmodel-qml/main.qml index 9d6a16264..704d17872 100644 --- a/examples/qt3d/bigmodel-qml/main.qml +++ b/examples/qt3d/bigmodel-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.2 as QQ2 Entity { diff --git a/examples/qt3d/controls/Logo.qml b/examples/qt3d/controls/Logo.qml index 7d85ee941..bcd7a4359 100644 --- a/examples/qt3d/controls/Logo.qml +++ b/examples/qt3d/controls/Logo.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.0 Entity { diff --git a/examples/qt3d/cylinder-qml/main.qml b/examples/qt3d/cylinder-qml/main.qml index 282826116..4c5e5e4e7 100644 --- a/examples/qt3d/cylinder-qml/main.qml +++ b/examples/qt3d/cylinder-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: sceneRoot diff --git a/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml b/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml index d95402cb9..82401fe66 100644 --- a/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml +++ b/examples/qt3d/deferred-renderer-qml/DeferredRenderer.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Viewport { rect : Qt.rect(0.0, 0.0, 1.0, 1.0) diff --git a/examples/qt3d/deferred-renderer-qml/FinalEffect.qml b/examples/qt3d/deferred-renderer-qml/FinalEffect.qml index f46e65c12..07dbdffa5 100644 --- a/examples/qt3d/deferred-renderer-qml/FinalEffect.qml +++ b/examples/qt3d/deferred-renderer-qml/FinalEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Effect { techniques : [ diff --git a/examples/qt3d/deferred-renderer-qml/GBuffer.qml b/examples/qt3d/deferred-renderer-qml/GBuffer.qml index 309cec160..94c889be1 100644 --- a/examples/qt3d/deferred-renderer-qml/GBuffer.qml +++ b/examples/qt3d/deferred-renderer-qml/GBuffer.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 RenderTarget { diff --git a/examples/qt3d/deferred-renderer-qml/SceneEffect.qml b/examples/qt3d/deferred-renderer-qml/SceneEffect.qml index e4cfdf8c5..589a4ac37 100644 --- a/examples/qt3d/deferred-renderer-qml/SceneEffect.qml +++ b/examples/qt3d/deferred-renderer-qml/SceneEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Effect { id : sceneMaterialEffect diff --git a/examples/qt3d/deferred-renderer-qml/main.qml b/examples/qt3d/deferred-renderer-qml/main.qml index d70619baa..4b9ee9a28 100644 --- a/examples/qt3d/deferred-renderer-qml/main.qml +++ b/examples/qt3d/deferred-renderer-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.0 as QQ2 Entity { diff --git a/examples/qt3d/enabled-qml/main.qml b/examples/qt3d/enabled-qml/main.qml index 031759556..a7cb5ed45 100644 --- a/examples/qt3d/enabled-qml/main.qml +++ b/examples/qt3d/enabled-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.0 as QQ2 Entity { diff --git a/examples/qt3d/gltf/main.qml b/examples/qt3d/gltf/main.qml index 3fd8ca398..acce5d7ac 100644 --- a/examples/qt3d/gltf/main.qml +++ b/examples/qt3d/gltf/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { diff --git a/examples/qt3d/keyboardinput-qml/main.qml b/examples/qt3d/keyboardinput-qml/main.qml index ef5afd077..100773280 100644 --- a/examples/qt3d/keyboardinput-qml/main.qml +++ b/examples/qt3d/keyboardinput-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import Qt3D.Input 2.0 Entity { diff --git a/examples/qt3d/loader-qml/CuboidEntity.qml b/examples/qt3d/loader-qml/CuboidEntity.qml index d05e47a57..9de96e1a3 100644 --- a/examples/qt3d/loader-qml/CuboidEntity.qml +++ b/examples/qt3d/loader-qml/CuboidEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { components: [ mesh, material, transform ] diff --git a/examples/qt3d/loader-qml/SphereEntity.qml b/examples/qt3d/loader-qml/SphereEntity.qml index fe36c1467..2825b8253 100644 --- a/examples/qt3d/loader-qml/SphereEntity.qml +++ b/examples/qt3d/loader-qml/SphereEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { components: [ mesh, material ] diff --git a/examples/qt3d/loader-qml/main.qml b/examples/qt3d/loader-qml/main.qml index fa3e8ff5a..76eb524ec 100644 --- a/examples/qt3d/loader-qml/main.qml +++ b/examples/qt3d/loader-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.2 as QQ2 Entity { diff --git a/examples/qt3d/materials/Barrel.qml b/examples/qt3d/materials/Barrel.qml index 1dcec0ca1..a79cffbc1 100644 --- a/examples/qt3d/materials/Barrel.qml +++ b/examples/qt3d/materials/Barrel.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/materials/BasicCamera.qml b/examples/qt3d/materials/BasicCamera.qml index f96132416..e8a8bd7f4 100644 --- a/examples/qt3d/materials/BasicCamera.qml +++ b/examples/qt3d/materials/BasicCamera.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Camera { id: mainCamera diff --git a/examples/qt3d/materials/Chest.qml b/examples/qt3d/materials/Chest.qml index 1acd126ff..a8ef6b3f5 100644 --- a/examples/qt3d/materials/Chest.qml +++ b/examples/qt3d/materials/Chest.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/materials/HousePlant.qml b/examples/qt3d/materials/HousePlant.qml index 353a252d2..1f2a759af 100644 --- a/examples/qt3d/materials/HousePlant.qml +++ b/examples/qt3d/materials/HousePlant.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/materials/PlaneEntity.qml b/examples/qt3d/materials/PlaneEntity.qml index 222b5a33b..6e1f1925e 100644 --- a/examples/qt3d/materials/PlaneEntity.qml +++ b/examples/qt3d/materials/PlaneEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/materials/RenderableEntity.qml b/examples/qt3d/materials/RenderableEntity.qml index 03119b713..60b62a05b 100644 --- a/examples/qt3d/materials/RenderableEntity.qml +++ b/examples/qt3d/materials/RenderableEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/materials/SortedForwardRenderer.qml b/examples/qt3d/materials/SortedForwardRenderer.qml index 0687785fb..13e79800f 100644 --- a/examples/qt3d/materials/SortedForwardRenderer.qml +++ b/examples/qt3d/materials/SortedForwardRenderer.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 TechniqueFilter { id: root diff --git a/examples/qt3d/materials/TrefoilKnot.qml b/examples/qt3d/materials/TrefoilKnot.qml index 48b334ce0..51b2409b3 100644 --- a/examples/qt3d/materials/TrefoilKnot.qml +++ b/examples/qt3d/materials/TrefoilKnot.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/materials/main.qml b/examples/qt3d/materials/main.qml index cceac110b..2a3190640 100644 --- a/examples/qt3d/materials/main.qml +++ b/examples/qt3d/materials/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { diff --git a/examples/qt3d/multiviewport/main.qml b/examples/qt3d/multiviewport/main.qml index c5ad221dd..c5606fd25 100644 --- a/examples/qt3d/multiviewport/main.qml +++ b/examples/qt3d/multiviewport/main.qml @@ -36,7 +36,7 @@ import QtQuick 2.0 import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { diff --git a/examples/qt3d/playground-qml/AdsEffect.qml b/examples/qt3d/playground-qml/AdsEffect.qml index 4bc81ca44..958d69768 100644 --- a/examples/qt3d/playground-qml/AdsEffect.qml +++ b/examples/qt3d/playground-qml/AdsEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 // For Qt.vector3d() and friends. For some reason this is provided by // QQuickValueTypeProvider in QtQuick rather than the default value diff --git a/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml b/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml index 50605baee..f376baf31 100644 --- a/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml +++ b/examples/qt3d/playground-qml/AnimatedDiffuseMaterial.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.2 as QQ2 Material { diff --git a/examples/qt3d/playground-qml/ComplexTechnique.qml b/examples/qt3d/playground-qml/ComplexTechnique.qml index 9bc3cad58..8d7395786 100644 --- a/examples/qt3d/playground-qml/ComplexTechnique.qml +++ b/examples/qt3d/playground-qml/ComplexTechnique.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Technique { annotations : [ diff --git a/examples/qt3d/playground-qml/DetailView.qml b/examples/qt3d/playground-qml/DetailView.qml index 92a2f3a1f..f0fc20d38 100644 --- a/examples/qt3d/playground-qml/DetailView.qml +++ b/examples/qt3d/playground-qml/DetailView.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { diff --git a/examples/qt3d/playground-qml/MainView.qml b/examples/qt3d/playground-qml/MainView.qml index 0f115d397..8e477f698 100644 --- a/examples/qt3d/playground-qml/MainView.qml +++ b/examples/qt3d/playground-qml/MainView.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.0 as QQ2 Entity { diff --git a/examples/qt3d/playground-qml/MyForwardRenderer.qml b/examples/qt3d/playground-qml/MyForwardRenderer.qml index b4b412e77..0c9d08c62 100644 --- a/examples/qt3d/playground-qml/MyForwardRenderer.qml +++ b/examples/qt3d/playground-qml/MyForwardRenderer.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 TechniqueFilter { id: root diff --git a/examples/qt3d/playground-qml/RenderableEntity.qml b/examples/qt3d/playground-qml/RenderableEntity.qml index 13be8f1f9..bdb1f22b9 100644 --- a/examples/qt3d/playground-qml/RenderableEntity.qml +++ b/examples/qt3d/playground-qml/RenderableEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { property Transform transform; diff --git a/examples/qt3d/playground-qml/main.qml b/examples/qt3d/playground-qml/main.qml index a5605f762..09a784955 100644 --- a/examples/qt3d/playground-qml/main.qml +++ b/examples/qt3d/playground-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import Qt3D.Input 2.0 import QtQuick 2.2 as QQ2 diff --git a/examples/qt3d/scene3d/AnimatedEntity.qml b/examples/qt3d/scene3d/AnimatedEntity.qml index 72d9787d6..180907113 100644 --- a/examples/qt3d/scene3d/AnimatedEntity.qml +++ b/examples/qt3d/scene3d/AnimatedEntity.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.0 as QQ2 diff --git a/examples/qt3d/shadow-map-qml/AdsEffect.qml b/examples/qt3d/shadow-map-qml/AdsEffect.qml index 1ddc58f3b..a54f32d13 100644 --- a/examples/qt3d/shadow-map-qml/AdsEffect.qml +++ b/examples/qt3d/shadow-map-qml/AdsEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Effect { id: root diff --git a/examples/qt3d/shadow-map-qml/AdsMaterial.qml b/examples/qt3d/shadow-map-qml/AdsMaterial.qml index 322c7b9ac..93708cbe9 100644 --- a/examples/qt3d/shadow-map-qml/AdsMaterial.qml +++ b/examples/qt3d/shadow-map-qml/AdsMaterial.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 Material { diff --git a/examples/qt3d/shadow-map-qml/GroundPlane.qml b/examples/qt3d/shadow-map-qml/GroundPlane.qml index b863da3b5..e126547b5 100644 --- a/examples/qt3d/shadow-map-qml/GroundPlane.qml +++ b/examples/qt3d/shadow-map-qml/GroundPlane.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/shadow-map-qml/Light.qml b/examples/qt3d/shadow-map-qml/Light.qml index ca03f070f..e4a87830a 100644 --- a/examples/qt3d/shadow-map-qml/Light.qml +++ b/examples/qt3d/shadow-map-qml/Light.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml index b6932a76d..84dcd1f24 100644 --- a/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml +++ b/examples/qt3d/shadow-map-qml/ShadowMapFrameGraph.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.2 as QQ2 FrameGraph { diff --git a/examples/qt3d/shadow-map-qml/Toyplane.qml b/examples/qt3d/shadow-map-qml/Toyplane.qml index 61c803469..3ac2b64ce 100644 --- a/examples/qt3d/shadow-map-qml/Toyplane.qml +++ b/examples/qt3d/shadow-map-qml/Toyplane.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { diff --git a/examples/qt3d/shadow-map-qml/Trefoil.qml b/examples/qt3d/shadow-map-qml/Trefoil.qml index 341ee6c23..9eefd425e 100644 --- a/examples/qt3d/shadow-map-qml/Trefoil.qml +++ b/examples/qt3d/shadow-map-qml/Trefoil.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { diff --git a/examples/qt3d/shadow-map-qml/main.qml b/examples/qt3d/shadow-map-qml/main.qml index 59040c39b..8bc021760 100644 --- a/examples/qt3d/shadow-map-qml/main.qml +++ b/examples/qt3d/shadow-map-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: sceneRoot diff --git a/examples/qt3d/simple-qml/main.qml b/examples/qt3d/simple-qml/main.qml index c82bafaa3..9d9038d7d 100644 --- a/examples/qt3d/simple-qml/main.qml +++ b/examples/qt3d/simple-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.2 as QQ2 Entity { diff --git a/examples/qt3d/simple-shaders-qml/main.qml b/examples/qt3d/simple-shaders-qml/main.qml index 22b6322be..89c2270e3 100644 --- a/examples/qt3d/simple-shaders-qml/main.qml +++ b/examples/qt3d/simple-shaders-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.2 as QQ2 Entity { diff --git a/examples/qt3d/skybox/Skybox.qml b/examples/qt3d/skybox/Skybox.qml index 49d269bf5..f396484bc 100644 --- a/examples/qt3d/skybox/Skybox.qml +++ b/examples/qt3d/skybox/Skybox.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { diff --git a/examples/qt3d/skybox/main.qml b/examples/qt3d/skybox/main.qml index fbb3c90d0..e84d027d6 100644 --- a/examples/qt3d/skybox/main.qml +++ b/examples/qt3d/skybox/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/tessellation-modes/BasicCamera.qml b/examples/qt3d/tessellation-modes/BasicCamera.qml index 062c84eff..385b40397 100644 --- a/examples/qt3d/tessellation-modes/BasicCamera.qml +++ b/examples/qt3d/tessellation-modes/BasicCamera.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Camera { diff --git a/examples/qt3d/tessellation-modes/TessellatedQuad.qml b/examples/qt3d/tessellation-modes/TessellatedQuad.qml index b6c3122a9..39199af10 100644 --- a/examples/qt3d/tessellation-modes/TessellatedQuad.qml +++ b/examples/qt3d/tessellation-modes/TessellatedQuad.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import Qt3D.Examples 1.0 import QtQuick 2.1 as QQ2 diff --git a/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml b/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml index 0b51fde2a..57d9a0b4d 100644 --- a/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml +++ b/examples/qt3d/tessellation-modes/TessellatedWireframeEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 Effect { diff --git a/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml b/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml index d66ad740c..c812e2295 100644 --- a/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml +++ b/examples/qt3d/tessellation-modes/TessellatedWireframeMaterial.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Material { diff --git a/examples/qt3d/tessellation-modes/main.qml b/examples/qt3d/tessellation-modes/main.qml index 425ca40de..864081cb5 100644 --- a/examples/qt3d/tessellation-modes/main.qml +++ b/examples/qt3d/tessellation-modes/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { diff --git a/examples/qt3d/torus-qml/main.qml b/examples/qt3d/torus-qml/main.qml index 05398d10b..47ad51c83 100644 --- a/examples/qt3d/torus-qml/main.qml +++ b/examples/qt3d/torus-qml/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: sceneRoot diff --git a/examples/qt3d/wave/Background.qml b/examples/qt3d/wave/Background.qml index d25edfabf..b9005c2b4 100644 --- a/examples/qt3d/wave/Background.qml +++ b/examples/qt3d/wave/Background.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { diff --git a/examples/qt3d/wave/BackgroundEffect.qml b/examples/qt3d/wave/BackgroundEffect.qml index be02664f7..ad2170d47 100644 --- a/examples/qt3d/wave/BackgroundEffect.qml +++ b/examples/qt3d/wave/BackgroundEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Effect { id: root diff --git a/examples/qt3d/wave/BasicCamera.qml b/examples/qt3d/wave/BasicCamera.qml index 740dd54ce..df21bcd5d 100644 --- a/examples/qt3d/wave/BasicCamera.qml +++ b/examples/qt3d/wave/BasicCamera.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Camera { id: mainCamera diff --git a/examples/qt3d/wave/Wave.qml b/examples/qt3d/wave/Wave.qml index 023631b9e..72badde5f 100644 --- a/examples/qt3d/wave/Wave.qml +++ b/examples/qt3d/wave/Wave.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/wave/WaveEffect.qml b/examples/qt3d/wave/WaveEffect.qml index bca3737b8..4391d71c2 100644 --- a/examples/qt3d/wave/WaveEffect.qml +++ b/examples/qt3d/wave/WaveEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Effect { id: root diff --git a/examples/qt3d/wave/WaveForwardRenderer.qml b/examples/qt3d/wave/WaveForwardRenderer.qml index 9f8031668..49e6be22b 100644 --- a/examples/qt3d/wave/WaveForwardRenderer.qml +++ b/examples/qt3d/wave/WaveForwardRenderer.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 TechniqueFilter { id: root diff --git a/examples/qt3d/wave/WaveMaterial.qml b/examples/qt3d/wave/WaveMaterial.qml index 1417b54cb..c1dda4695 100644 --- a/examples/qt3d/wave/WaveMaterial.qml +++ b/examples/qt3d/wave/WaveMaterial.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Material { id: root diff --git a/examples/qt3d/wave/main.qml b/examples/qt3d/wave/main.qml index b2e0c1bff..0836cecd1 100644 --- a/examples/qt3d/wave/main.qml +++ b/examples/qt3d/wave/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import Qt3D.Input 2.0 Entity { diff --git a/examples/qt3d/wireframe/BasicCamera.qml b/examples/qt3d/wireframe/BasicCamera.qml index 740dd54ce..df21bcd5d 100644 --- a/examples/qt3d/wireframe/BasicCamera.qml +++ b/examples/qt3d/wireframe/BasicCamera.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Camera { id: mainCamera diff --git a/examples/qt3d/wireframe/TrefoilKnot.qml b/examples/qt3d/wireframe/TrefoilKnot.qml index 7b6faf852..47a3b49ba 100644 --- a/examples/qt3d/wireframe/TrefoilKnot.qml +++ b/examples/qt3d/wireframe/TrefoilKnot.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Entity { id: root diff --git a/examples/qt3d/wireframe/WireframeEffect.qml b/examples/qt3d/wireframe/WireframeEffect.qml index c8fe3bef8..f413b2992 100644 --- a/examples/qt3d/wireframe/WireframeEffect.qml +++ b/examples/qt3d/wireframe/WireframeEffect.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Effect { id: root diff --git a/examples/qt3d/wireframe/WireframeMaterial.qml b/examples/qt3d/wireframe/WireframeMaterial.qml index 834ce657d..b8a08b29e 100644 --- a/examples/qt3d/wireframe/WireframeMaterial.qml +++ b/examples/qt3d/wireframe/WireframeMaterial.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 Material { id: root diff --git a/examples/qt3d/wireframe/main.qml b/examples/qt3d/wireframe/main.qml index 8a9506c1c..ab739b187 100644 --- a/examples/qt3d/wireframe/main.qml +++ b/examples/qt3d/wireframe/main.qml @@ -35,7 +35,7 @@ ****************************************************************************/ import Qt3D 2.0 -import Qt3D.Render 2.0 +import Qt3D.Renderer 2.0 import QtQuick 2.1 as QQ2 Entity { -- cgit v1.2.3 From 57f11fe309969665ddebafa3b770263d2d82fa93 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 11 Jun 2015 13:23:22 +0100 Subject: Move temporary window class to examples So as to avoid public header without a QPrefix. Real integration points will be added later. Also removed it from the Qt3D namespace and fixed linkage. Task-number: QTBUG-46617 Change-Id: I1bea09f45f5fdba3d658b57b86b907ab57164479 Reviewed-by: Giuseppe D'Angelo --- examples/qt3d/anaglyph-rendering/main.cpp | 4 +- examples/qt3d/assimp-cpp/main.cpp | 4 +- examples/qt3d/assimp/main.cpp | 4 +- examples/qt3d/basicshapes-cpp/main.cpp | 4 +- examples/qt3d/bigmodel-qml/main.cpp | 4 +- examples/qt3d/bigscene-cpp/main.cpp | 3 +- examples/qt3d/common/window.cpp | 77 ++++++++++++++++++++++++++++ examples/qt3d/common/window.h | 53 +++++++++++++++++++ examples/qt3d/cpp_example/main.cpp | 4 +- examples/qt3d/cylinder-cpp/main.cpp | 4 +- examples/qt3d/cylinder-qml/main.cpp | 4 +- examples/qt3d/deferred-renderer-cpp/main.cpp | 4 +- examples/qt3d/deferred-renderer-qml/main.cpp | 4 +- examples/qt3d/dynamicscene-cpp/main.cpp | 4 +- examples/qt3d/enabled-qml/main.cpp | 4 +- examples/qt3d/examples.pri | 4 ++ examples/qt3d/gltf/main.cpp | 4 +- examples/qt3d/keyboardinput-qml/main.cpp | 4 +- examples/qt3d/loader-qml/main.cpp | 4 +- examples/qt3d/materials-cpp/main.cpp | 4 +- examples/qt3d/materials/main.cpp | 4 +- examples/qt3d/multiviewport/main.cpp | 4 +- examples/qt3d/playground-qml/main.cpp | 4 +- examples/qt3d/shadow-map-qml/main.cpp | 4 +- examples/qt3d/simple-cpp/main.cpp | 4 +- examples/qt3d/simple-qml/main.cpp | 4 +- examples/qt3d/simple-shaders-qml/main.cpp | 4 +- examples/qt3d/skybox/main.cpp | 4 +- examples/qt3d/tessellation-modes/main.cpp | 4 +- examples/qt3d/torus-qml/main.cpp | 4 +- examples/qt3d/wave/main.cpp | 4 +- examples/qt3d/wireframe/main.cpp | 4 +- 32 files changed, 192 insertions(+), 57 deletions(-) create mode 100644 examples/qt3d/common/window.cpp create mode 100644 examples/qt3d/common/window.h (limited to 'examples/qt3d') diff --git a/examples/qt3d/anaglyph-rendering/main.cpp b/examples/qt3d/anaglyph-rendering/main.cpp index 4521970f0..6072269ae 100644 --- a/examples/qt3d/anaglyph-rendering/main.cpp +++ b/examples/qt3d/anaglyph-rendering/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/assimp-cpp/main.cpp b/examples/qt3d/assimp-cpp/main.cpp index 2925626cd..d068f443e 100644 --- a/examples/qt3d/assimp-cpp/main.cpp +++ b/examples/qt3d/assimp-cpp/main.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ int main(int ac, char **av) { QApplication app(ac, av); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; Qt3D::QInputAspect *inputAspect = new Qt3D::QInputAspect(); diff --git a/examples/qt3d/assimp/main.cpp b/examples/qt3d/assimp/main.cpp index d9c0ede88..d8fcbc269 100644 --- a/examples/qt3d/assimp/main.cpp +++ b/examples/qt3d/assimp/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp index 3aa42f7f8..dc2317948 100644 --- a/examples/qt3d/basicshapes-cpp/main.cpp +++ b/examples/qt3d/basicshapes-cpp/main.cpp @@ -38,7 +38,7 @@ #include -#include +#include #include #include #include @@ -74,7 +74,7 @@ int main(int argc, char **argv) { QApplication app(argc, argv); - Qt3D::Window *view = new Qt3D::Window(); + Window *view = new Window(); QWidget *container = QWidget::createWindowContainer(view); QSize screenSize = view->screen()->size(); diff --git a/examples/qt3d/bigmodel-qml/main.cpp b/examples/qt3d/bigmodel-qml/main.cpp index 6e76f1f5a..5d57b0694 100644 --- a/examples/qt3d/bigmodel-qml/main.cpp +++ b/examples/qt3d/bigmodel-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/bigscene-cpp/main.cpp b/examples/qt3d/bigscene-cpp/main.cpp index 5ab25bf5e..ec99f9bc9 100644 --- a/examples/qt3d/bigscene-cpp/main.cpp +++ b/examples/qt3d/bigscene-cpp/main.cpp @@ -35,10 +35,11 @@ ****************************************************************************/ #include +#include + #include #include #include -#include #include #include #include diff --git a/examples/qt3d/common/window.cpp b/examples/qt3d/common/window.cpp new file mode 100644 index 000000000..433942f25 --- /dev/null +++ b/examples/qt3d/common/window.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "window.h" + +#include +#include +#include + +Window::Window(QScreen *screen) + : QWindow(screen) + +{ + setSurfaceType(QSurface::OpenGLSurface); + + resize(1024, 768); + + QSurfaceFormat format; + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { + format.setVersion(4, 3); + format.setProfile(QSurfaceFormat::CoreProfile); + } + format.setDepthBufferSize( 24 ); + format.setSamples( 4 ); + setFormat(format); + create(); +} + +Window::~Window() +{ +} + +void Window::keyPressEvent( QKeyEvent* e ) +{ + switch ( e->key() ) + { + case Qt::Key_Escape: + QGuiApplication::quit(); + break; + + default: + QWindow::keyPressEvent( e ); + } +} diff --git a/examples/qt3d/common/window.h b/examples/qt3d/common/window.h new file mode 100644 index 000000000..7c6e3606e --- /dev/null +++ b/examples/qt3d/common/window.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include + +class Window : public QWindow +{ + Q_OBJECT +public: + explicit Window(QScreen *screen = 0); + ~Window(); + +protected: + virtual void keyPressEvent(QKeyEvent *e); +}; + +#endif // QT3D_WINDOW_H diff --git a/examples/qt3d/cpp_example/main.cpp b/examples/qt3d/cpp_example/main.cpp index 014e8d958..2bc079e25 100644 --- a/examples/qt3d/cpp_example/main.cpp +++ b/examples/qt3d/cpp_example/main.cpp @@ -36,7 +36,7 @@ #include -#include +#include #include #include #include @@ -71,7 +71,7 @@ int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; engine.registerAspect(new Qt3D::QRenderAspect()); Qt3D::QInputAspect *input = new Qt3D::QInputAspect; diff --git a/examples/qt3d/cylinder-cpp/main.cpp b/examples/qt3d/cylinder-cpp/main.cpp index 13a40ddfb..01e6c7cf7 100644 --- a/examples/qt3d/cylinder-cpp/main.cpp +++ b/examples/qt3d/cylinder-cpp/main.cpp @@ -36,7 +36,7 @@ #include -#include +#include #include #include #include @@ -65,7 +65,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; engine.registerAspect(new Qt3D::QRenderAspect()); Qt3D::QInputAspect *input = new Qt3D::QInputAspect; diff --git a/examples/qt3d/cylinder-qml/main.cpp b/examples/qt3d/cylinder-qml/main.cpp index 171c11f92..53a1a94b9 100644 --- a/examples/qt3d/cylinder-qml/main.cpp +++ b/examples/qt3d/cylinder-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/deferred-renderer-cpp/main.cpp b/examples/qt3d/deferred-renderer-cpp/main.cpp index 24814585f..7e6c03d58 100644 --- a/examples/qt3d/deferred-renderer-cpp/main.cpp +++ b/examples/qt3d/deferred-renderer-cpp/main.cpp @@ -35,7 +35,7 @@ ****************************************************************************/ #include -#include +#include #include @@ -67,7 +67,7 @@ int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; engine.registerAspect(new Qt3D::QRenderAspect()); Qt3D::QInputAspect *input = new Qt3D::QInputAspect; diff --git a/examples/qt3d/deferred-renderer-qml/main.cpp b/examples/qt3d/deferred-renderer-qml/main.cpp index 533bea16b..efbe03d70 100644 --- a/examples/qt3d/deferred-renderer-qml/main.cpp +++ b/examples/qt3d/deferred-renderer-qml/main.cpp @@ -35,7 +35,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/dynamicscene-cpp/main.cpp b/examples/qt3d/dynamicscene-cpp/main.cpp index 8d265ec33..4d43ba59b 100644 --- a/examples/qt3d/dynamicscene-cpp/main.cpp +++ b/examples/qt3d/dynamicscene-cpp/main.cpp @@ -36,9 +36,9 @@ #include +#include #include #include -#include #include @@ -53,7 +53,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; engine.registerAspect(new Qt3D::QRenderAspect()); Qt3D::QInputAspect *input = new Qt3D::QInputAspect; diff --git a/examples/qt3d/enabled-qml/main.cpp b/examples/qt3d/enabled-qml/main.cpp index 0b3f1023c..6152557a5 100644 --- a/examples/qt3d/enabled-qml/main.cpp +++ b/examples/qt3d/enabled-qml/main.cpp @@ -36,8 +36,8 @@ #include +#include #include -#include #include #include @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); engine.aspectEngine()->initialize(); diff --git a/examples/qt3d/examples.pri b/examples/qt3d/examples.pri index 6e2f67dcc..5f67884c0 100644 --- a/examples/qt3d/examples.pri +++ b/examples/qt3d/examples.pri @@ -1,4 +1,8 @@ TEMPLATE = app +INCLUDEPATH += $$PWD/common +SOURCES += $$PWD/common/window.cpp +HEADERS += $$PWD/common/window.h + target.path = $$[QT_INSTALL_EXAMPLES]/qt3d/$$TARGET INSTALLS += target diff --git a/examples/qt3d/gltf/main.cpp b/examples/qt3d/gltf/main.cpp index 523ee4396..1c1018404 100644 --- a/examples/qt3d/gltf/main.cpp +++ b/examples/qt3d/gltf/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/keyboardinput-qml/main.cpp b/examples/qt3d/keyboardinput-qml/main.cpp index 0238633d3..0797d355f 100644 --- a/examples/qt3d/keyboardinput-qml/main.cpp +++ b/examples/qt3d/keyboardinput-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/loader-qml/main.cpp b/examples/qt3d/loader-qml/main.cpp index e74dc8b43..45385a76c 100644 --- a/examples/qt3d/loader-qml/main.cpp +++ b/examples/qt3d/loader-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/materials-cpp/main.cpp b/examples/qt3d/materials-cpp/main.cpp index 2e5a4834b..057f4f35e 100644 --- a/examples/qt3d/materials-cpp/main.cpp +++ b/examples/qt3d/materials-cpp/main.cpp @@ -36,8 +36,8 @@ #include +#include #include -#include #include #include @@ -59,7 +59,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; engine.registerAspect(new Qt3D::QRenderAspect()); Qt3D::QInputAspect *input = new Qt3D::QInputAspect; diff --git a/examples/qt3d/materials/main.cpp b/examples/qt3d/materials/main.cpp index e27bbdaff..160831d3e 100644 --- a/examples/qt3d/materials/main.cpp +++ b/examples/qt3d/materials/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/multiviewport/main.cpp b/examples/qt3d/multiviewport/main.cpp index 666aa1434..bb64bf2c7 100644 --- a/examples/qt3d/multiviewport/main.cpp +++ b/examples/qt3d/multiviewport/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -44,7 +44,7 @@ int main(int ac, char **av) { QGuiApplication app(ac, av); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect); diff --git a/examples/qt3d/playground-qml/main.cpp b/examples/qt3d/playground-qml/main.cpp index 6ec4c6097..9b2ff6e0b 100644 --- a/examples/qt3d/playground-qml/main.cpp +++ b/examples/qt3d/playground-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/shadow-map-qml/main.cpp b/examples/qt3d/shadow-map-qml/main.cpp index 2357106c7..ac08f5381 100644 --- a/examples/qt3d/shadow-map-qml/main.cpp +++ b/examples/qt3d/shadow-map-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -47,7 +47,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; view.resize(1600, 800); diff --git a/examples/qt3d/simple-cpp/main.cpp b/examples/qt3d/simple-cpp/main.cpp index d44271543..873df84dd 100644 --- a/examples/qt3d/simple-cpp/main.cpp +++ b/examples/qt3d/simple-cpp/main.cpp @@ -36,8 +36,8 @@ #include +#include #include -#include #include #include #include @@ -63,7 +63,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::QAspectEngine engine; engine.registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/simple-qml/main.cpp b/examples/qt3d/simple-qml/main.cpp index e74dc8b43..45385a76c 100644 --- a/examples/qt3d/simple-qml/main.cpp +++ b/examples/qt3d/simple-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/simple-shaders-qml/main.cpp b/examples/qt3d/simple-shaders-qml/main.cpp index 1141958fd..7f7afd225 100644 --- a/examples/qt3d/simple-shaders-qml/main.cpp +++ b/examples/qt3d/simple-shaders-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -45,7 +45,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/skybox/main.cpp b/examples/qt3d/skybox/main.cpp index 318b5181f..c585bf5fb 100644 --- a/examples/qt3d/skybox/main.cpp +++ b/examples/qt3d/skybox/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/tessellation-modes/main.cpp b/examples/qt3d/tessellation-modes/main.cpp index df1ba87de..eee73d435 100644 --- a/examples/qt3d/tessellation-modes/main.cpp +++ b/examples/qt3d/tessellation-modes/main.cpp @@ -36,7 +36,7 @@ #include "tessellatedquadmesh.h" -#include +#include #include #include #include @@ -48,7 +48,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/torus-qml/main.cpp b/examples/qt3d/torus-qml/main.cpp index d9c0ede88..d8fcbc269 100644 --- a/examples/qt3d/torus-qml/main.cpp +++ b/examples/qt3d/torus-qml/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/wave/main.cpp b/examples/qt3d/wave/main.cpp index b30248031..bd2e79f3e 100644 --- a/examples/qt3d/wave/main.cpp +++ b/examples/qt3d/wave/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); diff --git a/examples/qt3d/wireframe/main.cpp b/examples/qt3d/wireframe/main.cpp index e869a2fb4..a92e10a23 100644 --- a/examples/qt3d/wireframe/main.cpp +++ b/examples/qt3d/wireframe/main.cpp @@ -34,7 +34,7 @@ ** ****************************************************************************/ -#include +#include #include #include #include @@ -46,7 +46,7 @@ int main(int argc, char* argv[]) { QGuiApplication app(argc, argv); - Qt3D::Window view; + Window view; Qt3D::Quick::QQmlAspectEngine engine; engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); -- cgit v1.2.3 From 5d2cbfa6535e2594fe6f9cc71d08085973b2d908 Mon Sep 17 00:00:00 2001 From: Mika Salmela Date: Tue, 16 Jun 2015 10:54:29 +0300 Subject: Documentation for basic shapes example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the documentation for the basic shapes example. Change-Id: I9a69198ddbd188ddaa7bd4ab0fae0dc2315719a9 Reviewed-by: Tomi Korpipää Reviewed-by: Sean Harmer --- .../doc/images/basicshapes-cpp-example.jpg | Bin 0 -> 65014 bytes .../qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc | 37 +++++++++++++++++++++ examples/qt3d/basicshapes-cpp/main.cpp | 7 ++-- examples/qt3d/basicshapes-cpp/scenemodifier.cpp | 11 ++++++ 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 examples/qt3d/basicshapes-cpp/doc/images/basicshapes-cpp-example.jpg (limited to 'examples/qt3d') diff --git a/examples/qt3d/basicshapes-cpp/doc/images/basicshapes-cpp-example.jpg b/examples/qt3d/basicshapes-cpp/doc/images/basicshapes-cpp-example.jpg new file mode 100644 index 000000000..cdf694427 Binary files /dev/null and b/examples/qt3d/basicshapes-cpp/doc/images/basicshapes-cpp-example.jpg differ diff --git a/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc b/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc index f408bc43b..004b06817 100644 --- a/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc +++ b/examples/qt3d/basicshapes-cpp/doc/src/basicshapes.qdoc @@ -29,4 +29,41 @@ \example basicshapes-cpp \title Qt3D: Basic Shapes C++ Example \ingroup qt3d-examples-cpp + \brief Shows four basic shapes that Qt3D offers. + + The Basic Shapes examples shows four basic shapes that Qt3D offers, a torus, + a cylinder, a cube and a sphere. The example also shows how to embed a Qt3D scene + into a widget and connect with other widgets. + + \image basicshapes-cpp-example.jpg + + As an example let's go through how to set up a torus mesh. First instantiate + the \c QTorusMesh, and then set the mesh specific parameters, that for torus are + radius, minor radius and how many rings and slices. + + \snippet basicshapes-cpp/scenemodifier.cpp 0 + + The size and position of the torus can be adjusted with transform components. + We create scale, translation and rotation components and add them into the + \c QTransform component. + + \snippet basicshapes-cpp/scenemodifier.cpp 1 + + To change the diffuse color of the mesh we create a \c QPhongMaterial and set + its diffuse color. + + \snippet basicshapes-cpp/scenemodifier.cpp 2 + + The final step is to add the torus into an entity tree, and we do that by creating + a \c QEntity with parent entity and adding the previously created mesh, material + and transform components into it. + + \snippet basicshapes-cpp/scenemodifier.cpp 3 + + You can control the visibility of the entity by defining if it has parent + or not, i.e. whether it is part of entity tree or not. + + \snippet basicshapes-cpp/scenemodifier.cpp 4 + + */ diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp index dc2317948..1e122c65e 100644 --- a/examples/qt3d/basicshapes-cpp/main.cpp +++ b/examples/qt3d/basicshapes-cpp/main.cpp @@ -76,12 +76,9 @@ int main(int argc, char **argv) QApplication app(argc, argv); Window *view = new Window(); QWidget *container = QWidget::createWindowContainer(view); - QSize screenSize = view->screen()->size(); - container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.5)); + container->setMinimumSize(QSize(200, 100)); container->setMaximumSize(screenSize); - container->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - container->setFocusPolicy(Qt::StrongFocus); QWidget *widget = new QWidget; QHBoxLayout *hLayout = new QHBoxLayout(widget); @@ -176,7 +173,7 @@ int main(int argc, char **argv) // Show window widget->show(); - widget->resize(1280, 600); + widget->resize(1200, 800); // Update the aspect ratio QSize widgetSize = container->size(); diff --git a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp index 030db1596..b5c636b0f 100644 --- a/examples/qt3d/basicshapes-cpp/scenemodifier.cpp +++ b/examples/qt3d/basicshapes-cpp/scenemodifier.cpp @@ -41,14 +41,18 @@ SceneModifier::SceneModifier(Qt3D::QEntity *rootEntity) : m_rootEntity(rootEntity) { + // Torus shape data + //! [0] m_torus = new Qt3D::QTorusMesh(); m_torus->setRadius(1.0f); m_torus->setMinorRadius(0.4f); m_torus->setRings(100); m_torus->setSlices(20); + //! [0] // TorusMesh Transform + //! [1] Qt3D::QScaleTransform *torusScale = new Qt3D::QScaleTransform(); Qt3D::QTranslateTransform *torusTranslation = new Qt3D::QTranslateTransform(); Qt3D::QRotateTransform *torusRotation = new Qt3D::QRotateTransform(); @@ -62,15 +66,20 @@ SceneModifier::SceneModifier(Qt3D::QEntity *rootEntity) torusTransforms->addTransform(torusRotation); torusTransforms->addTransform(torusTranslation); torusTransforms->addTransform(torusScale); + //! [1] + //! [2] Qt3D::QPhongMaterial *torusMaterial = new Qt3D::QPhongMaterial(); torusMaterial->setDiffuse(QColor(QRgb(0xbeb32b))); + //! [2] // Torus + //! [3] m_torusEntity = new Qt3D::QEntity(m_rootEntity); m_torusEntity->addComponent(m_torus); m_torusEntity->addComponent(torusMaterial); m_torusEntity->addComponent(torusTransforms); + //! [3] // Cylinder shape data Qt3D::QCylinderMesh *cylinder = new Qt3D::QCylinderMesh(); @@ -157,10 +166,12 @@ SceneModifier::~SceneModifier() { } +//! [4] void SceneModifier::enableTorus(bool enabled) { m_torusEntity->setParent(enabled ? m_rootEntity : Q_NULLPTR); } +//! [4] void SceneModifier::enableCylinder(bool enabled) { -- cgit v1.2.3