summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/imports.pro3
-rw-r--r--src/imports/shapes/Capsule.qml55
-rw-r--r--src/imports/shapes/Cube.qml48
-rw-r--r--src/imports/shapes/Cylinder.qml55
-rw-r--r--src/imports/shapes/Quad.qml48
-rw-r--r--src/imports/shapes/README.library_xml15
-rwxr-xr-xsrc/imports/shapes/README.plugins_types34
-rw-r--r--src/imports/shapes/Sphere.qml55
-rw-r--r--src/imports/shapes/Teapot.qml48
-rw-r--r--src/imports/shapes/capsulemesh.cpp352
-rw-r--r--src/imports/shapes/capsulemesh.h94
-rw-r--r--src/imports/shapes/capsulemesh_p.h83
-rw-r--r--src/imports/shapes/cube.h67
-rw-r--r--src/imports/shapes/cube.obj25
-rw-r--r--src/imports/shapes/cube.qdoc87
-rw-r--r--src/imports/shapes/cylindermesh.cpp348
-rw-r--r--src/imports/shapes/cylindermesh.h94
-rw-r--r--src/imports/shapes/cylindermesh_p.h85
-rw-r--r--src/imports/shapes/library.xml54
-rw-r--r--src/imports/shapes/line.cpp164
-rw-r--r--src/imports/shapes/line.h89
-rwxr-xr-xsrc/imports/shapes/plugins.qmltypes159
-rw-r--r--src/imports/shapes/point.cpp169
-rw-r--r--src/imports/shapes/point.h89
-rw-r--r--src/imports/shapes/qmldir7
-rw-r--r--src/imports/shapes/quad.obj12
-rw-r--r--src/imports/shapes/quad.qdoc87
-rw-r--r--src/imports/shapes/shapes.cpp72
-rw-r--r--src/imports/shapes/shapes.pro101
-rw-r--r--src/imports/shapes/spheremesh.cpp393
-rw-r--r--src/imports/shapes/spheremesh.h99
-rw-r--r--src/imports/shapes/spheremesh_p.h87
-rw-r--r--src/imports/shapes/teapot.bez340
-rw-r--r--src/imports/shapes/teapot.h67
-rw-r--r--src/imports/shapes/teapot.qdoc92
-rw-r--r--src/imports/threed/DefaultNavigator.qml181
-rw-r--r--src/imports/threed/README.library_xml15
-rwxr-xr-xsrc/imports/threed/README.plugins_types34
-rw-r--r--src/imports/threed/billboarditem3d.cpp170
-rw-r--r--src/imports/threed/billboarditem3d.h73
-rw-r--r--src/imports/threed/library.xml379
-rwxr-xr-xsrc/imports/threed/plugins.qmltypes499
-rw-r--r--src/imports/threed/qgraphicslookattransform.cpp517
-rw-r--r--src/imports/threed/qgraphicslookattransform.h94
-rw-r--r--src/imports/threed/qmldir1
-rw-r--r--src/imports/threed/qt3dnamespace.cpp100
-rw-r--r--src/imports/threed/qt3dnamespace.h78
-rw-r--r--src/imports/threed/scale3d.cpp74
-rw-r--r--src/imports/threed/scale3d.h80
-rw-r--r--src/imports/threed/shaderprogram.cpp979
-rw-r--r--src/imports/threed/shaderprogram.h95
-rw-r--r--src/imports/threed/shaderprogram_p.h152
-rw-r--r--src/imports/threed/skybox.cpp339
-rw-r--r--src/imports/threed/skybox.h111
-rw-r--r--src/imports/threed/threed.cpp125
-rw-r--r--src/imports/threed/threed.pro74
-rw-r--r--src/imports/threed/viewport.cpp1289
-rw-r--r--src/imports/threed/viewport.h158
58 files changed, 0 insertions, 9294 deletions
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
deleted file mode 100644
index 31886ee4..00000000
--- a/src/imports/imports.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS += threed shapes
-CONFIG += ordered
diff --git a/src/imports/shapes/Capsule.qml b/src/imports/shapes/Capsule.qml
deleted file mode 100644
index 6997e76d..00000000
--- a/src/imports/shapes/Capsule.qml
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt3D 1.0
-import Qt3D.Shapes 1.0
-
-Item3D {
- id: capsule
- property alias name: capsuleMesh.objectName
- property alias radius: capsuleMesh.radius
- property alias length: capsuleMesh.length
- property alias levelOfDetail: capsuleMesh.levelOfDetail
- mesh: CapsuleMesh {
- id: capsuleMesh
- }
-}
diff --git a/src/imports/shapes/Cube.qml b/src/imports/shapes/Cube.qml
deleted file mode 100644
index e60395a3..00000000
--- a/src/imports/shapes/Cube.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt3D 1.0
-
-Item3D {
- id: cube
- mesh: Mesh { source: "cube.obj" }
-}
diff --git a/src/imports/shapes/Cylinder.qml b/src/imports/shapes/Cylinder.qml
deleted file mode 100644
index 0323f425..00000000
--- a/src/imports/shapes/Cylinder.qml
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt3D 1.0
-import Qt3D.Shapes 1.0
-
-Item3D {
- id: cylinder
- property alias name: cylinderMesh.objectName
- property alias radius: cylinderMesh.radius
- property alias length: cylinderMesh.length
- property alias levelOfDetail: cylinderMesh.levelOfDetail
- mesh: CylinderMesh {
- id: cylinderMesh
- }
-}
diff --git a/src/imports/shapes/Quad.qml b/src/imports/shapes/Quad.qml
deleted file mode 100644
index 5c636704..00000000
--- a/src/imports/shapes/Quad.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt3D 1.0
-
-Item3D {
- id: quad
- mesh: Mesh { source: "quad.obj" }
-}
diff --git a/src/imports/shapes/README.library_xml b/src/imports/shapes/README.library_xml
deleted file mode 100644
index 2f46d66d..00000000
--- a/src/imports/shapes/README.library_xml
+++ /dev/null
@@ -1,15 +0,0 @@
-The library.xml file is required to get syntax highlighting of Qt3D.Shapes
-plugin items in Qt Creator < version 2.2.
-
-The library.xml file is installed into the imports/Qt3D.Shapes tree along with
-the plugin and the qmldir file.
-
-When any of the elements - property names, class names or other exports
-- in the Qt3D.Shapes plugin are changed this file will need to be regenerated.
-
-To generate the library.xml file see the scripts/README file for a
-description of how to use the filter-qmldump.pl script.
-
-This is a less-than-optimal solution but as syntax discovery improves
-in Qt Creator better solutions should become available at which time
-this temporary script and syntax file may be deprecated.
diff --git a/src/imports/shapes/README.plugins_types b/src/imports/shapes/README.plugins_types
deleted file mode 100755
index ff41ea12..00000000
--- a/src/imports/shapes/README.plugins_types
+++ /dev/null
@@ -1,34 +0,0 @@
-The plugins.qmltypes file is required to get syntax highlighting of Qt3D.Shapes
-plugin items inside Qt Creator 2.2 and later.
-
-To support earlier versions of Qt Creator the library.xml file is used.
-
-The plugins.qmltypes file is installed into the imports/Qt3D.Shapes tree along
-with the plugin and the qmldir file.
-
-When any of the elements - property names, class names or other exports
-- in the Qt3D.Shapes plugin are changed this file will need to be regenerated.
-
-To generate the plugins.qmltypes, you first need a qmldump binary generated from
-sources shipped with Qt Creator 2.2 or greater. On Mac these are inside the app
-bundle, other platforms vary. If all else fails get the sources from the Qt
-Creator repo.
-
-To build qmldump you need access to private headers, so therefore it must be
-built against a source build of Qt. On Mac it is helpful to build qmldump with
-"qmake CONFIG-=app_bundle" so that you get a regular command-line binary.
-
-Once you finally have a viable qmldump binary:
-
-./qmldump Qt3D.Shapes 1.0 $QTDIR/imports > plugins.qmltypes
-
-...where $QTDIR points to the root of the Qt where Qt3D is installed.
-
-If you get a usage error like:
-
-Usage: qmldump [plugin/import/path plugin.uri]
-
-...then the version of qmldump source you used was not for Qt Creator > 2.2 -
-you somehow have the earlier version qmldump sources.
-
-You do not need to use the filter-qmldump.pl script.
diff --git a/src/imports/shapes/Sphere.qml b/src/imports/shapes/Sphere.qml
deleted file mode 100644
index 15a9f020..00000000
--- a/src/imports/shapes/Sphere.qml
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt3D 1.0
-import Qt3D.Shapes 1.0
-
-Item3D {
- id: sphere
- property alias name: sphereMesh.objectName
- property alias radius: sphereMesh.radius
- property alias levelOfDetail: sphereMesh.levelOfDetail
- property alias axis: sphereMesh.axis
- mesh: SphereMesh {
- id: sphereMesh
- }
-}
diff --git a/src/imports/shapes/Teapot.qml b/src/imports/shapes/Teapot.qml
deleted file mode 100644
index 3c4df17a..00000000
--- a/src/imports/shapes/Teapot.qml
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 1.0
-import Qt3D 1.0
-
-Item3D {
- id: teapot
- mesh: Mesh { source: "teapot.bez" }
-}
diff --git a/src/imports/shapes/capsulemesh.cpp b/src/imports/shapes/capsulemesh.cpp
deleted file mode 100644
index 5b0c068d..00000000
--- a/src/imports/shapes/capsulemesh.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "capsulemesh.h"
-#include "qglbuilder.h"
-#include "qglcylinder.h"
-#include "qgldome.h"
-#include "qglabstractscene.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass CapsuleMesh CapsuleMesh
- \brief The CapsuleMesh item represents a simple capsule in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The CapsuleMesh element in QML provides a simple way to create a capsule
- object, usually for testing material effects. For example,
- the following QML code displays a green capsule of with a uniform
- diameter of 0.5, and a length of 3.0, centered vertically on the
- origin:
-
- \code
- Item3D {
- mesh: CapsuleMesh {
- radius: 0.5
- length: 3.0
- }
- effect: Effect {
- color: "#aaca00"
- }
- }
- \endcode
-
- The CapsuleMesh element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- The capsule shape can have differing levels of detail, allowing
- for additional slices and layers to be drawn if more detailed meshes
- are required.
-
- Note that the length of the capsule should always exceed its
- diameter to be considered valid.
-
- To display the capsule mesh you can create your own Item3D as shown
- above, or use the convenience Capsule QML Component.
-
- \code
- Capsule {
- radius: 0.5
- length: 3.0
- effect: Effect {
- color: "#aaca00"
- }
- }
- \endcode
-
- \section1 Performance Hints for Larger Scenes
-
- The convenience Capsule QML component will create a new mesh each
- time is instantiated.
-
- If you have a scene with a number of similar capsules use your own
- Item3D elements to all refer to the same mesh. See the Performance
- Hints section of the SphereMesh documentation for more details on
- this important technique.
-
- \section1 Performance Hints for Animation
-
- Because of the need to maintain the relative proportions of the
- cylinders components, the length and radius are implemented directly
- in the construction of the mesh. This differs from the approach
- used in the SphereMesh where a scale is used.
-
- For this reason avoid animating the length and radius properties
- of a CapsuleMesh, as it will give poor results due to the mesh
- being recreated every frame.
-
- Since the capules components are created with named sections in
- the mesh, one approach would be to individually apply scales to
- these sections using the meshNode property. This is an
- advanced topic, and future tutorials may cover it in more depth.
-
- \sa Item3D, SphereMesh
-*/
-
-CapsuleMeshPrivate::CapsuleMeshPrivate()
- : topNode(new QGLSceneNode)
- , currentCapsule(0)
- , radius(1.0f)
- , length(1.0f)
- , lod(5)
- , sceneSet(false)
-{
- topNode->setObjectName("CapsuleMesh");
-}
-
-CapsuleMeshPrivate::~CapsuleMeshPrivate()
-{
- topNode->removeNode(currentCapsule);
- delete topNode;
- QList<QGLSceneNode*> lods = lodGeometry.values();
- qDeleteAll(lods);
-}
-
-class CapsuleScene : public QGLAbstractScene
-{
-public:
- explicit CapsuleScene(QGLSceneNode *s) : m_s(s) {}
- ~CapsuleScene() {}
- QList<QObject *> objects() const
- {
- QList<QObject *> s;
- s.append(m_s);
- return s;
- }
- QGLSceneNode *mainNode() const
- {
- return m_s;
- }
-private:
- QGLSceneNode *m_s;
-};
-
-/*!
- \internal
-*/
-CapsuleMesh::CapsuleMesh(QObject *parent)
- : QDeclarativeMesh(parent)
- , d_ptr(new CapsuleMeshPrivate)
-{
-}
-
-/*!
- \qmlproperty real CapsuleMesh::radius
-
- This property defines the radius of the capsule.
- The default value is 1.
-*/
-qreal CapsuleMesh::radius() const
-{
- Q_D(const CapsuleMesh);
- return d->radius;
-}
-
-void CapsuleMesh::setRadius(qreal radius)
-{
- Q_D(CapsuleMesh);
- if (qFuzzyCompare(radius, 1))
- radius = 1.0f;
- if (d->radius != radius) {
- d->radius = radius;
- createGeometry();
- emit radiusChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \qmlproperty real CapsuleMesh::length
-
- This property defines the length of the capsule.
- The default value is 1.
-*/
-qreal CapsuleMesh::length() const
-{
- Q_D(const CapsuleMesh);
- return d->length;
-}
-
-void CapsuleMesh::setLength(qreal length)
-{
- Q_D(CapsuleMesh);
- if (qFuzzyCompare(length, 1))
- length = 1.0f;
- if (d->length != length) {
- d->length = length;
- createGeometry();
- emit lengthChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \qmlproperty int CapsuleMesh::levelOfDetail
-
- This property defines the level of detail, between 1 and 10,
- which controls the number of slices and layers that are used
- to generate the capsule's mesh.
-
- Values outside the range 1 to 10 will be clamped to the range
- when the capsule is generated.
-
- The exact number of facets generated is consistent with the
- level of detail as specified in the Cylinder and Sphere
- objects.
-
- \sa Sphere, Cylinder
-*/
-int CapsuleMesh::levelOfDetail() const
-{
- Q_D(const CapsuleMesh);
- return d->lod;
-}
-
-void CapsuleMesh::setLevelOfDetail(int lod)
-{
- Q_D(CapsuleMesh);
- lod = qBound(1, lod, 10);
- if (d->lod != lod) {
- d->lod = lod;
- createGeometry();
- emit levelOfDetailChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \internal
-*/
-void CapsuleMesh::draw(QGLPainter *painter, int branchId)
-{
- Q_D(CapsuleMesh);
- if (!d->currentCapsule)
- createGeometry();
- QDeclarativeMesh::draw(painter, branchId);
-}
-
-/*!
- \internal
-*/
-void CapsuleMesh::createGeometry()
-{
- Q_D(CapsuleMesh);
-
- // Create a new geometry node for this level of detail if necessary.
- QGLSceneNode *geometry = d->lodGeometry.value(d->lod, 0);
- if (!geometry) {
- QGLBuilder builder;
-
- // For the cylinder
- int facets = 4 * 1 << d->lod;
- int layers = 1 << d->lod;
-
- // For the spheres
- int divisions = d->lod;
-
- // Sanity check - the height of the capsule must not be less than its
- // diameter. A minimal capsule is a sphere - where diameter == height.
- if (d->length < 2.0 * d->radius)
- {
- qWarning() << "Length of capsule must exceed its diameter"
- << " - correcting height.";
- d->length = 2 * d->radius;
- }
-
- qreal diameter = d->radius+d->radius;
- qreal cylinderHeight = d->length - diameter;
- qreal offset = cylinderHeight/2.0;
-
- builder << QGL::Faceted;
- QGLSceneNode *s = 0;
- s = builder.newNode();
- s->setObjectName("Cylinder");
- builder << QGLCylinder(diameter, diameter, cylinderHeight,
- facets, layers, false, false);
- QMatrix4x4 translateMatrix;
- translateMatrix.translate(0, 0, -offset);
- builder.currentNode()->setLocalTransform(translateMatrix);
-
- s = builder.newNode();
- s->setObjectName("LeftEndCap");
- builder << QGLDome(diameter, divisions, false);
- translateMatrix.setToIdentity();
- translateMatrix.rotate(180, 0, 1,0);
- translateMatrix.translate(0, 0, offset);
- builder.currentNode()->setLocalTransform(translateMatrix);
-
- s = builder.newNode();
- s->setObjectName("RightEndCap");
- builder << QGLDome(diameter, divisions, false);
- translateMatrix.setToIdentity();
- translateMatrix.translate(0, 0, offset);
- builder.currentNode()->setLocalTransform(translateMatrix);
-
- geometry = builder.finalizedSceneNode();
-
- d->lodGeometry.insert(d->lod, geometry);
- }
- Q_ASSERT_X(geometry != 0, Q_FUNC_INFO, "Could not create/find geometry!");
- if (d->currentCapsule != geometry)
- {
- if (d->currentCapsule)
- d->topNode->removeNode(d->currentCapsule);
- d->topNode->addNode(geometry);
- d->currentCapsule = geometry;
- }
-
- if (!d->sceneSet)
- {
- setScene(new CapsuleScene(d->topNode));
- d->sceneSet = true;
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/imports/shapes/capsulemesh.h b/src/imports/shapes/capsulemesh.h
deleted file mode 100644
index 3076f6ab..00000000
--- a/src/imports/shapes/capsulemesh.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAPSULE_H
-#define CAPSULE_H
-
-#include "qdeclarativemesh.h"
-#include "capsulemesh_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class CapsuleMesh : public QDeclarativeMesh
-{
- Q_OBJECT
- Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(qreal length READ length WRITE setLength NOTIFY lengthChanged)
- Q_PROPERTY(int levelOfDetail READ levelOfDetail WRITE setLevelOfDetail NOTIFY levelOfDetailChanged)
-
-public:
- explicit CapsuleMesh(QObject *parent = 0);
- ~CapsuleMesh() {}
-
- qreal radius() const;
- void setRadius(qreal radius);
-
- qreal length() const;
- void setLength(qreal length);
-
- int levelOfDetail() const;
- void setLevelOfDetail(int lod);
-
- void draw(QGLPainter *painter, int branchId);
-
-Q_SIGNALS:
- void radiusChanged();
- void lengthChanged();
- void levelOfDetailChanged();
-
-private:
- void createGeometry();
-
- Q_DISABLE_COPY(CapsuleMesh)
- Q_DECLARE_PRIVATE(CapsuleMesh)
-
- QScopedPointer<CapsuleMeshPrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(CapsuleMesh)
-
-QT_END_HEADER
-
-#endif // CAPSULE_H
diff --git a/src/imports/shapes/capsulemesh_p.h b/src/imports/shapes/capsulemesh_p.h
deleted file mode 100644
index 2cff15fd..00000000
--- a/src/imports/shapes/capsulemesh_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAPSULEMESH_P_H
-#define CAPSULEMESH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QMap>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGLSceneNode;
-
-class CapsuleMeshPrivate
-{
-public:
- CapsuleMeshPrivate();
- ~CapsuleMeshPrivate();
-
- QMap<int, QGLSceneNode *> lodGeometry;
- QGLSceneNode *topNode;
- QGLSceneNode *currentCapsule;
- qreal radius;
- qreal length;
- int lod;
- bool sceneSet;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // CAPSULEMESH_P_H
diff --git a/src/imports/shapes/cube.h b/src/imports/shapes/cube.h
deleted file mode 100644
index 73d72127..00000000
--- a/src/imports/shapes/cube.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CUBE_H
-#define CUBE_H
-
-// This is a dummy header for defining the interface of "Cube.qml" to qdoc.
-
-#include "item3d.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Cube : public Item3D
-{
- Q_OBJECT
-public:
- Cube(QObject *parent = 0) : Item3D(parent) {}
- ~Cube() {}
-};
-
-QML_DECLARE_TYPE(Cube)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/shapes/cube.obj b/src/imports/shapes/cube.obj
deleted file mode 100644
index 7e0c3e0a..00000000
--- a/src/imports/shapes/cube.obj
+++ /dev/null
@@ -1,25 +0,0 @@
-s 0
-v -0.5 -0.5 -0.5
-v -0.5 -0.5 0.5
-v -0.5 0.5 0.5
-v -0.5 0.5 -0.5
-v 0.5 -0.5 -0.5
-v 0.5 -0.5 0.5
-v 0.5 0.5 0.5
-v 0.5 0.5 -0.5
-vn -1.0 0.0 0.0
-vn 0.0 1.0 0.0
-vn 1.0 0.0 0.0
-vn 0.0 -1.0 0.0
-vn 0.0 0.0 1.0
-vn 0.0 0.0 -1.0
-vt 1.0 0.0
-vt 1.0 1.0
-vt 0.0 1.0
-vt 0.0 0.0
-f 1/4/1 2/1/1 3/2/1 4/3/1
-f 4/3/2 3/4/2 7/1/2 8/2/2
-f 8/2/3 7/3/3 6/4/3 5/1/3
-f 5/1/4 6/2/4 2/3/4 1/4/4
-f 6/1/5 7/2/5 3/3/5 2/4/5
-f 8/3/6 5/4/6 1/1/6 4/2/6
diff --git a/src/imports/shapes/cube.qdoc b/src/imports/shapes/cube.qdoc
deleted file mode 100644
index db6782b5..00000000
--- a/src/imports/shapes/cube.qdoc
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \qmlclass Cube Cube
- \brief The Cube item represents a simple cube in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The Cube element in QML provides a simple way to create a cube
- object, usually for testing material effects. For example,
- the following QML code displays a cube of size 1.5, centered
- on the origin and covered in the Qt logo texture:
-
- \code
- Cube {
- scale: 1.5
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- }
- }
- \endcode
-
- The Cube element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- The cube can be moved from the origin by specifying the
- Item3D::position property:
-
- \code
- Cube {
- scale: 1.5
- position: Qt.vector3d(1, 0, 5)
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- }
- }
- \endcode
-
- \sa Item3D
-*/
diff --git a/src/imports/shapes/cylindermesh.cpp b/src/imports/shapes/cylindermesh.cpp
deleted file mode 100644
index ee814009..00000000
--- a/src/imports/shapes/cylindermesh.cpp
+++ /dev/null
@@ -1,348 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "cylindermesh.h"
-#include "qglbuilder.h"
-#include "qglcylinder.h"
-#include "qgraphicsscale3d.h"
-#include "qglabstractscene.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass CylinderMesh CylinderMesh
- \brief The CylinderMesh item represents a simple cylinder in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The CylinderMesh element in QML provides a way to create a simple cylinder
- object, usually for testing material effects. For example, the
- following QML code displays a green cylinder of with a uniform
- diameter of 0.5, and a length of 3.0, centered with its base on the
- origin:
-
- \code
- Item3D {
- mesh: CylinderMesh {
- radius: 0.5
- length: 3.0
- }
- effect: Effect {
- color: "#aaca00"
- }
- }
- \endcode
-
- The CylinderMesh element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- The cylinder shape can have differing levels of detail, allowing
- for additional slices and layers to be drawn if more detailed meshes
- are required.
-
- To display the cylinder mesh you can create your own Item3D as shown
- above, or use the convenience Cylinder QML Component.
-
- \code
- Cylinder {
- radius: 0.5
- length: 3.0
- effect: Effect {
- color: "#aaca00"
- }
- }
- \endcode
-
- \section1 Performance Hints for Larger Scenes
-
- The convenience Cylinder QML component will create a new mesh each
- time is instantiated.
-
- If you have a scene with a number of similar capsules use your own
- Item3D elements to all refer to the same mesh. See the Performance
- Hints section of the SphereMesh documentation for more details on
- this important technique.
-
- \section1 Performance Hints for Animation
-
- Some support for animation of the CylinderMesh properties is provided
- by utilizing a QGraphicsScale3D to implement the length & radius
- properties, and by caching levels of detail.
-
- So within limits animation of these items should provide reasonable
- results. Be aware that on constrained devices animation of the
- level of detail for many cylinders could cause problems with memory
- usage due to the caching.
-
- \sa Item3D, SphereMesh
-*/
-
-CylinderMeshPrivate::CylinderMeshPrivate()
- : topNode(new QGLSceneNode)
- , currentCylinder(0)
- , scale(0)
- , radius(1.0f)
- , length(1.0f)
- , lod(5)
- , sceneSet(false)
-{
- topNode->setObjectName("CylinderMesh");
-}
-
-CylinderMeshPrivate::~CylinderMeshPrivate()
-{
- topNode->removeNode(currentCylinder);
- delete topNode;
- QList<QGLSceneNode*> lods = lodGeometry.values();
- qDeleteAll(lods);
-}
-
-class CylinderScene : public QGLAbstractScene
-{
-public:
- explicit CylinderScene(QGLSceneNode *s) : m_s(s) {}
- ~CylinderScene() {}
- QList<QObject *> objects() const
- {
- QList<QObject *> s;
- s.append(m_s);
- return s;
- }
- QGLSceneNode *mainNode() const
- {
- return m_s;
- }
-private:
- QGLSceneNode *m_s;
-};
-
-/*!
- \internal
-*/
-CylinderMesh::CylinderMesh(QObject *parent)
- : QDeclarativeMesh(parent)
- , d_ptr(new CylinderMeshPrivate)
-{
-}
-
-/*!
- \qmlproperty real CylinderMesh::radius
-
- This property defines the radius of the cylinder.
- The default value is 1.
-*/
-qreal CylinderMesh::radius() const
-{
- Q_D(const CylinderMesh);
- return d->radius;
-}
-
-void CylinderMesh::setRadius(qreal radius)
-{
- Q_D(CylinderMesh);
- if (qFuzzyCompare(radius, 1))
- radius = 1.0f;
- if (d->radius != radius) {
- d->radius = radius;
- createGeometry();
- emit radiusChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \qmlproperty real CylinderMesh::length
-
- This property defines the length of the cylinder.
- The default value is 1.
-*/
-qreal CylinderMesh::length() const
-{
- Q_D(const CylinderMesh);
- return d->length;
-}
-
-void CylinderMesh::setLength(qreal length)
-{
- Q_D(CylinderMesh);
- if (qFuzzyCompare(length, 1))
- length = 1.0f;
- if (d->length != length) {
- d->length = length;
- createGeometry();
- emit lengthChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \qmlproperty int CylinderMesh::levelOfDetail
-
- This property defines the level of detail, between 1 and 10,
- which controls the number of slices and layers that are used
- to generate the cylinder's mesh.
-
- Values outside the range 1 to 10 will be clamped to the range
- when the cylinder is generated.
-
- The default value is 1, which produces a cylinder with 8
- slices/facets and 2 layers. Each successive increase in this
- level of detail doubles the number of facets and layers. The
- following table provides information for these level of detail
- values
-
- \table
- \header \o Level of Detail \o Facets \o Layers
- \row \o 1 \o 8 \o 2
- \row \o 2 \o 16 \o 4
- \row \o 3 \o 32 \o 8
- \row \o 4 \o 64 \o 16
- \row \o 5 \o 128 \o 32
- \row \o 6 \o 256 \o 64
- \row \o 7 \o 512 \o 128
- \row \o 8 \o 1024 \o 256
- \row \o 9 \o 2048 \o 512
- \row \o 10 \o 4096 \o 1024
- \endtable
-*/
-int CylinderMesh::levelOfDetail() const
-{
- Q_D(const CylinderMesh);
- return d->lod;
-}
-
-void CylinderMesh::setLevelOfDetail(int lod)
-{
- Q_D(CylinderMesh);
- lod = qBound(1, lod, 10);
- if (d->lod != lod) {
- d->lod = lod;
- createGeometry();
- emit levelOfDetailChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \internal
-*/
-void CylinderMesh::draw(QGLPainter *painter, int branchId)
-{
- Q_D(CylinderMesh);
- if (!d->currentCylinder)
- createGeometry();
- QDeclarativeMesh::draw(painter, branchId);
-}
-
-/*!
- \internal
-*/
-void CylinderMesh::createGeometry()
-{
- Q_D(CylinderMesh);
-
- int facets = 4 * 1 << d->lod;
- int layers = 1 << d->lod;
-
- // Create a new geometry node for this level of detail if necessary.
- QGLSceneNode *geometry = d->lodGeometry.value(d->lod, 0);
- if (!geometry) {
- QGLBuilder builder;
- builder << QGL::Faceted << QGLCylinder(2.0, 2.0, 1.0, facets,
- layers, true, true);
- geometry = builder.finalizedSceneNode();
- geometry->setParent(this);
- d->lodGeometry.insert(d->lod, geometry);
- }
- Q_ASSERT_X(geometry != 0, Q_FUNC_INFO, "Could not create/find geometry!");
- if (d->currentCylinder != geometry)
- {
- if (d->currentCylinder)
- d->topNode->removeNode(d->currentCylinder);
- d->topNode->addNode(geometry);
- d->currentCylinder = geometry;
- }
-
- // Set the length as a scale on the modelview transformation.
- // This way, we don't have to regenerate the geometry every
- // frame if the height is being animated.
- //
- // We could do the scales separately if either height or radius
- // were != 1.0f, but the same amount of maths is required, so
- // we can just scale appropriately on the axes.
- if (d->radius != 1.0f || d->length != 1.0)
- {
- if (!d->scale)
- {
- d->scale = new QGraphicsScale3D(d->topNode);
- d->topNode->addTransform(d->scale);
- }
- if (d->scale->scale().x() != d->radius ||
- d->scale->scale().z() != d->length)
- {
- d->scale->setScale(QVector3D(d->radius, d->radius, d->length));
- }
- }
- else
- {
- // If there is already a scale set it to be the identity scale.
- // This case is optimised for in QGraphicsScale. Removing it from
- // the transform list is too expensive, especially if the size is
- // being animated, and the next frame will recreate it.
- if (d->scale)
- d->scale->setScale(QVector3D(1, 1, 1));
- }
-
- if (!d->sceneSet)
- {
- setScene(new CylinderScene(d->topNode));
- d->sceneSet = true;
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/imports/shapes/cylindermesh.h b/src/imports/shapes/cylindermesh.h
deleted file mode 100644
index bfdc46f3..00000000
--- a/src/imports/shapes/cylindermesh.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CYLINDER_H
-#define CYLINDER_H
-
-#include "qdeclarativemesh.h"
-#include "cylindermesh_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class CylinderMesh : public QDeclarativeMesh
-{
- Q_OBJECT
- Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(qreal length READ length WRITE setLength NOTIFY lengthChanged)
- Q_PROPERTY(int levelOfDetail READ levelOfDetail WRITE setLevelOfDetail NOTIFY levelOfDetailChanged)
-
-public:
- explicit CylinderMesh(QObject *parent = 0);
- ~CylinderMesh() {}
-
- qreal radius() const;
- void setRadius(qreal radius);
-
- qreal length() const;
- void setLength(qreal length);
-
- int levelOfDetail() const;
- void setLevelOfDetail(int lod);
-
- void draw(QGLPainter *painter, int branchId);
-
-Q_SIGNALS:
- void radiusChanged();
- void lengthChanged();
- void levelOfDetailChanged();
-
-private:
- void createGeometry();
-
- Q_DISABLE_COPY(CylinderMesh)
- Q_DECLARE_PRIVATE(CylinderMesh)
-
- QScopedPointer<CylinderMeshPrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(CylinderMesh)
-
-QT_END_HEADER
-
-#endif // CYLINDER_H
diff --git a/src/imports/shapes/cylindermesh_p.h b/src/imports/shapes/cylindermesh_p.h
deleted file mode 100644
index a5ad562f..00000000
--- a/src/imports/shapes/cylindermesh_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CYLINDERMESH_P_H
-#define CYLINDERMESH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QMap>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsScale3D;
-class QGLSceneNode;
-
-class CylinderMeshPrivate
-{
-public:
- CylinderMeshPrivate();
- ~CylinderMeshPrivate();
-
- QMap<int, QGLSceneNode *> lodGeometry;
- QGLSceneNode *topNode;
- QGLSceneNode *currentCylinder;
- QGraphicsScale3D *scale;
- qreal radius;
- qreal length;
- int lod;
- bool sceneSet;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // CYLINDERMESH_P_H
diff --git a/src/imports/shapes/library.xml b/src/imports/shapes/library.xml
deleted file mode 100644
index d03e3f64..00000000
--- a/src/imports/shapes/library.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module>
- <type name="Capsule" defaultProperty="data" extends="QDeclarativeItem3D">
- <exports>
- <export module="Qt3D.Shapes" version="1.0" type="Capsule" />
- </exports>
- <property name="radius" type="qreal" />
- <property name="length" type="qreal" />
- <property name="levelOfDetail" type="int" />
- <signal name="radiusChanged" />
- <signal name="lengthChanged" />
- <signal name="levelOfDetailChanged" />
- </type>
- <type name="Cylinder" defaultProperty="data" extends="QDeclarativeItem3D">
- <exports>
- <export module="Qt3D.Shapes" version="1.0" type="Cylinder" />
- </exports>
- <property name="radius" type="qreal" />
- <property name="length" type="qreal" />
- <property name="levelOfDetail" type="int" />
- <signal name="radiusChanged" />
- <signal name="lengthChanged" />
- <signal name="levelOfDetailChanged" />
- </type>
- <type name="Line" defaultProperty="data" extends="QDeclarativeItem3D">
- <exports>
- <export module="Qt3D.Shapes" version="1.0" type="Line" />
- </exports>
- <property name="width" type="qreal" />
- <property name="vertices" type="QVariant" />
- <signal name="verticesChanged" />
- <signal name="widthChanged" />
- </type>
- <type name="Point" defaultProperty="data" extends="QDeclarativeItem3D">
- <exports>
- <export module="Qt3D.Shapes" version="1.0" type="Point" />
- </exports>
- <property name="pointSize" type="qreal" />
- <property name="vertices" type="QVariant" />
- <signal name="verticesChanged" />
- <signal name="pointSizeChanged" />
- </type>
- <type name="Sphere" defaultProperty="data" extends="QDeclarativeItem3D">
- <exports>
- <export module="Qt3D.Shapes" version="1.0" type="Sphere" />
- </exports>
- <property name="radius" type="qreal" />
- <property name="levelOfDetail" type="int" />
- <property name="axis" type="Qt.Axis" />
- <signal name="radiusChanged" />
- <signal name="levelOfDetailChanged" />
- <signal name="axisChanged" />
- </type>
-</module>
diff --git a/src/imports/shapes/line.cpp b/src/imports/shapes/line.cpp
deleted file mode 100644
index f93a2b00..00000000
--- a/src/imports/shapes/line.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "line.h"
-#include "qglbuilder.h"
-
-/*!
- \qmlclass Line Line
- \brief The Line item represents a geometric line drawn in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The Line element in QML provides a means of drawing lines in a 3D
- environment. For example, the following QML code draws a line between
- point (0,0,0), (1,1,1), then to (-1,-1,-1).
-
- \code
-
- Line {
- vertices: [
- 0, 0, 0,
- 0, 0, 1,
- 0, 1, 1
-
- ]
- effect: Effect {
- color: "#aaca00"
- }
- }
- \endcode
-
- The Line element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- \sa Item3D
-*/
-/*!
- \internal
-*/
-Line::Line(QObject *parent) :
- QDeclarativeItem3D(parent)
- ,m_width(3.0)
- ,m_geometry(0)
- ,m_changeFlag(false)
-{
- //meh
-}
-
-/*!
- \qmlproperty list<real> Line::vertices
-
- This property defines the positions for all of the vertices in the
- line strip. Each vertex is given by three real values, defining
- the x, y, and z co-ordinates of the vertex.
-*/
-
-QVariant Line::vertices() const
-{
- return m_vertices;
-}
-
-void Line::setVertices(const QVariant &value)
-{
- m_vertices = value;
-
- //Update the actual QVector3DArray containing the line points.
- m_vertexArray.clear();
- QVariantList vertlist = m_vertices.toList();
- for (int index = 0; (index + 2) < vertlist.size(); index += 3) {
- m_vertexArray.append(qreal(vertlist.at(index).toDouble()), qreal(vertlist.at(index + 1).toDouble()), qreal(vertlist.at(index + 2).toDouble()));
- }
- m_changeFlag=true;
- emit verticesChanged();
- update();
-}
-
-
-/*!
- \qmlproperty real Line::width
-
- This property defines the width of the line. The
- default is 1.0
-*/
-void Line::setWidth(qreal width)
-{
- if (m_width != width) {
- m_width = width;
- m_changeFlag=true;
- emit widthChanged();
- update();
- }
-}
-
-/*!
- \internal
-*/
-void Line::drawItem(QGLPainter *painter)
-{
- if (m_changeFlag || !m_geometry) {
- if (m_geometry) delete m_geometry;
-
- QGeometryData lineCollection;
- lineCollection.appendVertexArray(m_vertexArray);
-
- QGLBuilder builder;
- builder.newSection();
- builder.addTriangles(lineCollection);
- builder.currentNode()->setDrawingMode(QGL::LineStrip);
- builder.currentNode()->setDrawingWidth(m_width);
- m_geometry = builder.finalizedSceneNode();
-
- m_changeFlag = false;
- }
-
- // Draw the geometry.
- m_geometry->draw(painter);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/imports/shapes/line.h b/src/imports/shapes/line.h
deleted file mode 100644
index 4f788dd9..00000000
--- a/src/imports/shapes/line.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef LINE_H
-#define LINE_H
-
-#include "qdeclarativeitem3d.h"
-#include "qglscenenode.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Line : public QDeclarativeItem3D
-{
- Q_OBJECT
- Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged)
- Q_PROPERTY(QVariant vertices READ vertices WRITE setVertices NOTIFY verticesChanged)
-
-public:
- explicit Line(QObject *parent = 0);
- ~Line() {}
-
- QVariant vertices() const;
- void setVertices(const QVariant &value);
-
- qreal width() const {return m_width;}
- void setWidth(qreal width);
-
-Q_SIGNALS:
- void verticesChanged();
- void widthChanged();
-
-protected:
- void drawItem(QGLPainter *painter);
-
-private:
- qreal m_width;
- QVariant m_vertices;
- QVector3DArray m_vertexArray;
- QGLSceneNode * m_geometry;
- bool m_changeFlag;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(Line)
-
-QT_END_HEADER
-
-#endif // LINE_H
diff --git a/src/imports/shapes/plugins.qmltypes b/src/imports/shapes/plugins.qmltypes
deleted file mode 100755
index 435d7d3f..00000000
--- a/src/imports/shapes/plugins.qmltypes
+++ /dev/null
@@ -1,159 +0,0 @@
-import QtQuick.tooling 1.0
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-
-Module {
- Component {
- name: "Capsule"
- defaultProperty: "data"
- prototype: "QDeclarativeItem3D"
- exports: [
- "Capsule 1.0"
- ]
- Property { name: "radius"; type: "qreal" }
- Property { name: "length"; type: "qreal" }
- Property { name: "levelOfDetail"; type: "int" }
- Signal { name: "radiusChanged" }
- Signal { name: "lengthChanged" }
- Signal { name: "levelOfDetailChanged" }
- }
- Component {
- name: "Cylinder"
- defaultProperty: "data"
- prototype: "QDeclarativeItem3D"
- exports: [
- "Cylinder 1.0"
- ]
- Property { name: "radius"; type: "qreal" }
- Property { name: "length"; type: "qreal" }
- Property { name: "levelOfDetail"; type: "int" }
- Signal { name: "radiusChanged" }
- Signal { name: "lengthChanged" }
- Signal { name: "levelOfDetailChanged" }
- }
- Component {
- name: "Line"
- defaultProperty: "data"
- prototype: "QDeclarativeItem3D"
- exports: [
- "Line 1.0"
- ]
- Property { name: "width"; type: "qreal" }
- Property { name: "vertices"; type: "QVariant" }
- Signal { name: "verticesChanged" }
- Signal { name: "widthChanged" }
- }
- Component {
- name: "Point"
- defaultProperty: "data"
- prototype: "QDeclarativeItem3D"
- exports: [
- "Point 1.0"
- ]
- Property { name: "pointSize"; type: "qreal" }
- Property { name: "vertices"; type: "QVariant" }
- Signal { name: "verticesChanged" }
- Signal { name: "pointSizeChanged" }
- }
- Component {
- name: "QDeclarativeItem3D"
- defaultProperty: "data"
- prototype: "QDeclarativeItem"
- Enum {
- name: "CullFace"
- values: {
- "CullDisabled": 0,
- "CullFrontFaces": 1028,
- "CullBackFaces": 1029,
- "CullAllFaces": 1032,
- "CullClockwise": 65536
- }
- }
- Enum {
- name: "CullFaces"
- values: {
- "CullDisabled": 0,
- "CullFrontFaces": 1028,
- "CullBackFaces": 1029,
- "CullAllFaces": 1032,
- "CullClockwise": 65536
- }
- }
- Enum {
- name: "SortMode"
- values: {
- "DefaultSorting": 0,
- "BackToFront": 1
- }
- }
- Property { name: "position"; type: "QVector3D" }
- Property { name: "x"; type: "qreal" }
- Property { name: "y"; type: "qreal" }
- Property { name: "z"; type: "qreal" }
- Property { name: "scale"; type: "qreal" }
- Property { name: "transform"; type: "QGraphicsTransform3D"; isList: true; isReadonly: true }
- Property { name: "pretransform"; type: "QGraphicsTransform3D"; isList: true; isReadonly: true }
- Property { name: "mesh"; type: "QDeclarativeMesh"; isPointer: true }
- Property { name: "effect"; type: "QDeclarativeEffect"; isPointer: true }
- Property { name: "light"; type: "QGLLightParameters"; isPointer: true }
- Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "children"; type: "QDeclarativeItem3D"; isList: true; isReadonly: true }
- Property { name: "cullFaces"; type: "CullFaces" }
- Property { name: "sortChildren"; type: "SortMode" }
- Property { name: "meshNode"; type: "string" }
- Property { name: "inheritEvents"; type: "bool" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "parent"; type: "QDeclarativeItem3D"; isPointer: true }
- Signal { name: "positionChanged" }
- Signal { name: "scaleChanged" }
- Signal { name: "rotationChanged" }
- Signal { name: "meshChanged" }
- Signal { name: "meshNodeChanged" }
- Signal { name: "effectChanged" }
- Signal { name: "lightChanged" }
- Signal {
- name: "stateChanged"
- Parameter { type: "string" }
- }
- Signal { name: "clicked" }
- Signal { name: "doubleClicked" }
- Signal { name: "pressed" }
- Signal { name: "released" }
- Signal { name: "hoverEnter" }
- Signal { name: "hoverLeave" }
- Signal { name: "inheritEventsChanged" }
- Signal { name: "enabledChanged" }
- Signal { name: "childrenChanged" }
- Signal { name: "parentChanged" }
- Signal { name: "sortChildrenChanged" }
- Method { name: "update" }
- Method {
- name: "localToWorld"
- type: "QVector3D"
- Parameter { name: "point"; type: "QVector3D" }
- }
- Method { name: "localToWorld"; type: "QVector3D" }
- Method {
- name: "worldToLocal"
- type: "QVector3D"
- Parameter { name: "point"; type: "QVector3D" }
- }
- Method { name: "worldToLocal"; type: "QVector3D" }
- }
- Component {
- name: "Sphere"
- defaultProperty: "data"
- prototype: "QDeclarativeItem3D"
- exports: [
- "Sphere 1.0"
- ]
- Property { name: "radius"; type: "qreal" }
- Property { name: "levelOfDetail"; type: "int" }
- Property { name: "axis"; type: "Qt::Axis" }
- Signal { name: "radiusChanged" }
- Signal { name: "levelOfDetailChanged" }
- Signal { name: "axisChanged" }
- }
-}
diff --git a/src/imports/shapes/point.cpp b/src/imports/shapes/point.cpp
deleted file mode 100644
index 8f270975..00000000
--- a/src/imports/shapes/point.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "point.h"
-#include "qglbuilder.h"
-
-/*!
- \qmlclass Point Point
- \brief The Point item represents a geometric point drawn in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The Point element in QML provides a means of drawing points in a 3D
- environment. For example, the following QML code draws points (0,0,0),
- (1,1,1), and (-1,-1,-1).
-
- \code
- Point {
- vertices: [
- 0, 0, 0,
- 1, 1, 1,
- -1, -1, -1
- ]
- effect: Effect {
- useLighting: false
- color: "#aaca00"
- }
- }
- \endcode
-
- The Point element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- The Point element is intended only for drawing simple points, and does not
- support point sprites or effect attributes other than color.
-
- \sa Item3D
-*/
-/*!
- \internal
-*/
-Point::Point(QObject *parent) :
- QDeclarativeItem3D(parent)
- , m_pointSize(1.0f)
- , m_changeFlag(false)
-{
- //meh
-}
-
-
-/*!
- \qmlproperty list<real> Point::vertices
-
- This property defines the positions for all of the points to be drawn
- Each vertex is given by three real values, defining
- the x, y, and z co-ordinates of the vertex.
-*/
-
-QVariant Point::vertices() const
-{
- return m_vertices;
-}
-
-void Point::setVertices(const QVariant &value)
-{
- m_vertices = value;
-
- //Update the actual QVector3DArray containing the points.
- m_vertexArray.clear();
- QVariantList vertlist = m_vertices.toList();
- for (int index = 0; (index + 2) < vertlist.size(); index += 3) {
- m_vertexArray.append(qreal(vertlist.at(index).toDouble()), qreal(vertlist.at(index + 1).toDouble()), qreal(vertlist.at(index + 2).toDouble()));
- }
- m_changeFlag=true;
- emit verticesChanged();
- update();
-}
-
-
-/*!
- \qmlproperty qreal Point::pointSize
-
- This property defines the size of the point. The
- default is 1.0
-*/
-void Point::setPointSize(qreal pointSize)
-{
- if (m_pointSize != pointSize) {
- m_pointSize = pointSize;
- m_changeFlag=true;
- emit pointSizeChanged();
- update();
- }
-}
-
-/*!
- \internal
-*/
-void Point::drawItem(QGLPainter *painter)
-{
- if (m_changeFlag || !m_geometry) {
- if (m_geometry) delete m_geometry;
-
- QGLBuilder builder;
-
- QGeometryData pointCollection;
- builder.newSection();
-
- pointCollection.appendVertexArray(m_vertexArray);
-
- builder.addTriangles(pointCollection);
- builder.currentNode()->setDrawingMode(QGL::Points);
- builder.currentNode()->setDrawingWidth(m_pointSize);
- m_geometry = builder.finalizedSceneNode();
-
- m_changeFlag = false;
- }
-
- // Draw the geometry.
- m_geometry->draw(painter);
-}
-
-QT_END_NAMESPACE
-
-
diff --git a/src/imports/shapes/point.h b/src/imports/shapes/point.h
deleted file mode 100644
index 591f4d8a..00000000
--- a/src/imports/shapes/point.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef POINT_H
-#define POINT_H
-
-#include "qdeclarativeitem3d.h"
-#include "qglscenenode.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Point : public QDeclarativeItem3D
-{
- Q_OBJECT
- Q_PROPERTY(qreal pointSize READ pointSize WRITE setPointSize NOTIFY pointSizeChanged)
- Q_PROPERTY(QVariant vertices READ vertices WRITE setVertices NOTIFY verticesChanged)
-
-public:
- explicit Point(QObject *parent = 0);
- ~Point() {}
-
- QVariant vertices() const;
- void setVertices(const QVariant &value);
-
- qreal pointSize() const {return m_pointSize;}
- void setPointSize(qreal pointSize);
-
-Q_SIGNALS:
- void verticesChanged();
- void pointSizeChanged();
-
-protected:
- void drawItem(QGLPainter *painter);
-
-private:
- qreal m_pointSize;
- QVariant m_vertices;
- QVector3DArray m_vertexArray;
- QGLSceneNode * m_geometry;
- bool m_changeFlag;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(Point)
-
-QT_END_HEADER
-
-#endif // POINT_H
diff --git a/src/imports/shapes/qmldir b/src/imports/shapes/qmldir
deleted file mode 100644
index dd4f575d..00000000
--- a/src/imports/shapes/qmldir
+++ /dev/null
@@ -1,7 +0,0 @@
-plugin qshapesqmlplugin
-Cube 1.0 Cube.qml
-Teapot 1.0 Teapot.qml
-Quad 1.0 Quad.qml
-Sphere 1.0 Sphere.qml
-Capsule 1.0 Capsule.qml
-Cylinder 1.0 Cylinder.qml
diff --git a/src/imports/shapes/quad.obj b/src/imports/shapes/quad.obj
deleted file mode 100644
index a28dee25..00000000
--- a/src/imports/shapes/quad.obj
+++ /dev/null
@@ -1,12 +0,0 @@
-o Plane
-v 0.500000 0.000000 -0.500000
-v 0.500000 0.000000 0.500000
-v -0.500000 0.000000 0.500000
-v -0.500000 0.000000 -0.500000
-vt 1.000000 0.000000
-vt 1.000000 1.000000
-vt 0.000000 1.000000
-vt 0.000000 0.000000
-usemtl (null)
-s off
-f 1/2 4/3 3/4 2/1
diff --git a/src/imports/shapes/quad.qdoc b/src/imports/shapes/quad.qdoc
deleted file mode 100644
index b13a40a6..00000000
--- a/src/imports/shapes/quad.qdoc
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \qmlclass Quad Quad
- \brief The Quad item represents a simple quad in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The Quad element in QML provides a simple way to create a regular
- quad object, usually for testing material effects. For example,
- the following QML code displays a quad of size 1.5, centered
- on the origin and covered in the Qt logo texture:
-
- \code
- Quad {
- scale: 1.5
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- }
- }
- \endcode
-
- The Quad element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- The quad can be moved from the origin by specifying the
- Item3D::position property:
-
- \code
- Quad {
- scale: 1.5
- position: Qt.vector3d(1, 0, 5)
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- }
- }
- \endcode
-
- \sa Item3D
-*/
diff --git a/src/imports/shapes/shapes.cpp b/src/imports/shapes/shapes.cpp
deleted file mode 100644
index 7c1958c6..00000000
--- a/src/imports/shapes/shapes.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-
-#include "spheremesh.h"
-#include "cylindermesh.h"
-#include "capsulemesh.h"
-#include "line.h"
-#include "point.h"
-
-QT_BEGIN_NAMESPACE
-
-class QShapesQmlModule : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt3D.Shapes"));
- qmlRegisterType<SphereMesh>(uri,1,0,"SphereMesh");
- qmlRegisterType<CylinderMesh>(uri,1,0,"CylinderMesh");
- qmlRegisterType<CapsuleMesh>(uri,1,0,"CapsuleMesh");
- qmlRegisterType<Line>(uri,1,0,"Line");
- qmlRegisterType<Point>(uri,1,0,"Point");
-
- }
-};
-
-QT_END_NAMESPACE
-
-#include "shapes.moc"
-
-Q_EXPORT_PLUGIN2(qshapesqmlplugin, QT_PREPEND_NAMESPACE(QShapesQmlModule));
diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro
deleted file mode 100644
index 002446d4..00000000
--- a/src/imports/shapes/shapes.pro
+++ /dev/null
@@ -1,101 +0,0 @@
-TEMPLATE = lib
-TARGET = qshapesqmlplugin
-CONFIG += qt plugin
-
-CONFIG += qt3dquick_deploy_pkg
-include(../../../pkg.pri)
-
-# See the README in the root dir re this code
-package {
- target.path += $$QT3D_INSTALL_IMPORTS/Qt3D/Shapes
- INSTALLS += target
- QT += declarative
-} else {
- CONFIG += qt3dquick qt3d
- DESTDIR = $$QT3D_INSTALL_IMPORTS/Qt3D/Shapes
-}
-
-win32 {
- CONFIG(debug, debug|release) {
- TARGET = $$member(TARGET, 0)d
- }
-}
-
-symbian {
- CONFIG += epocallowdlldata
- MMP_RULES += EXPORTUNFROZEN
- LIBS += -lQt3D$${QT_LIBINFIX} -lQt3DQuick$${QT_LIBINFIX}
- TARGET.EPOCALLOWDLLDATA = 1
- TARGET.CAPABILITY = All -Tcb
- TARGET.UID3 = 0x20031E9C
-}
-
-SOURCES += \
- shapes.cpp \
- line.cpp \
- point.cpp \
- spheremesh.cpp \
- capsulemesh.cpp \
- cylindermesh.cpp
-HEADERS += \
- line.h \
- point.h \
- spheremesh.h \
- spheremesh_p.h \
- capsulemesh.h \
- cylindermesh.h \
- capsulemesh_p.h \
- cylindermesh_p.h
-
-QML_FILES = \
- Cube.qml \
- Sphere.qml \
- Quad.qml \
- Teapot.qml \
- Capsule.qml \
- Cylinder.qml
-
-QML_INFRA_FILES += \
- $$QML_FILES \
- qmldir \
- library.xml \
- plugins.qmltypes \
- cube.obj \
- quad.obj \
- teapot.bez
-# see the file README.library_xml for more on library.xml
-
-package {
- copyqmlinfra_install.files = $$QML_INFRA_FILES
- copyqmlinfra_install.path = $$QT3D_INSTALL_IMPORTS/Qt3D/Shapes
- INSTALLS += copyqmlinfra_install
-} else {
- copyqmlinfra.input = QML_INFRA_FILES
- copyqmlinfra.output = $$[QT_INSTALL_IMPORTS]/Qt3D/Shapes/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
- copyqmlinfra.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
- copyqmlinfra.CONFIG += no_link_no_clean
- copyqmlinfra.variable_out = PRE_TARGETDEPS
- QMAKE_EXTRA_COMPILERS += copyqmlinfra
-}
-
-OTHER_FILES += \
- README.plugins_types \
- README.library_xml
-
-OTHER_FILES += $$QML_FILES
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/imports/shapes/spheremesh.cpp b/src/imports/shapes/spheremesh.cpp
deleted file mode 100644
index 72bf1dee..00000000
--- a/src/imports/shapes/spheremesh.cpp
+++ /dev/null
@@ -1,393 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "spheremesh.h"
-#include "qglbuilder.h"
-#include "qglsphere.h"
-#include "qgraphicsrotation3d.h"
-#include "qgraphicsscale3d.h"
-#include "qglabstractscene.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass SphereMesh SphereMesh
- \brief The SphereMesh item represents a simple UV-sphere in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The SphereMesh element in QML provides a simple way to create a sphere
- object, usually for testing material effects. For example,
- the following QML code displays a green sphere mesh of radius 1.5,
- centered on the origin:
-
- \code
- Item3D {
- mesh: SphereMesh { radius: 1.5 }
- effect: Effect { color: "#aaca00" }
- }
- \endcode
-
- As shown, the mesh is only displayed when it is set as the target of
- a mesh property on an Item3D.
-
- The SphereMesh element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- By default, the sphere is aligned to lie along the Z axis.
- The \l axis property can change this to either the X or the Y
- axis, as shown in the following example:
-
- \code
- SphereMesh {
- radius: 1.5
- axis: Qt.YAxis
- }
- \endcode
-
- To display the sphere mesh you can create your own Item3D as shown
- above, or use the convenience Sphere QML component:
-
- \code
- Sphere {
- radius: 1.5
- levelOfDetail: 6
- axis: Qt.YAxis
- effect: Effect { texture: "moon-texture.jpg" }
- }
- \endcode
-
- \image moon-screenshot.png
-
- \section1 Performance Hints for Larger Scenes
-
- The convenience Sphere QML component will create a new mesh each
- time it is instantiated.
-
- If you have a scene with a number of similar spheres use your own
- Item3D elements to all refer to the same mesh - this will save on
- graphics memory and improve the performance of your application since
- there is no need to recreate many copies of the same geometry. This
- is true even if you want to apply different materials, effects or
- transformations to each sphere.
-
- To do this, first declare the SphereMesh object, outside of any Item3D
- so that it won't get drawn, and give it an id so you can refer to it.
-
- \snippet quick3d/solarsystem_qml/qml/solarsystem_qml.qml 0
-
- Then set the various effects and so on you need for each instance of
- the sphere. If you need different sized spheres you can use a scale,
- and of course you can specify materials and effects.
-
- \snippet quick3d/solarsystem_qml/qml/solarsystem_qml.qml 1
-
- In this case since only one copy of the triangle data for the mesh is
- sent to the GPU performance will generally be better.
-
- \section1 Performance Hints for Animation
-
- Some support for animation of the SphereMesh properties is provided
- by utilizing a QGraphicsScale3D to implement the radius property,
- and by caching levels of detail.
-
- So within limits animation of these items should provide reasonable
- results. Be aware that on constrained devices animation of the
- level of detail for many spheres could cause problems with memory
- usage due to the caching.
-
- The other shapes primitives are implemented differently with respect
- to radius, length and so on, so read the performance notes there, as
- they will differ from the sphere case.
-
- \sa Item3D
-*/
-
-SphereMeshPrivate::SphereMeshPrivate()
- : topNode(new QGLSceneNode)
- , currentSphere(0)
- , rot(0)
- , scale(0)
- , radius(1.0f)
- , lod(5)
- , axis(Qt::ZAxis)
- , sceneSet(false)
-{
- topNode->setObjectName("SphereMesh");
-}
-
-SphereMeshPrivate::~SphereMeshPrivate()
-{
- topNode->removeNode(currentSphere);
- delete topNode;
- QList<QGLSceneNode*> lods = lodGeometry.values();
- qDeleteAll(lods);
-}
-
-class SphereScene : public QGLAbstractScene
-{
-public:
- explicit SphereScene(QGLSceneNode *s) : m_s(s) {}
- ~SphereScene() {}
- QList<QObject *> objects() const
- {
- QList<QObject *> s;
- s.append(m_s);
- return s;
- }
- QGLSceneNode *mainNode() const
- {
- return m_s;
- }
-private:
- QGLSceneNode *m_s;
-};
-
-/*!
- \internal
-*/
-SphereMesh::SphereMesh(QObject *parent)
- : QDeclarativeMesh(parent)
- , d_ptr(new SphereMeshPrivate)
-{
-}
-
-/*!
- \qmlproperty real SphereMesh::radius
-
- This property defines the radius of the sphere. The default
- value is 1.
-*/
-qreal SphereMesh::radius() const
-{
- Q_D(const SphereMesh);
- return d->radius;
-}
-
-void SphereMesh::setRadius(qreal radius)
-{
- Q_D(SphereMesh);
- if (qFuzzyCompare(radius, 1))
- radius = 1.0f;
- if (d->radius != radius)
- {
- d->radius = radius;
- createGeometry();
- emit radiusChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \qmlproperty int SphereMesh::levelOfDetail
-
- This property defines the level of detail, between 1 and 10,
- which controls the number of triangles that are generated to
- render the surface of the sphere. Values outside the range
- 1 to 10 will be clamped to the range when the sphere is drawn.
-
- The default value is 5. An increase in 1 in level of detail
- doubles the number of triangles. The following picture shows
- the effect of level of detail values between 1 and 10:
-
- \image sphere-detail.png
-
- \table
- \header \o Level of Detail \o Number of Triangles
- \row \o 1 \o 64
- \row \o 2 \o 128
- \row \o 3 \o 256
- \row \o 4 \o 512
- \row \o 5 \o 1024
- \row \o 6 \o 2048
- \row \o 7 \o 4096
- \row \o 8 \o 8192
- \row \o 9 \o 16384
- \row \o 10 \o 32768
- \endtable
-*/
-int SphereMesh::levelOfDetail() const
-{
- Q_D(const SphereMesh);
- return d->lod;
-}
-
-void SphereMesh::setLevelOfDetail(int lod)
-{
- Q_D(SphereMesh);
- lod = qBound(1, lod, 10);
- if (d->lod != lod)
- {
- d->lod = lod;
- createGeometry();
- emit levelOfDetailChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration SphereMesh::axis
-
- This property defines the axis that the sphere lies along.
- The default is Qt.ZAxis. The other supported values are
- Qt.XAxis and Qt.YAxis. This provides a simple method to
- orient the sphere in the desired direction.
-*/
-Qt::Axis SphereMesh::axis() const
-{
- Q_D(const SphereMesh);
- return d->axis;
-}
-
-void SphereMesh::setAxis(Qt::Axis axis)
-{
- Q_D(SphereMesh);
- if (d->axis != axis)
- {
- d->axis = axis;
- createGeometry();
- emit axisChanged();
- emit dataChanged();
- }
-}
-
-/*!
- \internal
-*/
-void SphereMesh::draw(QGLPainter *painter, int branchId)
-{
- Q_D(SphereMesh);
- if (!d->currentSphere)
- createGeometry();
- QDeclarativeMesh::draw(painter, branchId);
-}
-
-/*!
- \internal
-*/
-void SphereMesh::createGeometry()
-{
- Q_D(SphereMesh);
-
- // We cache a maximum of 10 levels of detail for lod animations.
- // Create a new geometry node for this level of detail if necessary.
- QGLSceneNode *geometry = d->lodGeometry.value(d->lod, 0);
- if (!geometry) {
- QGLBuilder builder;
- builder.newSection(QGL::Faceted);
- builder << QGLSphere(2.0f, d->lod);
- geometry = builder.finalizedSceneNode();
- geometry->setParent(this);
- d->lodGeometry.insert(d->lod, geometry);
- }
- Q_ASSERT_X(geometry != 0, Q_FUNC_INFO, "Could not create/find geometry!");
- if (d->currentSphere != geometry)
- {
- if (d->currentSphere)
- d->topNode->removeNode(d->currentSphere);
- d->topNode->addNode(geometry);
- d->currentSphere = geometry;
- }
-
- // Set the radius as a scale on the modelview transformation.
- // This way, we don't have to regenerate the geometry every
- // frame if the radius is being animated.
- if (d->radius != 1.0f)
- {
- if (!d->scale)
- {
- d->scale = new QGraphicsScale3D(d->topNode);
- d->topNode->addTransform(d->scale);
- }
- if (d->scale->scale().x() != d->radius)
- {
- d->scale->setScale(QVector3D(d->radius, d->radius, d->radius));
- }
- }
- else
- {
- // If there is already a scale set it to be the identity scale.
- // This case is optimised for in QGraphicsScale. Removing it from
- // the transform list is too expensive, especially if the size is
- // being animated, and the next frame will recreate it.
- if (d->scale)
- d->scale->setScale(QVector3D(1, 1, 1));
- }
-
- // Also rotate the geometry into the correct axis orientation.
- const QVector3D Y_AXIS = QVector3D(0, 1, 0); // for Qt::XAxis we rotate around Y
- const QVector3D X_AXIS = QVector3D(1, 0, 0); // for Qt::YAxis we rotate around X
- if (d->axis != Qt::ZAxis && !d->rot)
- {
- d->rot = new QGraphicsRotation3D(d->topNode);
- d->topNode->addTransform(d->rot);
- }
- if (d->axis == Qt::XAxis && d->rot->axis().y() != Y_AXIS.y())
- {
- d->rot->setAxis(Y_AXIS);
- d->rot->setAngle(90.0f);
- }
- else if (d->axis == Qt::YAxis && d->rot->axis().x() != X_AXIS.x())
- {
- d->rot->setAxis(X_AXIS);
- d->rot->setAngle(-90.0f);
- }
- else if (d->axis == Qt::ZAxis && d->rot && d->rot->angle() != 0.0f)
- {
- d->rot->setAngle(0.0f);
- d->rot->setAxis(QVector3D(0, 0, 0));
- }
-
- if (!d->sceneSet)
- {
- setScene(new SphereScene(d->topNode));
- d->sceneSet = true;
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/imports/shapes/spheremesh.h b/src/imports/shapes/spheremesh.h
deleted file mode 100644
index b4e2b4f0..00000000
--- a/src/imports/shapes/spheremesh.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPHEREMESH_H
-#define SPHEREMESH_H
-
-#include "qglscenenode.h"
-#include "qdeclarativemesh.h"
-#include "spheremesh_p.h"
-
-#include <QtCore/qmap.h>
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class SpherePrivate;
-
-class SphereMesh : public QDeclarativeMesh
-{
- Q_OBJECT
- Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
- Q_PROPERTY(int levelOfDetail READ levelOfDetail WRITE setLevelOfDetail NOTIFY levelOfDetailChanged)
- Q_PROPERTY(Qt::Axis axis READ axis WRITE setAxis NOTIFY axisChanged)
-public:
- SphereMesh(QObject *parent = 0);
- ~SphereMesh() {}
-
- qreal radius() const;
- void setRadius(qreal radius);
-
- int levelOfDetail() const;
- void setLevelOfDetail(int lod);
-
- Qt::Axis axis() const;
- void setAxis(Qt::Axis axis);
-
- void draw(QGLPainter *painter, int branchId);
-
-Q_SIGNALS:
- void radiusChanged();
- void levelOfDetailChanged();
- void axisChanged();
-
-private:
- void createGeometry();
-
- Q_DISABLE_COPY(SphereMesh)
- Q_DECLARE_PRIVATE(SphereMesh)
-
- QScopedPointer<SphereMeshPrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(SphereMesh)
-
-QT_END_HEADER
-
-#endif // SPHEREMESH_H
diff --git a/src/imports/shapes/spheremesh_p.h b/src/imports/shapes/spheremesh_p.h
deleted file mode 100644
index 3d407421..00000000
--- a/src/imports/shapes/spheremesh_p.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPHEREMESH_P_H
-#define SPHEREMESH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QMap>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsRotation3D;
-class QGraphicsScale3D;
-class QGLSceneNode;
-
-class SphereMeshPrivate
-{
-public:
- SphereMeshPrivate();
- ~SphereMeshPrivate();
-
- QMap<int, QGLSceneNode *> lodGeometry;
- QGLSceneNode *topNode;
- QGLSceneNode *currentSphere;
- QGraphicsRotation3D *rot;
- QGraphicsScale3D *scale;
- qreal radius;
- int lod;
- Qt::Axis axis;
- bool sceneSet;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // SPHEREMESH_P_H
diff --git a/src/imports/shapes/teapot.bez b/src/imports/shapes/teapot.bez
deleted file mode 100644
index 02b2ac44..00000000
--- a/src/imports/shapes/teapot.bez
+++ /dev/null
@@ -1,340 +0,0 @@
-32
-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
-4,17,18,19,8,20,21,22,12,23,24,25,16,26,27,28
-19,29,30,31,22,32,33,34,25,35,36,37,28,38,39,40
-31,41,42,1,34,43,44,5,37,45,46,9,40,47,48,13
-13,14,15,16,49,50,51,52,53,54,55,56,57,58,59,60
-16,26,27,28,52,61,62,63,56,64,65,66,60,67,68,69
-28,38,39,40,63,70,71,72,66,73,74,75,69,76,77,78
-40,47,48,13,72,79,80,49,75,81,82,53,78,83,84,57
-57,58,59,60,85,86,87,88,89,90,91,92,93,94,95,96
-60,67,68,69,88,97,98,99,92,100,101,102,96,103,104,105
-69,76,77,78,99,106,107,108,102,109,110,111,105,112,113,114
-78,83,84,57,108,115,116,85,111,117,118,89,114,119,120,93
-121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136
-124,137,138,121,128,139,140,125,132,141,142,129,136,143,144,133
-133,134,135,136,145,146,147,148,149,150,151,152,69,153,154,155
-136,143,144,133,148,156,157,145,152,158,159,149,155,160,161,69
-162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177
-165,178,179,162,169,180,181,166,173,182,183,170,177,184,185,174
-174,175,176,177,186,187,188,189,190,191,192,193,194,195,196,197
-177,184,185,174,189,198,199,186,193,200,201,190,197,202,203,194
-204,204,204,204,207,208,209,210,211,211,211,211,212,213,214,215,4
-204,204,204,204,210,217,218,219,211,211,211,211,215,220,221,222,4
-204,204,204,204,219,224,225,226,211,211,211,211,222,227,228,229,4
-204,204,204,204,226,230,231,207,211,211,211,211,229,232,233,212,4
-212,213,214,215,234,235,236,237,238,239,240,241,242,243,244,245
-215,220,221,222,237,246,247,248,241,249,250,251,245,252,253,254
-222,227,228,229,248,255,256,257,251,258,259,260,254,261,262,263
-229,232,233,212,257,264,265,234,260,266,267,238,263,268,269,242
-270,270,270,270,279,280,281,282,275,276,277,278,271,272,273,274,4
-270,270,270,270,282,289,290,291,278,286,287,288,274,283,284,285,4
-270,270,270,270,291,298,299,300,288,295,296,297,285,292,293,294,4
-270,270,270,270,300,305,306,279,297,303,304,275,294,301,302,271,4
-306
-0.700000,0.450000,-0.000000
-0.700000,0.450000,0.392000
-0.392000,0.450000,0.700000
-0.000000,0.450000,0.700000
-0.668750,0.515625,-0.000000
-0.668750,0.515625,0.374500
-0.374500,0.515625,0.668750
-0.000000,0.515625,0.668750
-0.718750,0.515625,-0.000000
-0.718750,0.515625,0.402500
-0.402500,0.515625,0.718750
-0.000000,0.515625,0.718750
-0.750000,0.450000,-0.000000
-0.750000,0.450000,0.420000
-0.420000,0.450000,0.750000
-0.000000,0.450000,0.750000
--0.392000,0.450000,0.700000
--0.700000,0.450000,0.392000
--0.700000,0.450000,-0.000000
--0.374500,0.515625,0.668750
--0.668750,0.515625,0.374500
--0.668750,0.515625,-0.000000
--0.402500,0.515625,0.718750
--0.718750,0.515625,0.402500
--0.718750,0.515625,-0.000000
--0.420000,0.450000,0.750000
--0.750000,0.450000,0.420000
--0.750000,0.450000,-0.000000
--0.700000,0.450000,-0.392000
--0.392000,0.450000,-0.700000
-0.000000,0.450000,-0.700000
--0.668750,0.515625,-0.374500
--0.374500,0.515625,-0.668750
-0.000000,0.515625,-0.668750
--0.718750,0.515625,-0.402500
--0.402500,0.515625,-0.718750
-0.000000,0.515625,-0.718750
--0.750000,0.450000,-0.420000
--0.420000,0.450000,-0.750000
-0.000000,0.450000,-0.750000
-0.392000,0.450000,-0.700000
-0.700000,0.450000,-0.392000
-0.374500,0.515625,-0.668750
-0.668750,0.515625,-0.374500
-0.402500,0.515625,-0.718750
-0.718750,0.515625,-0.402500
-0.420000,0.450000,-0.750000
-0.750000,0.450000,-0.420000
-0.875000,0.187500,-0.000000
-0.875000,0.187500,0.490000
-0.490000,0.187500,0.875000
-0.000000,0.187500,0.875000
-1.000000,-0.075000,-0.000000
-1.000000,-0.075000,0.560000
-0.560000,-0.075000,1.000000
-0.000000,-0.075000,1.000000
-1.000000,-0.300000,-0.000000
-1.000000,-0.300000,0.560000
-0.560000,-0.300000,1.000000
-0.000000,-0.300000,1.000000
--0.490000,0.187500,0.875000
--0.875000,0.187500,0.490000
--0.875000,0.187500,-0.000000
--0.560000,-0.075000,1.000000
--1.000000,-0.075000,0.560000
--1.000000,-0.075000,-0.000000
--0.560000,-0.300000,1.000000
--1.000000,-0.300000,0.560000
--1.000000,-0.300000,-0.000000
--0.875000,0.187500,-0.490000
--0.490000,0.187500,-0.875000
-0.000000,0.187500,-0.875000
--1.000000,-0.075000,-0.560000
--0.560000,-0.075000,-1.000000
-0.000000,-0.075000,-1.000000
--1.000000,-0.300000,-0.560000
--0.560000,-0.300000,-1.000000
-0.000000,-0.300000,-1.000000
-0.490000,0.187500,-0.875000
-0.875000,0.187500,-0.490000
-0.560000,-0.075000,-1.000000
-1.000000,-0.075000,-0.560000
-0.560000,-0.300000,-1.000000
-1.000000,-0.300000,-0.560000
-1.000000,-0.525000,-0.000000
-1.000000,-0.525000,0.560000
-0.560000,-0.525000,1.000000
-0.000000,-0.525000,1.000000
-0.750000,-0.637500,-0.000000
-0.750000,-0.637500,0.420000
-0.420000,-0.637500,0.750000
-0.000000,-0.637500,0.750000
-0.750000,-0.675000,-0.000000
-0.750000,-0.675000,0.420000
-0.420000,-0.675000,0.750000
-0.000000,-0.675000,0.750000
--0.560000,-0.525000,1.000000
--1.000000,-0.525000,0.560000
--1.000000,-0.525000,-0.000000
--0.420000,-0.637500,0.750000
--0.750000,-0.637500,0.420000
--0.750000,-0.637500,-0.000000
--0.420000,-0.675000,0.750000
--0.750000,-0.675000,0.420000
--0.750000,-0.675000,-0.000000
--1.000000,-0.525000,-0.560000
--0.560000,-0.525000,-1.000000
-0.000000,-0.525000,-1.000000
--0.750000,-0.637500,-0.420000
--0.420000,-0.637500,-0.750000
-0.000000,-0.637500,-0.750000
--0.750000,-0.675000,-0.420000
--0.420000,-0.675000,-0.750000
-0.000000,-0.675000,-0.750000
-0.560000,-0.525000,-1.000000
-1.000000,-0.525000,-0.560000
-0.420000,-0.637500,-0.750000
-0.750000,-0.637500,-0.420000
-0.420000,-0.675000,-0.750000
-0.750000,-0.675000,-0.420000
--0.800000,0.262500,-0.000000
--0.800000,0.262500,0.150000
--0.750000,0.375000,0.150000
--0.750000,0.375000,-0.000000
--1.150000,0.262500,-0.000000
--1.150000,0.262500,0.150000
--1.250000,0.375000,0.150000
--1.250000,0.375000,-0.000000
--1.350000,0.262500,-0.000000
--1.350000,0.262500,0.150000
--1.500000,0.375000,0.150000
--1.500000,0.375000,-0.000000
--1.350000,0.150000,-0.000000
--1.350000,0.150000,0.150000
--1.500000,0.150000,0.150000
--1.500000,0.150000,-0.000000
--0.750000,0.375000,-0.150000
--0.800000,0.262500,-0.150000
--1.250000,0.375000,-0.150000
--1.150000,0.262500,-0.150000
--1.500000,0.375000,-0.150000
--1.350000,0.262500,-0.150000
--1.500000,0.150000,-0.150000
--1.350000,0.150000,-0.150000
--1.350000,0.037500,-0.000000
--1.350000,0.037500,0.150000
--1.500000,-0.075000,0.150000
--1.500000,-0.075000,-0.000000
--1.250000,-0.187500,-0.000000
--1.250000,-0.187500,0.150000
--1.325000,-0.281250,0.150000
--1.325000,-0.281250,-0.000000
--1.000000,-0.300000,0.150000
--0.950000,-0.450000,0.150000
--0.950000,-0.450000,-0.000000
--1.500000,-0.075000,-0.150000
--1.350000,0.037500,-0.150000
--1.325000,-0.281250,-0.150000
--1.250000,-0.187500,-0.150000
--0.950000,-0.450000,-0.150000
--1.000000,-0.300000,-0.150000
-0.850000,-0.037500,-0.000000
-0.850000,-0.037500,0.330000
-0.850000,-0.450000,0.330000
-0.850000,-0.450000,-0.000000
-1.300000,-0.037500,-0.000000
-1.300000,-0.037500,0.330000
-1.550000,-0.337500,0.330000
-1.550000,-0.337500,-0.000000
-1.150000,0.300000,-0.000000
-1.150000,0.300000,0.125000
-1.200000,0.262500,0.125000
-1.200000,0.262500,-0.000000
-1.350000,0.450000,-0.000000
-1.350000,0.450000,0.125000
-1.650000,0.450000,0.125000
-1.650000,0.450000,-0.000000
-0.850000,-0.450000,-0.330000
-0.850000,-0.037500,-0.330000
-1.550000,-0.337500,-0.330000
-1.300000,-0.037500,-0.330000
-1.200000,0.262500,-0.125000
-1.150000,0.300000,-0.125000
-1.650000,0.450000,-0.125000
-1.350000,0.450000,-0.125000
-1.400000,0.487500,-0.000000
-1.400000,0.487500,0.125000
-1.762500,0.496875,0.125000
-1.762500,0.496875,-0.000000
-1.450000,0.487500,-0.000000
-1.450000,0.487500,0.075000
-1.725000,0.506250,0.075000
-1.725000,0.506250,-0.000000
-1.400000,0.450000,-0.000000
-1.400000,0.450000,0.075000
-1.600000,0.450000,0.075000
-1.600000,0.450000,-0.000000
-1.762500,0.496875,-0.125000
-1.400000,0.487500,-0.125000
-1.725000,0.506250,-0.075000
-1.450000,0.487500,-0.075000
-1.600000,0.450000,-0.075000
-1.400000,0.450000,-0.075000
-0.000000,0.825000,-0.000000
-0.000000,0.825000,0.001000
-0.001000,0.825000,-0.000000
-0.400000,0.825000,-0.000000
-0.400000,0.825000,0.225000
-0.225000,0.825000,0.400000
-0.000000,0.825000,0.400000
-0.000000,0.675000,-0.000000
-0.100000,0.600000,-0.000000
-0.100000,0.600000,0.056000
-0.056000,0.600000,0.100000
-0.000000,0.600000,0.100000
--0.001000,0.825000,-0.000000
--0.225000,0.825000,0.400000
--0.400000,0.825000,0.225000
--0.400000,0.825000,-0.000000
--0.056000,0.600000,0.100000
--0.100000,0.600000,0.056000
--0.100000,0.600000,-0.000000
-0.000000,0.825000,-0.001000
--0.400000,0.825000,-0.225000
--0.225000,0.825000,-0.400000
-0.000000,0.825000,-0.400000
--0.100000,0.600000,-0.056000
--0.056000,0.600000,-0.100000
-0.000000,0.600000,-0.100000
-0.225000,0.825000,-0.400000
-0.400000,0.825000,-0.225000
-0.056000,0.600000,-0.100000
-0.100000,0.600000,-0.056000
-0.200000,0.525000,-0.000000
-0.200000,0.525000,0.112000
-0.112000,0.525000,0.200000
-0.000000,0.525000,0.200000
-0.650000,0.525000,-0.000000
-0.650000,0.525000,0.364000
-0.364000,0.525000,0.650000
-0.000000,0.525000,0.650000
-0.650000,0.450000,-0.000000
-0.650000,0.450000,0.364000
-0.364000,0.450000,0.650000
-0.000000,0.450000,0.650000
--0.112000,0.525000,0.200000
--0.200000,0.525000,0.112000
--0.200000,0.525000,-0.000000
--0.364000,0.525000,0.650000
--0.650000,0.525000,0.364000
--0.650000,0.525000,-0.000000
--0.364000,0.450000,0.650000
--0.650000,0.450000,0.364000
--0.650000,0.450000,-0.000000
--0.200000,0.525000,-0.112000
--0.112000,0.525000,-0.200000
-0.000000,0.525000,-0.200000
--0.650000,0.525000,-0.364000
--0.364000,0.525000,-0.650000
-0.000000,0.525000,-0.650000
--0.650000,0.450000,-0.364000
--0.364000,0.450000,-0.650000
-0.000000,0.450000,-0.650000
-0.112000,0.525000,-0.200000
-0.200000,0.525000,-0.112000
-0.364000,0.525000,-0.650000
-0.650000,0.525000,-0.364000
-0.364000,0.450000,-0.650000
-0.650000,0.450000,-0.364000
-0.000000,-0.750000,-0.000000
-0.750000,-0.675000,-0.000000
-0.750000,-0.675000,-0.420000
-0.420000,-0.675000,-0.750000
-0.000000,-0.675000,-0.750000
-0.750000,-0.712500,-0.000000
-0.750000,-0.712500,-0.420000
-0.420000,-0.712500,-0.750000
-0.000000,-0.712500,-0.750000
-0.712500,-0.750000,-0.000000
-0.712500,-0.750000,-0.399000
-0.399000,-0.750000,-0.712500
-0.000000,-0.750000,-0.712500
--0.420000,-0.675000,-0.750000
--0.750000,-0.675000,-0.420000
--0.750000,-0.675000,-0.000000
--0.420000,-0.712500,-0.750000
--0.750000,-0.712500,-0.420000
--0.750000,-0.712500,-0.000000
--0.399000,-0.750000,-0.712500
--0.712500,-0.750000,-0.399000
--0.712500,-0.750000,-0.000000
--0.750000,-0.675000,0.420000
--0.420000,-0.675000,0.750000
-0.000000,-0.675000,0.750000
--0.750000,-0.712500,0.420000
--0.420000,-0.712500,0.750000
-0.000000,-0.712500,0.750000
--0.712500,-0.750000,0.399000
--0.399000,-0.750000,0.712500
-0.000000,-0.750000,0.712500
-0.420000,-0.675000,0.750000
-0.750000,-0.675000,0.420000
-0.420000,-0.712500,0.750000
-0.750000,-0.712500,0.420000
-0.399000,-0.750000,0.712500
-0.712500,-0.750000,0.399000
diff --git a/src/imports/shapes/teapot.h b/src/imports/shapes/teapot.h
deleted file mode 100644
index 90f7a95b..00000000
--- a/src/imports/shapes/teapot.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CUBE_H
-#define CUBE_H
-
-// This is a dummy header for defining the interface of "Teapot.qml" to qdoc.
-
-#include "qdeclarativeitem3d.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Teapot : public QDeclarativeItem3D
-{
- Q_OBJECT
-public:
- Teapot(QObject *parent = 0) : QDeclarativeItem3D(parent) {}
- ~Teapot() {}
-};
-
-QML_DECLARE_TYPE(Cube)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/shapes/teapot.qdoc b/src/imports/shapes/teapot.qdoc
deleted file mode 100644
index 8c6470f0..00000000
--- a/src/imports/shapes/teapot.qdoc
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \qmlclass Teapot Teapot
- \brief The Teapot item represents a stock teapot object.
- \since 4.8
- \ingroup qt3d::qml3d::shapes
- \inherits Item3D
-
- The Teapot element in QML provides a simple way to create a teapot
- object, usually for testing material effects and complex
- geometry. For example, the following QML code displays a teapot
- of size 1.5, centered on the origin and covered in the Qt logo
- texture:
-
- \code
- Teapot {
- scale: 1.5
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- decal: true
- }
- }
- \endcode
-
- \image teapot-qt-screenshot.png
-
- The Teapot element is part of the \c{Qt3D.Shapes} namespace,
- so the following must appear at the top of any QML file that
- references it:
-
- \code
- import Qt3D.Shapes 1.0
- \endcode
-
- The teapot can be moved from the origin by specifying the
- Item3D::position property:
-
- \code
- Teapot {
- scale: 1.5
- position: Qt.vector3d(1, 0, 5)
- effect: Effect {
- color: "#aaca00"
- texture: "qtlogo.png"
- decal: true
- }
- }
- \endcode
-
- \sa Item3D
-*/
diff --git a/src/imports/threed/DefaultNavigator.qml b/src/imports/threed/DefaultNavigator.qml
deleted file mode 100644
index 70b0ac6b..00000000
--- a/src/imports/threed/DefaultNavigator.qml
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "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 Nokia Corporation and its Subsidiary(-ies) 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."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import Qt3D 1.0
-
-// This is an example of how to implement a custom navigation strategy
-// to replace the default strategy implemented by "Viewport".
-
-MouseArea {
- // Set this property to the "Viewport" item to be controlled
- // by this navigator. By default we assume that it is our parent.
- property variant viewport: parent
-
- // The navigator fills the entire viewport.
- anchors.fill: viewport
-
- // Private variables.
- QtObject {
- id: d_ptr
- property bool panning: false
- property int startX: 0
- property int startY: 0
- property variant startEye
- property variant startCenter
- property variant startUpVector
- property variant pressedObject: null
- property variant enteredObject: null
- property bool sawDoubleClick: false
- }
-
- // Handle mouse press events.
- onPressed: {
- // Determine which object was pressed in the viewport.
- var objectUnderMouse;
- if (!d_ptr.panning && viewport.picking)
- objectUnderMouse = viewport.objectForPoint(mouse.x, mouse.y);
- else
- objectUnderMouse = null;
- if (d_ptr.pressedObject) {
- // We already have a pressed object, so nothing to do.
- mouse.accepted = true;
- } else if (Qt.isQtObject(objectUnderMouse)) {
- // Mouse press on a new object.
- d_ptr.pressedObject = objectUnderMouse;
- d_ptr.enteredObject = null;
- d_ptr.sawDoubleClick = false;
- objectUnderMouse.pressed();
- mouse.accepted = true;
- } else if (viewport.navigation && mouse.button == Qt.LeftButton) {
- // Start panning the view.
- d_ptr.panning = true;
- d_ptr.startX = mouse.x;
- d_ptr.startY = mouse.y;
- d_ptr.startEye = viewport.camera.eye;
- d_ptr.startCenter = viewport.camera.center;
- d_ptr.startUpVector = viewport.camera.upVector;
- mouse.accepted = true;
- }
- }
-
- // Handle mouse release events.
- onReleased: {
- if (d_ptr.panning && mouse.button == Qt.LeftButton) {
- d_ptr.panning = false;
- mouse.accepted = true;
- }
- if (d_ptr.pressedObject && mouse.button == Qt.LeftButton) {
- // Deliver the release event to the pressed object.
- var objectUnderMouse = viewport.objectForPoint(mouse.x, mouse.y);
- if (objectUnderMouse == d_ptr.pressedObject && !d_ptr.sawDoubleClick) {
- d_ptr.pressedObject.released();
- d_ptr.pressedObject.clicked();
- } else {
- d_ptr.pressedObject.released();
- }
- if (hoverEnabled) {
- if (Qt.isQtObject(objectUnderMouse))
- d_ptr.enteredObject = objectUnderMouse;
- else
- d_ptr.enteredObject = null;
- if (d_ptr.enteredObject != d_ptr.pressedObject) {
- d_ptr.pressedObject.hoverLeave();
- if (d_ptr.enteredObject)
- d_ptr.enteredObject.hoverEnter();
- }
- }
- d_ptr.pressedObject = null;
- mouse.accepted = true;
- }
- }
-
- // Handle mouse double click events.
- onDoubleClicked: {
- if (d_ptr.pressedObject) {
- var objectUnderMouse = viewport.objectForPoint(mouse.x, mouse.y);
- if (objectUnderMouse == d_ptr.pressedObject) {
- d_ptr.pressedObject.doubleClicked();
- d_ptr.sawDoubleClick = true;
- mouse.accepted = true;
- }
- }
- }
-
- // Handle mouse move events.
- onPositionChanged: {
- if (d_ptr.panning) {
- var deltaX = mouse.x - d_ptr.startX;
- var deltaY = mouse.y - d_ptr.startY;
- var angleAroundY = deltaX * 90 / width;
- var angleAroundX = deltaY * 90 / height;
-
- viewport.camera.eye = d_ptr.startEye;
- viewport.camera.center = d_ptr.startCenter;
- viewport.camera.upVector = d_ptr.startUpVector;
- viewport.camera.tiltPanRollCenter
- (-angleAroundX, -angleAroundY, 0, "TiltPanRoll");
- } else if (viewport.picking && hoverEnabled) {
- // Handle object enter/leave events when mouse hover is enabled.
- var objectUnderMouse = viewport.objectForPoint(mouse.x, mouse.y);
- if (!d_ptr.pressedObject) {
- if (Qt.isQtObject(objectUnderMouse)) {
- if (d_ptr.enteredObject != objectUnderMouse) {
- if (d_ptr.enteredObject)
- d_ptr.enteredObject.hoverLeave();
- d_ptr.enteredObject = objectUnderMouse;
- d_ptr.enteredObject.hoverEnter();
- }
- } else if (d_ptr.enteredObject) {
- d_ptr.enteredObject.hoverLeave();
- d_ptr.enteredObject = null;
- }
- }
- }
- }
-
- // Handle leave events.
- onExited: {
- if (hoverEnabled && !d_ptr.pressedObject && d_ptr.enteredObject) {
- d_ptr.enteredObject.hoverLeave();
- d_ptr.enteredObject = null;
- }
- }
-}
diff --git a/src/imports/threed/README.library_xml b/src/imports/threed/README.library_xml
deleted file mode 100644
index 0399d4ab..00000000
--- a/src/imports/threed/README.library_xml
+++ /dev/null
@@ -1,15 +0,0 @@
-The library.xml file is required to get syntax highlighting of Qt3D
-plugin items in Qt Creator < version 2.2.
-
-The library.xml file is installed into the imports/Qt3D tree along with
-the plugin and the qmldir file.
-
-When any of the elements - property names, class names or other exports
-- in the Qt3D plugin are changed this file will need to be regenerated.
-
-To generate the library.xml file see the scripts/README file for a
-description of how to use the filter-qmldump.pl script.
-
-This is a less-than-optimal solution but as syntax discovery improves
-in Qt Creator better solutions should become available at which time
-this temporary script and syntax file may be deprecated.
diff --git a/src/imports/threed/README.plugins_types b/src/imports/threed/README.plugins_types
deleted file mode 100755
index e78cd67e..00000000
--- a/src/imports/threed/README.plugins_types
+++ /dev/null
@@ -1,34 +0,0 @@
-The plugins.qmltypes file is required to get syntax highlighting of Qt3D
-plugin items inside Qt Creator 2.2 and later.
-
-To support earlier versions of Qt Creator the library.xml file is used.
-
-The plugins.qmltypes file is installed into the imports/Qt3D tree along
-with the plugin and the qmldir file.
-
-When any of the elements - property names, class names or other exports
-- in the Qt3D plugin are changed this file will need to be regenerated.
-
-To generate the plugins.qmltypes, you first need a qmldump binary generated from
-sources shipped with Qt Creator 2.2 or greater. On Mac these are inside the app
-bundle, other platforms vary. If all else fails get the sources from the Qt
-Creator repo.
-
-To build qmldump you need access to private headers, so therefore it must be
-built against a source build of Qt. On Mac it is helpful to build qmldump with
-"qmake CONFIG-=app_bundle" so that you get a regular command-line binary.
-
-Once you finally have a viable qmldump binary:
-
-./qmldump Qt3D 1.0 $QTDIR/imports > plugins.qmltypes
-
-...where $QTDIR points to the root of the Qt where Qt3D is installed.
-
-If you get a usage error like:
-
-Usage: qmldump [plugin/import/path plugin.uri]
-
-...then the version of qmldump source you used was not for Qt Creator > 2.2 -
-you somehow have the earlier version qmldump sources.
-
-You do not need to use the filter-qmldump.pl script.
diff --git a/src/imports/threed/billboarditem3d.cpp b/src/imports/threed/billboarditem3d.cpp
deleted file mode 100644
index eb94d26f..00000000
--- a/src/imports/threed/billboarditem3d.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "billboarditem3d.h"
-#include "qgraphicsbillboardtransform.h"
-
-/*!
- \qmlclass BillboardItem3D BillboardItem3D
- \brief The BillboardItem3D will always face toward the viewer.
- \since 4.8
- \ingroup qt3d::qml3d
-
- Sometimes it is desirable to have objects which always face toward the
- camera. For example, a quad with text on it may always face the camera
- so as to be readable at all times.
-
- While this can be achieved with a QGraphicsLookAtTransform on a normal
- Item3D, the BillboardItem3D class provides a more efficient "cheat" which
- takes advantage of the underlying 3D mathematics.
-
- To use a BillboardItem3D declare it exactly like a regular Item3D. When
- the item is drawn a QGraphicsBillboardTransform will be applied to the item
- after all other transforms have been performed.
-
- For example:
-
- \code
- Viewport {
- BillboardItem3D {
- mesh: Mesh { source: "model.obj" }
- effect: Effect {
- blending: true
- texture: "texture.png"
- }
- }
- }
- \endcode
-
- For a practical illustration of its use see the forest example.
-*/
-BillboardItem3D::BillboardItem3D(QObject *parent)
- : QDeclarativeItem3D(parent)
-{
- m_preserveUpVector = false;
-}
-
-/*!
- \qmlproperty bool BillboardItem3D::preserveUpVector
-
- This property specifies whether the billboard transform should
- preserve the "up vector" so that objects stay at right angles
- to the ground plane in the scene.
-
- The default value for this property is false, which indicates that
- the object being transformed should always face directly to the camera
- This is also known as a "spherical billboard".
-
- If the value for this property is true, then the object will have
- its up orientation preserved. This is also known as a "cylindrical
- billboard".
-*/
-bool BillboardItem3D::preserveUpVector() const
-{
- return m_preserveUpVector;
-}
-
-void BillboardItem3D::setPreserveUpVector(bool value)
-{
- m_preserveUpVector = value;
- update();
-}
-
-/*!
- \internal
- This replaces the standard draw() as used in Item3D. In this instance all drawing
- carried out using \a painter follows the standard sequence. However, after the
- transforms for the item have been applied, a QGraphicsBillboardTransform is applied
- to the model-view matrix.
-
- After the current item is drawn the model-view matrix from immediately before the
- billboard transform being applied will be restored so child items are not affected by it.
-*/
-void BillboardItem3D::draw(QGLPainter *painter)
-{
- // Bail out if this item and its children have been disabled.
- if (!isEnabled())
- return;
- if (!isInitialized())
- initialize(painter);
-
- //Setup picking
- int prevId = painter->objectPickId();
- painter->setObjectPickId(objectPickId());
-
- //Setup effect (lighting, culling, effects etc)
- const QGLLightParameters *currentLight = 0;
- QMatrix4x4 currentLightTransform;
- drawLightingSetup(painter, currentLight, currentLightTransform);
- bool viewportBlend, effectBlend;
- drawEffectSetup(painter, viewportBlend, effectBlend);
- drawCullSetup();
-
- //Local and Global transforms
- drawTransformSetup(painter);
-
- //After all of the other transforms, apply the billboard transform to
- //ensure forward facing.
- painter->modelViewMatrix().push();
- QGraphicsBillboardTransform bill;
- bill.setPreserveUpVector(m_preserveUpVector);
- bill.applyTo(const_cast<QMatrix4x4 *>(&painter->modelViewMatrix().top()));
-
- //Drawing
- drawItem(painter);
-
- //Pop the billboard transform from the model-view matrix stack so that it
- //is not applied to child items.
- painter->modelViewMatrix().pop();
-
- //Draw children
- drawChildren(painter);
-
- //Cleanup
- drawTransformCleanup(painter);
- drawLightingCleanup(painter, currentLight, currentLightTransform);
- drawEffectCleanup(painter, viewportBlend, effectBlend);
- drawCullCleanup();
-
- //Reset pick id.
- painter->setObjectPickId(prevId);
-}
-
diff --git a/src/imports/threed/billboarditem3d.h b/src/imports/threed/billboarditem3d.h
deleted file mode 100644
index d60b75fa..00000000
--- a/src/imports/threed/billboarditem3d.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef BILLBOARDITEM3D_H
-#define BILLBOARDITEM3D_H
-
-#include "qdeclarativeitem3d.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class BillboardItem3D : public QDeclarativeItem3D
-{
- Q_OBJECT
- Q_PROPERTY(bool preserveUpVector READ preserveUpVector WRITE setPreserveUpVector)
-public:
- BillboardItem3D(QObject *parent = 0);
-
- bool preserveUpVector() const;
- void setPreserveUpVector(bool value);
-
- void draw(QGLPainter *painter);
-
-private:
- bool m_preserveUpVector;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(BillboardItem3D)
-
-QT_END_HEADER
-
-#endif // BILLBOARDITEM3D_H
diff --git a/src/imports/threed/library.xml b/src/imports/threed/library.xml
deleted file mode 100644
index 8ed2c343..00000000
--- a/src/imports/threed/library.xml
+++ /dev/null
@@ -1,379 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module>
- <type name="QDeclarativeEffect" extends="QObject">
- <exports>
- <export module="Qt3D" version="1.0" type="Effect" />
- </exports>
- <property name="color" type="QColor" />
- <property name="useLighting" type="bool" />
- <property name="decal" type="bool" />
- <property name="blending" type="bool" />
- <property name="texture" type="QUrl" />
- <property name="textureImage" type="QImage" />
- <property name="material" type="QGLMaterial" />
- <property name="progress" type="qreal" />
- <signal name="effectChanged" />
- <signal name="progressChanged">
- <param name="progress" type="qreal" />
- </signal>
- </type>
- <type name="QDeclarativeItem3D" defaultProperty="data" extends="QDeclarativeItem">
- <exports>
- <export module="Qt3D" version="1.0" type="Item3D" />
- </exports>
- <enum name="CullFace">
- <enumerator name="CullDisabled" value="0" />
- <enumerator name="CullFrontFaces" value="1028" />
- <enumerator name="CullBackFaces" value="1029" />
- <enumerator name="CullAllFaces" value="1032" />
- <enumerator name="CullClockwise" value="65536" />
- </enum>
- <enum name="CullFaces">
- <enumerator name="CullDisabled" value="0" />
- <enumerator name="CullFrontFaces" value="1028" />
- <enumerator name="CullBackFaces" value="1029" />
- <enumerator name="CullAllFaces" value="1032" />
- <enumerator name="CullClockwise" value="65536" />
- </enum>
- <enum name="SortMode">
- <enumerator name="DefaultSorting" value="0" />
- <enumerator name="BackToFront" value="1" />
- </enum>
- <property name="position" type="QVector3D" />
- <property name="x" type="qreal" />
- <property name="y" type="qreal" />
- <property name="z" type="qreal" />
- <property name="scale" type="qreal" />
- <property name="transform" type="QGraphicsTransform3D" isList="true" />
- <property name="pretransform" type="QGraphicsTransform3D" isList="true" />
- <property name="mesh" type="QDeclarativeMesh" />
- <property name="effect" type="QDeclarativeEffect" />
- <property name="light" type="QGLLightParameters" />
- <property name="resources" type="QObject" isList="true" />
- <property name="data" type="QObject" isList="true" />
- <property name="children" type="QDeclarativeItem3D" isList="true" />
- <property name="cullFaces" type="CullFaces" />
- <property name="sortChildren" type="SortMode" />
- <property name="meshNode" type="string" />
- <property name="inheritEvents" type="bool" />
- <property name="enabled" type="bool" />
- <property name="parent" type="QDeclarativeItem3D" />
- <signal name="positionChanged" />
- <signal name="scaleChanged" />
- <signal name="rotationChanged" />
- <signal name="meshChanged" />
- <signal name="meshNodeChanged" />
- <signal name="effectChanged" />
- <signal name="lightChanged" />
- <signal name="stateChanged">
- <param type="string" />
- </signal>
- <signal name="clicked" />
- <signal name="doubleClicked" />
- <signal name="pressed" />
- <signal name="released" />
- <signal name="hoverEnter" />
- <signal name="hoverLeave" />
- <signal name="inheritEventsChanged" />
- <signal name="enabledChanged" />
- <signal name="childrenChanged" />
- <signal name="parentChanged" />
- <signal name="sortChildrenChanged" />
- <method name="update" />
- <method name="localToWorld" type="QVector3D">
- <param name="point" type="QVector3D" />
- </method>
- <method name="localToWorld" type="QVector3D" />
- <method name="worldToLocal" type="QVector3D">
- <param name="point" type="QVector3D" />
- </method>
- <method name="worldToLocal" type="QVector3D" />
- </type>
- <type name="QDeclarativeMesh" extends="QObject">
- <exports>
- <export module="Qt3D" version="1.0" type="Mesh" />
- </exports>
- <property name="source" type="QUrl" />
- <property name="meshName" type="string" />
- <property name="options" type="string" />
- <property name="dumpInfo" type="bool" />
- <signal name="dataChanged" />
- <signal name="loaded" />
- <signal name="optionsChanged" />
- <signal name="dumpInfoChanged" />
- <method name="material" type="QObject*">
- <param name="nodeName" type="string" />
- <param name="materialName" type="string" />
- </method>
- </type>
- <type name="QGLCamera" extends="QObject">
- <exports>
- <export module="Qt3D" version="1.0" type="Camera" />
- </exports>
- <enum name="ProjectionType">
- <enumerator name="Perspective" value="0" />
- <enumerator name="Orthographic" value="1" />
- </enum>
- <enum name="RotateOrder">
- <enumerator name="TiltPanRoll" value="0" />
- <enumerator name="TiltRollPan" value="1" />
- <enumerator name="PanTiltRoll" value="2" />
- <enumerator name="PanRollTilt" value="3" />
- <enumerator name="RollTiltPan" value="4" />
- <enumerator name="RollPanTilt" value="5" />
- </enum>
- <property name="projectionType" type="ProjectionType" />
- <property name="fieldOfView" type="qreal" />
- <property name="nearPlane" type="qreal" />
- <property name="farPlane" type="qreal" />
- <property name="viewSize" type="QSizeF" />
- <property name="minViewSize" type="QSizeF" />
- <property name="screenRotation" type="int" />
- <property name="eye" type="QVector3D" />
- <property name="upVector" type="QVector3D" />
- <property name="center" type="QVector3D" />
- <property name="eyeSeparation" type="qreal" />
- <property name="motionAdjustment" type="QVector3D" />
- <property name="adjustForAspectRatio" type="bool" />
- <signal name="projectionChanged" />
- <signal name="viewChanged" />
- <method name="translateEye">
- <param name="x" type="qreal" />
- <param name="y" type="qreal" />
- <param name="z" type="qreal" />
- </method>
- <method name="translateCenter">
- <param name="x" type="qreal" />
- <param name="y" type="qreal" />
- <param name="z" type="qreal" />
- </method>
- <method name="tiltPanRollCenter">
- <param name="tiltAngle" type="qreal" />
- <param name="panAngle" type="qreal" />
- <param name="rollAngle" type="qreal" />
- <param name="order" type="QGLCamera.RotateOrder" />
- </method>
- <method name="tiltPanRollCenter">
- <param name="tiltAngle" type="qreal" />
- <param name="panAngle" type="qreal" />
- <param name="rollAngle" type="qreal" />
- </method>
- <method name="tiltPanRollEye">
- <param name="tiltAngle" type="qreal" />
- <param name="panAngle" type="qreal" />
- <param name="rollAngle" type="qreal" />
- <param name="order" type="QGLCamera.RotateOrder" />
- </method>
- <method name="tiltPanRollEye">
- <param name="tiltAngle" type="qreal" />
- <param name="panAngle" type="qreal" />
- <param name="rollAngle" type="qreal" />
- </method>
- </type>
- <type name="QGLLightModel" extends="QObject">
- <exports>
- <export module="Qt3D" version="1.0" type="LightModel" />
- </exports>
- <enum name="Model">
- <enumerator name="OneSided" value="0" />
- <enumerator name="TwoSided" value="1" />
- </enum>
- <enum name="ColorControl">
- <enumerator name="SingleColor" value="0" />
- <enumerator name="SeparateSpecularColor" value="1" />
- </enum>
- <enum name="ViewerPosition">
- <enumerator name="ViewerAtInfinity" value="0" />
- <enumerator name="LocalViewer" value="1" />
- </enum>
- <property name="model" type="Model" />
- <property name="colorControl" type="ColorControl" />
- <property name="viewerPosition" type="ViewerPosition" />
- <property name="ambientSceneColor" type="QColor" />
- <signal name="modelChanged" />
- <signal name="colorControlChanged" />
- <signal name="viewerPositionChanged" />
- <signal name="ambientSceneColorChanged" />
- <signal name="lightModelChanged" />
- </type>
- <type name="QGLLightParameters" extends="QObject">
- <exports>
- <export module="Qt3D" version="1.0" type="Light" />
- </exports>
- <enum name="LightType">
- <enumerator name="Directional" value="0" />
- <enumerator name="Positional" value="1" />
- </enum>
- <property name="type" type="LightType" />
- <property name="position" type="QVector3D" />
- <property name="direction" type="QVector3D" />
- <property name="ambientColor" type="QColor" />
- <property name="diffuseColor" type="QColor" />
- <property name="specularColor" type="QColor" />
- <property name="spotDirection" type="QVector3D" />
- <property name="spotExponent" type="qreal" />
- <property name="spotAngle" type="qreal" />
- <property name="constantAttenuation" type="qreal" />
- <property name="linearAttenuation" type="qreal" />
- <property name="quadraticAttenuation" type="qreal" />
- <signal name="positionChanged" />
- <signal name="directionChanged" />
- <signal name="ambientColorChanged" />
- <signal name="diffuseColorChanged" />
- <signal name="specularColorChanged" />
- <signal name="spotDirectionChanged" />
- <signal name="spotExponentChanged" />
- <signal name="spotAngleChanged" />
- <signal name="constantAttenuationChanged" />
- <signal name="linearAttenuationChanged" />
- <signal name="quadraticAttenuationChanged" />
- <signal name="lightChanged" />
- </type>
- <type name="QGLMaterial" extends="QGLAbstractMaterial">
- <exports>
- <export module="Qt3D" version="1.0" type="Material" />
- </exports>
- <enum name="TextureCombineMode">
- <enumerator name="Modulate" value="0" />
- <enumerator name="Decal" value="1" />
- <enumerator name="Replace" value="2" />
- </enum>
- <property name="ambientColor" type="QColor" />
- <property name="diffuseColor" type="QColor" />
- <property name="specularColor" type="QColor" />
- <property name="emittedLight" type="QColor" />
- <property name="shininess" type="qreal" />
- <property name="texture" type="QGLTexture2D" />
- <property name="textureCombineMode" type="QGLMaterial.TextureCombineMode" />
- <property name="textureUrl" type="QUrl" />
- <signal name="ambientColorChanged" />
- <signal name="diffuseColorChanged" />
- <signal name="specularColorChanged" />
- <signal name="emittedLightChanged" />
- <signal name="shininessChanged" />
- <signal name="texturesChanged" />
- </type>
- <type name="QGLSceneNode" extends="QObject">
- <exports>
- <export module="Qt3D" version="1.0" type="SceneNode" />
- </exports>
- <property name="position" type="QVector3D" />
- <property name="x" type="qreal" />
- <property name="y" type="qreal" />
- <property name="z" type="qreal" />
- <property name="material" type="QGLMaterial" />
- <property name="backMaterial" type="QGLMaterial" />
- <signal name="updated" />
- <method name="clone" type="QGLSceneNode*">
- <param name="parent" type="QObject" />
- </method>
- <method name="clone" type="QGLSceneNode*" />
- <method name="cloneNoChildren" type="QGLSceneNode*">
- <param name="parent" type="QObject" />
- </method>
- <method name="cloneNoChildren" type="QGLSceneNode*" />
- <method name="allExcept" type="QGLSceneNode*">
- <param name="name" type="string" />
- <param name="parent" type="QObject" />
- </method>
- <method name="allExcept" type="QGLSceneNode*">
- <param name="name" type="string" />
- </method>
- <method name="only" type="QGLSceneNode*">
- <param name="name" type="string" />
- <param name="parent" type="QObject" />
- </method>
- <method name="only" type="QGLSceneNode*">
- <param name="name" type="string" />
- </method>
- <method name="allExcept" type="QGLSceneNode*">
- <param name="names" type="QStringList" />
- <param name="parent" type="QObject" />
- </method>
- <method name="allExcept" type="QGLSceneNode*">
- <param name="names" type="QStringList" />
- </method>
- <method name="only" type="QGLSceneNode*">
- <param name="names" type="QStringList" />
- <param name="parent" type="QObject" />
- </method>
- <method name="only" type="QGLSceneNode*">
- <param name="names" type="QStringList" />
- </method>
- </type>
- <type name="QGraphicsBillboardTransform" extends="QGraphicsTransform3D">
- <exports>
- <export module="Qt3D" version="1.0" type="BillboardTransform" />
- </exports>
- <property name="preserveUpVector" type="bool" />
- <signal name="preserveUpVectorChanged" />
- </type>
- <type name="QGraphicsLookAtTransform" extends="QGraphicsTransform3D">
- <exports>
- <export module="Qt3D" version="1.0" type="LookAt" />
- </exports>
- <property name="preserveUpVector" type="bool" />
- <property name="subject" type="QDeclarativeItem3D" />
- <signal name="preserveUpVectorChanged" />
- <signal name="subjectChanged" />
- </type>
- <type name="QGraphicsRotation3D" extends="QGraphicsTransform3D">
- <exports>
- <export module="Qt3D" version="1.0" type="Rotation3D" />
- </exports>
- <property name="origin" type="QVector3D" />
- <property name="angle" type="qreal" />
- <property name="axis" type="QVector3D" />
- <signal name="originChanged" />
- <signal name="angleChanged" />
- <signal name="axisChanged" />
- </type>
- <type name="QGraphicsTranslation3D" extends="QGraphicsTransform3D">
- <exports>
- <export module="Qt3D" version="1.0" type="Translation3D" />
- </exports>
- <property name="translate" type="QVector3D" />
- <property name="progress" type="qreal" />
- <signal name="translateChanged" />
- <signal name="progressChanged" />
- </type>
- <type name="Scale3D" extends="QGraphicsScale3D">
- <exports>
- <export module="Qt3D" version="1.0" type="Scale3D" />
- </exports>
- <property name="scale" type="QVariant" />
- <signal name="variantScaleChanged" />
- </type>
- <type name="ShaderProgram" extends="QDeclarativeEffect">
- <exports>
- <export module="Qt3D" version="1.0" type="ShaderProgram" />
- </exports>
- <property name="vertexShader" type="string" />
- <property name="fragmentShader" type="string" />
- <signal name="finishedLoading" />
- <signal name="shaderChanged" />
- <method name="markAllPropertiesDirty" />
- <method name="markPropertyDirty">
- <param name="property" type="int" />
- </method>
- </type>
- <type name="Viewport" defaultProperty="data" extends="QDeclarativeItem">
- <exports>
- <export module="Qt3D" version="1.0" type="Viewport" />
- </exports>
- <property name="picking" type="bool" />
- <property name="showPicking" type="bool" />
- <property name="navigation" type="bool" />
- <property name="fovzoom" type="bool" />
- <property name="blending" type="bool" />
- <property name="camera" type="QGLCamera" />
- <property name="light" type="QGLLightParameters" />
- <property name="lightModel" type="QGLLightModel" />
- <signal name="viewportChanged" />
- <method name="update3d" />
- <method name="objectForPoint" type="QObject*">
- <param name="x" type="qreal" />
- <param name="y" type="qreal" />
- </method>
- </type>
-</module>
diff --git a/src/imports/threed/plugins.qmltypes b/src/imports/threed/plugins.qmltypes
deleted file mode 100755
index 477bb4a9..00000000
--- a/src/imports/threed/plugins.qmltypes
+++ /dev/null
@@ -1,499 +0,0 @@
-import QtQuick.tooling 1.0
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-
-Module {
- Component {
- name: "QDeclarativeEffect"
- prototype: "QObject"
- exports: [
- "Effect 1.0"
- ]
- Property { name: "color"; type: "QColor" }
- Property { name: "useLighting"; type: "bool" }
- Property { name: "decal"; type: "bool" }
- Property { name: "blending"; type: "bool" }
- Property { name: "texture"; type: "QUrl" }
- Property { name: "textureImage"; type: "QImage" }
- Property { name: "material"; type: "QGLMaterial"; isPointer: true }
- Property { name: "progress"; type: "qreal"; isReadonly: true }
- Signal { name: "effectChanged" }
- Signal {
- name: "progressChanged"
- Parameter { name: "progress"; type: "qreal" }
- }
- }
- Component {
- name: "QDeclarativeItem3D"
- defaultProperty: "data"
- prototype: "QDeclarativeItem"
- exports: [
- "Item3D 1.0"
- ]
- Enum {
- name: "CullFace"
- values: {
- "CullDisabled": 0,
- "CullFrontFaces": 1028,
- "CullBackFaces": 1029,
- "CullAllFaces": 1032,
- "CullClockwise": 65536
- }
- }
- Enum {
- name: "CullFaces"
- values: {
- "CullDisabled": 0,
- "CullFrontFaces": 1028,
- "CullBackFaces": 1029,
- "CullAllFaces": 1032,
- "CullClockwise": 65536
- }
- }
- Enum {
- name: "SortMode"
- values: {
- "DefaultSorting": 0,
- "BackToFront": 1
- }
- }
- Property { name: "position"; type: "QVector3D" }
- Property { name: "x"; type: "qreal" }
- Property { name: "y"; type: "qreal" }
- Property { name: "z"; type: "qreal" }
- Property { name: "scale"; type: "qreal" }
- Property { name: "transform"; type: "QGraphicsTransform3D"; isList: true; isReadonly: true }
- Property { name: "pretransform"; type: "QGraphicsTransform3D"; isList: true; isReadonly: true }
- Property { name: "mesh"; type: "QDeclarativeMesh"; isPointer: true }
- Property { name: "effect"; type: "QDeclarativeEffect"; isPointer: true }
- Property { name: "light"; type: "QGLLightParameters"; isPointer: true }
- Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "children"; type: "QDeclarativeItem3D"; isList: true; isReadonly: true }
- Property { name: "cullFaces"; type: "CullFaces" }
- Property { name: "sortChildren"; type: "SortMode" }
- Property { name: "meshNode"; type: "string" }
- Property { name: "inheritEvents"; type: "bool" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "parent"; type: "QDeclarativeItem3D"; isPointer: true }
- Signal { name: "positionChanged" }
- Signal { name: "scaleChanged" }
- Signal { name: "rotationChanged" }
- Signal { name: "meshChanged" }
- Signal { name: "meshNodeChanged" }
- Signal { name: "effectChanged" }
- Signal { name: "lightChanged" }
- Signal {
- name: "stateChanged"
- Parameter { type: "string" }
- }
- Signal { name: "clicked" }
- Signal { name: "doubleClicked" }
- Signal { name: "pressed" }
- Signal { name: "released" }
- Signal { name: "hoverEnter" }
- Signal { name: "hoverLeave" }
- Signal { name: "inheritEventsChanged" }
- Signal { name: "enabledChanged" }
- Signal { name: "childrenChanged" }
- Signal { name: "parentChanged" }
- Signal { name: "sortChildrenChanged" }
- Method { name: "update" }
- Method {
- name: "localToWorld"
- type: "QVector3D"
- Parameter { name: "point"; type: "QVector3D" }
- }
- Method { name: "localToWorld"; type: "QVector3D" }
- Method {
- name: "worldToLocal"
- type: "QVector3D"
- Parameter { name: "point"; type: "QVector3D" }
- }
- Method { name: "worldToLocal"; type: "QVector3D" }
- }
- Component {
- name: "QDeclarativeMesh"
- prototype: "QObject"
- exports: [
- "Mesh 1.0"
- ]
- Property { name: "source"; type: "QUrl" }
- Property { name: "meshName"; type: "string" }
- Property { name: "options"; type: "string" }
- Property { name: "dumpInfo"; type: "bool" }
- Signal { name: "dataChanged" }
- Signal { name: "loaded" }
- Signal { name: "optionsChanged" }
- Signal { name: "dumpInfoChanged" }
- Method {
- name: "material"
- type: "QObject*"
- Parameter { name: "nodeName"; type: "string" }
- Parameter { name: "materialName"; type: "string" }
- }
- }
- Component {
- name: "QGLAbstractMaterial"
- prototype: "QObject"
- Signal { name: "materialChanged" }
- }
- Component {
- name: "QGLCamera"
- prototype: "QObject"
- exports: [
- "Camera 1.0"
- ]
- Enum {
- name: "ProjectionType"
- values: {
- "Perspective": 0,
- "Orthographic": 1
- }
- }
- Enum {
- name: "RotateOrder"
- values: {
- "TiltPanRoll": 0,
- "TiltRollPan": 1,
- "PanTiltRoll": 2,
- "PanRollTilt": 3,
- "RollTiltPan": 4,
- "RollPanTilt": 5
- }
- }
- Property { name: "projectionType"; type: "ProjectionType" }
- Property { name: "fieldOfView"; type: "qreal" }
- Property { name: "nearPlane"; type: "qreal" }
- Property { name: "farPlane"; type: "qreal" }
- Property { name: "viewSize"; type: "QSizeF" }
- Property { name: "minViewSize"; type: "QSizeF" }
- Property { name: "screenRotation"; type: "int" }
- Property { name: "eye"; type: "QVector3D" }
- Property { name: "upVector"; type: "QVector3D" }
- Property { name: "center"; type: "QVector3D" }
- Property { name: "eyeSeparation"; type: "qreal" }
- Property { name: "motionAdjustment"; type: "QVector3D" }
- Property { name: "adjustForAspectRatio"; type: "bool" }
- Signal { name: "projectionChanged" }
- Signal { name: "viewChanged" }
- Method {
- name: "translateEye"
- Parameter { name: "x"; type: "qreal" }
- Parameter { name: "y"; type: "qreal" }
- Parameter { name: "z"; type: "qreal" }
- }
- Method {
- name: "translateCenter"
- Parameter { name: "x"; type: "qreal" }
- Parameter { name: "y"; type: "qreal" }
- Parameter { name: "z"; type: "qreal" }
- }
- Method {
- name: "tiltPanRollCenter"
- Parameter { name: "tiltAngle"; type: "qreal" }
- Parameter { name: "panAngle"; type: "qreal" }
- Parameter { name: "rollAngle"; type: "qreal" }
- Parameter { name: "order"; type: "QGLCamera::RotateOrder" }
- }
- Method {
- name: "tiltPanRollCenter"
- Parameter { name: "tiltAngle"; type: "qreal" }
- Parameter { name: "panAngle"; type: "qreal" }
- Parameter { name: "rollAngle"; type: "qreal" }
- }
- Method {
- name: "tiltPanRollEye"
- Parameter { name: "tiltAngle"; type: "qreal" }
- Parameter { name: "panAngle"; type: "qreal" }
- Parameter { name: "rollAngle"; type: "qreal" }
- Parameter { name: "order"; type: "QGLCamera::RotateOrder" }
- }
- Method {
- name: "tiltPanRollEye"
- Parameter { name: "tiltAngle"; type: "qreal" }
- Parameter { name: "panAngle"; type: "qreal" }
- Parameter { name: "rollAngle"; type: "qreal" }
- }
- }
- Component {
- name: "QGLLightModel"
- prototype: "QObject"
- exports: [
- "LightModel 1.0"
- ]
- Enum {
- name: "Model"
- values: {
- "OneSided": 0,
- "TwoSided": 1
- }
- }
- Enum {
- name: "ColorControl"
- values: {
- "SingleColor": 0,
- "SeparateSpecularColor": 1
- }
- }
- Enum {
- name: "ViewerPosition"
- values: {
- "ViewerAtInfinity": 0,
- "LocalViewer": 1
- }
- }
- Property { name: "model"; type: "Model" }
- Property { name: "colorControl"; type: "ColorControl" }
- Property { name: "viewerPosition"; type: "ViewerPosition" }
- Property { name: "ambientSceneColor"; type: "QColor" }
- Signal { name: "modelChanged" }
- Signal { name: "colorControlChanged" }
- Signal { name: "viewerPositionChanged" }
- Signal { name: "ambientSceneColorChanged" }
- Signal { name: "lightModelChanged" }
- }
- Component {
- name: "QGLLightParameters"
- prototype: "QObject"
- exports: [
- "Light 1.0"
- ]
- Enum {
- name: "LightType"
- values: {
- "Directional": 0,
- "Positional": 1
- }
- }
- Property { name: "type"; type: "LightType"; isReadonly: true }
- Property { name: "position"; type: "QVector3D" }
- Property { name: "direction"; type: "QVector3D" }
- Property { name: "ambientColor"; type: "QColor" }
- Property { name: "diffuseColor"; type: "QColor" }
- Property { name: "specularColor"; type: "QColor" }
- Property { name: "spotDirection"; type: "QVector3D" }
- Property { name: "spotExponent"; type: "qreal" }
- Property { name: "spotAngle"; type: "qreal" }
- Property { name: "constantAttenuation"; type: "qreal" }
- Property { name: "linearAttenuation"; type: "qreal" }
- Property { name: "quadraticAttenuation"; type: "qreal" }
- Signal { name: "positionChanged" }
- Signal { name: "directionChanged" }
- Signal { name: "ambientColorChanged" }
- Signal { name: "diffuseColorChanged" }
- Signal { name: "specularColorChanged" }
- Signal { name: "spotDirectionChanged" }
- Signal { name: "spotExponentChanged" }
- Signal { name: "spotAngleChanged" }
- Signal { name: "constantAttenuationChanged" }
- Signal { name: "linearAttenuationChanged" }
- Signal { name: "quadraticAttenuationChanged" }
- Signal { name: "lightChanged" }
- }
- Component {
- name: "QGLMaterial"
- prototype: "QGLAbstractMaterial"
- exports: [
- "Material 1.0"
- ]
- Enum {
- name: "TextureCombineMode"
- values: {
- "Modulate": 0,
- "Decal": 1,
- "Replace": 2
- }
- }
- Property { name: "ambientColor"; type: "QColor" }
- Property { name: "diffuseColor"; type: "QColor" }
- Property { name: "specularColor"; type: "QColor" }
- Property { name: "emittedLight"; type: "QColor" }
- Property { name: "shininess"; type: "qreal" }
- Property { name: "texture"; type: "QGLTexture2D"; isPointer: true }
- Property { name: "textureCombineMode"; type: "QGLMaterial::TextureCombineMode" }
- Property { name: "textureUrl"; type: "QUrl" }
- Signal { name: "ambientColorChanged" }
- Signal { name: "diffuseColorChanged" }
- Signal { name: "specularColorChanged" }
- Signal { name: "emittedLightChanged" }
- Signal { name: "shininessChanged" }
- Signal { name: "texturesChanged" }
- }
- Component {
- name: "QGLSceneNode"
- prototype: "QObject"
- exports: [
- "SceneNode 1.0"
- ]
- Property { name: "position"; type: "QVector3D" }
- Property { name: "x"; type: "qreal" }
- Property { name: "y"; type: "qreal" }
- Property { name: "z"; type: "qreal" }
- Property { name: "material"; type: "QGLMaterial"; isPointer: true }
- Property { name: "backMaterial"; type: "QGLMaterial"; isPointer: true }
- Signal { name: "updated" }
- Method {
- name: "clone"
- type: "QGLSceneNode*"
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Method { name: "clone"; type: "QGLSceneNode*" }
- Method {
- name: "cloneNoChildren"
- type: "QGLSceneNode*"
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Method { name: "cloneNoChildren"; type: "QGLSceneNode*" }
- Method {
- name: "allExcept"
- type: "QGLSceneNode*"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "allExcept"
- type: "QGLSceneNode*"
- Parameter { name: "name"; type: "string" }
- }
- Method {
- name: "only"
- type: "QGLSceneNode*"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "only"
- type: "QGLSceneNode*"
- Parameter { name: "name"; type: "string" }
- }
- Method {
- name: "allExcept"
- type: "QGLSceneNode*"
- Parameter { name: "names"; type: "QStringList" }
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "allExcept"
- type: "QGLSceneNode*"
- Parameter { name: "names"; type: "QStringList" }
- }
- Method {
- name: "only"
- type: "QGLSceneNode*"
- Parameter { name: "names"; type: "QStringList" }
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Method {
- name: "only"
- type: "QGLSceneNode*"
- Parameter { name: "names"; type: "QStringList" }
- }
- }
- Component {
- name: "QGraphicsBillboardTransform"
- prototype: "QGraphicsTransform3D"
- exports: [
- "BillboardTransform 1.0"
- ]
- Property { name: "preserveUpVector"; type: "bool" }
- Signal { name: "preserveUpVectorChanged" }
- }
- Component {
- name: "QGraphicsLookAtTransform"
- prototype: "QGraphicsTransform3D"
- exports: [
- "LookAt 1.0"
- ]
- Property { name: "preserveUpVector"; type: "bool" }
- Property { name: "subject"; type: "QDeclarativeItem3D"; isPointer: true }
- Signal { name: "preserveUpVectorChanged" }
- Signal { name: "subjectChanged" }
- }
- Component {
- name: "QGraphicsRotation3D"
- prototype: "QGraphicsTransform3D"
- exports: [
- "Rotation3D 1.0"
- ]
- Property { name: "origin"; type: "QVector3D" }
- Property { name: "angle"; type: "qreal" }
- Property { name: "axis"; type: "QVector3D" }
- Signal { name: "originChanged" }
- Signal { name: "angleChanged" }
- Signal { name: "axisChanged" }
- }
- Component {
- name: "QGraphicsScale3D"
- prototype: "QGraphicsTransform3D"
- Property { name: "origin"; type: "QVector3D" }
- Property { name: "scale"; type: "QVector3D" }
- Signal { name: "originChanged" }
- Signal { name: "scaleChanged" }
- }
- Component {
- name: "QGraphicsTransform3D"
- prototype: "QObject"
- Signal { name: "transformChanged" }
- }
- Component {
- name: "QGraphicsTranslation3D"
- prototype: "QGraphicsTransform3D"
- exports: [
- "Translation3D 1.0"
- ]
- Property { name: "translate"; type: "QVector3D" }
- Property { name: "progress"; type: "qreal" }
- Signal { name: "translateChanged" }
- Signal { name: "progressChanged" }
- }
- Component {
- name: "Scale3D"
- prototype: "QGraphicsScale3D"
- exports: [
- "Scale3D 1.0"
- ]
- Property { name: "scale"; type: "QVariant" }
- Signal { name: "variantScaleChanged" }
- }
- Component {
- name: "ShaderProgram"
- prototype: "QDeclarativeEffect"
- exports: [
- "ShaderProgram 1.0"
- ]
- Property { name: "vertexShader"; type: "string" }
- Property { name: "fragmentShader"; type: "string" }
- Signal { name: "finishedLoading" }
- Signal { name: "shaderChanged" }
- Method { name: "markAllPropertiesDirty" }
- Method {
- name: "markPropertyDirty"
- Parameter { name: "property"; type: "int" }
- }
- }
- Component {
- name: "Viewport"
- defaultProperty: "data"
- prototype: "QDeclarativeItem"
- exports: [
- "Viewport 1.0"
- ]
- Property { name: "picking"; type: "bool" }
- Property { name: "showPicking"; type: "bool" }
- Property { name: "navigation"; type: "bool" }
- Property { name: "blending"; type: "bool" }
- Property { name: "camera"; type: "QGLCamera"; isPointer: true }
- Property { name: "light"; type: "QGLLightParameters"; isPointer: true }
- Property { name: "lightModel"; type: "QGLLightModel"; isPointer: true }
- Signal { name: "viewportChanged" }
- Method { name: "update3d" }
- Method {
- name: "objectForPoint"
- type: "QObject*"
- Parameter { name: "x"; type: "qreal" }
- Parameter { name: "y"; type: "qreal" }
- }
- }
-}
diff --git a/src/imports/threed/qgraphicslookattransform.cpp b/src/imports/threed/qgraphicslookattransform.cpp
deleted file mode 100644
index e3772b94..00000000
--- a/src/imports/threed/qgraphicslookattransform.cpp
+++ /dev/null
@@ -1,517 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicslookattransform.h"
-#include "qgraphicsrotation3d.h"
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsLookAtTransform
- \brief The QGraphicsLookAtTransform class implements a transformation
- that causes an Item3D to orient to face another Item3D.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- Sometimes it can be useful to make an object face towards another object,
- wherever it might be located. This is useful for objects like cameras,
- lights, arrows, faces etc.
-
- Another common use is called "billboarding", where a quad is always
- oriented to face the camera.
-*/
-
-/*!
- \qmlclass LookAtTransform QGraphicsLookAtTransform
- \brief The LookAtTransform item implements a transformation that causes objects to face the camera.
- \since 4.8
- \ingroup qt3d::qml3d
-
- Sometimes it can be useful to make an object face towards another object,
- wherever it might be located. This is useful for objects like cameras,
- lights, arrows, faces etc.
-
- Another common use is called "billboarding", where a quad is always
- oriented to face the camera. In QML, this can be achieved as follows:
-
- \code
- Camera3D camera
- Item3D {
- mesh: Mesh { source: "pane.obj" }
- position: Qt.vector3d(2, 0, -20)
- transform: LookAtTransform { worldPosition - camera.worldPosition }
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-
- Because the lookAt transformation will override many other transformations
- ont the matrix, it will usually be the last element in the \c transform
- list (transformations are applied to the matrix in reverse order of their
- appearance in \c transform):
-
- \code
- Item3D {
- mesh: Mesh { source: "pane.obj" }
- position: Qt.vector3d(2, 0, -20)
- transform: [
- Scale3D { scale: 0.5 },
- Rotation3D { angle: 30 },
- LookAtTransform { worldPosition - camera.worldPosition }
- ]
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-
- Typically, orientation as well as facing is important. For example, a face
- that does not remain basically upright will look very odd indeed as it
- tracks a subject. The lookAt transform will always rotate first around the
- local y axis, and secondarily around the local x axis, around an origin of
- (0,0,0).
-
- If rotation around a different axis or origin is desired, place the
- Item3D to be rotated inside a new parent Item3D. Apply rotations the
- and translations to the original Item3D such that the desired "front"
- matches the new parent Item3d's positive z direction and the left to right
- matches the parent's x-axis, and then apply the LookAt transform to the
- new parent item.
-
- \code
- Item3D {
- position: Qt.vector3d(0,0,4)
- transform: LookAt { subject: subjectPenguin }
-
- Item3D {
- id: lookAwayMonkey
- mesh: Mesh { source: "meshes/monkey.3ds" }
- transform: Rotation3D { axis: Qt.vector3d(0,1,0); angle: 180 }
- }
- }
- \endcode
-
- By default the LookAt transform will cause the object to
- face directly at the subject no matter how the world co-ordinate
- system is rotated. Sometimes it is useful to limit the lookAt to only
- one axis of rotation - for example, a tank with a turret and barrel that
- each have only one degree of freedom.
- This is achieved by using the preserveUpVector property:
-
- \code
- Pane {
- position: Qt.vector3d(2, 0, -20)
- transform: LookAtTransform { preserveUpVector: true }
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-*/
-
-/*!
- \internal
-*/
-static QMatrix4x4* cheatingSphericalBillboard(QMatrix4x4 *matrix)
-{
- // Replace the top-left 3x3 of the matrix with the identity.
- // The technique is "Cheating Spherical Billboards", described here:
- // http://www.lighthouse3d.com/opengl/billboarding/index.php?billCheat
- (*matrix)(0, 0) = 1.0f;
- (*matrix)(0, 1) = 0.0f;
- (*matrix)(0, 2) = 0.0f;
- (*matrix)(1, 0) = 0.0f;
- (*matrix)(1, 1) = 1.0f;
- (*matrix)(1, 2) = 0.0f;
- (*matrix)(2, 0) = 0.0f;
- (*matrix)(2, 1) = 0.0f;
- (*matrix)(2, 2) = 1.0f;
-
- return matrix;
-};
-
-/*!
- \internal
-*/
-static QMatrix4x4* cheatingCylindricalBillboard(QMatrix4x4 *matrix)
-{
- // Replace some of the top-left 3x3 of the matrix with the identity,
- // but leave the up vector component in the second column as-is.
- // The technique is "Cheating Cylindrical Billboards", described here:
- // http://www.lighthouse3d.com/opengl/billboarding/index.php?billCheat1
- (*matrix)(0, 0) = 1.0f;
- (*matrix)(0, 2) = 0.0f;
- (*matrix)(1, 0) = 0.0f;
- (*matrix)(1, 2) = 0.0f;
- (*matrix)(2, 0) = 0.0f;
- (*matrix)(2, 2) = 1.0f;
-
- return matrix;
-};
-
-#define RADS_TO_DEGREES (180.0 / M_PI)
-
-struct LookAtRotationCache {
- QGraphicsRotation3D primaryRotation;
- QGraphicsRotation3D secondaryRotation;
-};
-
-class QGraphicsLookAtTransformPrivate
-{
-public:
- QGraphicsLookAtTransformPrivate(QGraphicsLookAtTransform* _lookAt);
- QGraphicsLookAtTransform* lookAt;
- void determineOriginItem();
- void calculateRotationValues() const;
- QVector3D relativePosition(QDeclarativeItem3D* originItem, QDeclarativeItem3D* subject) const;
-
- bool preserveUpVector;
- QDeclarativeItem3D* originItem;
- QDeclarativeItem3D* subject;
- mutable LookAtRotationCache rotationCache;
- mutable bool rotationCacheDirty;
-
-};
-
-QGraphicsLookAtTransformPrivate::QGraphicsLookAtTransformPrivate(QGraphicsLookAtTransform* _lookAt) :
- lookAt(_lookAt), preserveUpVector(false), originItem(0), subject(0)
-{
-}
-
-void QGraphicsLookAtTransformPrivate::determineOriginItem()
-{
- QObject* workingObject = lookAt->parent();
- while (qobject_cast<QDeclarativeItem3D*>(workingObject) == 0 &&
- workingObject != 0)
- {
- workingObject = workingObject->parent();
- }
-
- originItem = qobject_cast<QDeclarativeItem3D*>(workingObject);
- if (!originItem)
- qWarning() << "LookAt transform requires an Item3D ancestor";
-}
-
-QVector3D QGraphicsLookAtTransformPrivate::relativePosition(QDeclarativeItem3D* originItem, QDeclarativeItem3D* subject) const
-{
- QVector3D result = originItem->worldToLocal(subject->localToWorld());
- return result;
-
-}
-
-/*! \internal
- Calculate the actual rotation values for the transform.
-
- Note this function has to be const to be called within applyTo(), but
- modifies the mutable rotationCache and rotationCacheDirty values.
-*/
-void QGraphicsLookAtTransformPrivate::calculateRotationValues() const
-{
- QVector3D forwards(0, 0, 1);
- rotationCache.primaryRotation.setAngle(0);
- rotationCache.secondaryRotation.setAngle(0);
- rotationCacheDirty = false;
-
- if (subject == 0 || originItem == 0)
- {
- if (subject == 0)
- qWarning() << "LookAt transform got null subject";
- if (originItem == 0)
- qWarning() << "LookAt transform got null originItem";
- rotationCache.primaryRotation.setAxis(QVector3D(0,1,0));
- rotationCache.primaryRotation.setAngle(0);
- rotationCache.secondaryRotation.setAxis(QVector3D(1,0,0));
- rotationCache.secondaryRotation.setAngle(0);
- return;
- }
-
- // Calculate the lookat vector in the local frame:
- QVector3D relativePositionVector = relativePosition(originItem, subject);
-
- // Project the relative position into the xz plane:
- QVector3D subjectProjection = relativePositionVector;
- subjectProjection.setY(0);
- subjectProjection.normalize();
- QVector3D primaryRotationAxis;
-
- if (!subjectProjection.isNull())
- {
- primaryRotationAxis = QVector3D::crossProduct(forwards, subjectProjection);
- // Fix rotational axis for positions along z axis
- if (primaryRotationAxis.length() == 0)
- {
- primaryRotationAxis = QVector3D(0,1,0);
- }
-
- qreal angleCosine =
- QVector3D::dotProduct(forwards, subjectProjection);
- qreal angle = qAcos(angleCosine);
-
- rotationCache.primaryRotation.setAxis(primaryRotationAxis);
- rotationCache.primaryRotation.setAngle(angle * RADS_TO_DEGREES );
- } else {
- // Target is directly above or below, so zero primary rotation
- rotationCache.primaryRotation.setAxis(QVector3D(0,1,0));
- rotationCache.primaryRotation.setAngle(0);
- }
-
- relativePositionVector.normalize();
-
- qreal secondaryAngleCosine = QVector3D::dotProduct( subjectProjection,
- relativePositionVector);
- // Sanity check in case of rounding errors
- if (secondaryAngleCosine <= 1.0 && secondaryAngleCosine >= -1.0)
- {
- if (relativePositionVector.y() < 0)
- rotationCache.secondaryRotation.setAxis(QVector3D(1,0,0));
- else
- rotationCache.secondaryRotation.setAxis(QVector3D(-1,0,0));
- rotationCache.secondaryRotation.setAngle(qAcos(secondaryAngleCosine)*RADS_TO_DEGREES);
- } else {
- rotationCache.secondaryRotation.setAxis(QVector3D(1,0,0));
- rotationCache.secondaryRotation.setAngle(0.0);
- }
-}
-
-/*!
- Construct a lookAt transform and attach it to \a parent.
-*/
-QGraphicsLookAtTransform::QGraphicsLookAtTransform(QObject *parent)
- : QGraphicsTransform3D(parent), d_ptr(new QGraphicsLookAtTransformPrivate(this))
-{
-}
-
-/*!
- Destroy this lookAt transform.
-*/
-QGraphicsLookAtTransform::~QGraphicsLookAtTransform()
-{
-}
-
-/*!
- \property QGraphicsLookAtTransform::preserveUpVector
- \brief true to preserve the up orientation.
-
- This property indicates whether the transform should rotate around a second
- axis to face directly at the subject (when the subject is the camera, this
- is known as "spherical billboarding").
-
- If the value for this property is true, then the object will have
- its up vector's orientation preserved, rotating around only the y-axis and
- not directly facing the subject unless it happens to fall on the correct
- plane (when the subject is the camera, this is known as known as
- "cylindrical billboarding").
-
- The default value for this property is false.
-*/
-
-/*!
- \qmlproperty bool LookatTransform::preserveUpVector
-
- This property indicates whether the transform should rotate around a second
- axis to face directly at the subject (known as a "spherical look-at").
-
- If the value for this property is true, then the object will have
- its y-axis' orientation preserved, rotating around only this axis and
- not directly facing the subject unless it happens to fall on the correct
- plane (known as a "cylindrical look-at").
-
- The default value for this property is false.
-*/
-
-bool QGraphicsLookAtTransform::preserveUpVector() const
-{
- Q_D(const QGraphicsLookAtTransform);
- return d->preserveUpVector;
-}
-
-void QGraphicsLookAtTransform::setPreserveUpVector(bool value)
-{
- Q_D(QGraphicsLookAtTransform);
- if (d->preserveUpVector != value) {
- d->preserveUpVector = value;
- d->rotationCacheDirty = true;
- emit preserveUpVectorChanged();
- emit transformChanged();
- }
-}
-
-/*!
- \property QGraphicsLookAtTransform::subject
- \brief The local-relative coordinates that are being looked at
-
- This property indicates what this transform is trying to look at. After
- applying the transformation.
-
- Forwards is always considered to be in the direction of the positive z axis
- in local space, and up is always considered to be the positive y axis, and
- rotation is always around the position (0,0,0) in local space (although
- any values can be emulated by applying the LookAt transformation to a
- parent Item3D, and then applying transformations relative to that parent).
-
- If no subject is set, no transformation is applied.
-*/
-
-/*!
- \qmlproperty bool LookatTransform::preserveUpVector
-
- This property indicates whether the transform should rotate around a second
- axis to face directly at the subject (known as a "spherical look-at").
-
- If the value for this property is true, then the object will have
- its y-axis' orientation preserved, rotating around only this axis and
- not directly facing the subject unless it happens to fall on the correct
- plane (when the subject is the camera, this is known as a
- "cylindrical look-at").
-
- The default value for this property is false.
-*/
-
-/*!
- \fn void QGraphicsLookAtTransform::subjectChanged()
-
- Signal that is emitted when subject() changes.
-*/
-
-
-QDeclarativeItem3D* QGraphicsLookAtTransform::subject() const
-{
- Q_D(const QGraphicsLookAtTransform);
- return d->subject;
-}
-
-void QGraphicsLookAtTransform::setSubject(QDeclarativeItem3D* value)
-{
- Q_D(QGraphicsLookAtTransform);
- if (d->subject != value)
- {
- // Listen for changes on the subject and it's ancestors that mean the
- // lookAt transform needs to be recalculated
- disconnect(this, SLOT(subjectPositionChanged()));
- d->subject = value;
- QDeclarativeItem3D* ancestorItem = d->subject;
- while (ancestorItem != 0)
- {
- // listen for changes directly on the item, changes on it's
- // transforms property, or through reparenting
- connect(ancestorItem, SIGNAL(positionChanged()), this, SLOT(subjectPositionChanged()));
- connect(ancestorItem, SIGNAL(rotationChanged()), this, SLOT(subjectPositionChanged()));
- connect(ancestorItem, SIGNAL(scaleChanged()), this, SLOT(subjectPositionChanged()));
- connect(ancestorItem, SIGNAL(parentChanged()), this, SLOT(ancestryChanged()));
- QDeclarativeListProperty<QGraphicsTransform3D> transforms =
- ancestorItem->transform();
-
- for (int i=0; i < transforms.count(&transforms) ; i++)
- {
- QGraphicsTransform3D* transform = transforms.at(&transforms, i);
- connect(transform, SIGNAL(transformChanged()),
- this, SLOT(subjectPositionChanged()));
- }
-
- ancestorItem = qobject_cast<QDeclarativeItem3D*> (ancestorItem->parent());
- };
-
- d->rotationCacheDirty = true;
- d->determineOriginItem();
- emit subjectChanged();
- emit transformChanged();
- }
-};
-
-void QGraphicsLookAtTransform::subjectPositionChanged()
-{
- Q_D(QGraphicsLookAtTransform);
- d->rotationCacheDirty = true;
-}
-
-void QGraphicsLookAtTransform::ancestryChanged()
-{
- Q_D(QGraphicsLookAtTransform);
- d->determineOriginItem();
- d->rotationCacheDirty = true;
-}
-
-/*!
- \internal
-*/
-void QGraphicsLookAtTransform::applyTo(QMatrix4x4 *matrix) const
-{
- Q_D(const QGraphicsLookAtTransform);
- bool cameraTest = false;
- bool animationTest = false;
- // If we're looking at the camera, and not animating,
- // we can use a cheap cheat
- if (cameraTest && !animationTest)
- {
- if (!d->preserveUpVector)
- cheatingSphericalBillboard(matrix);
- else
- cheatingCylindricalBillboard(matrix);
- matrix->optimize();
- return;
- }
-
- if (d->rotationCacheDirty)
- d->calculateRotationValues();
-
- d->rotationCache.primaryRotation.applyTo(matrix);
- // then, if preserveVector is not set, perform a second rotation
- // around the x-axis
- if (!preserveUpVector())
- d->rotationCache.secondaryRotation.applyTo(matrix);
-}
-
-/*!
- \internal
-*/
-QGraphicsTransform3D *QGraphicsLookAtTransform::clone(QObject *parent) const
-{
- Q_D(const QGraphicsLookAtTransform);
- QGraphicsLookAtTransform *copy = new QGraphicsLookAtTransform(parent);
- copy->setPreserveUpVector(d->preserveUpVector);
- copy->setSubject(d->subject);
- return copy;
-}
-
-/*!
- \fn void QGraphicsLookAtTransform::preserveUpVectorChanged()
-
- Signal that is emitted when preserveUpVector() changes.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/imports/threed/qgraphicslookattransform.h b/src/imports/threed/qgraphicslookattransform.h
deleted file mode 100644
index b578dff5..00000000
--- a/src/imports/threed/qgraphicslookattransform.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSLOOKATTRANSFORM_H
-#define QGRAPHICSLOOKATTRANSFORM_H
-
-#include "qgraphicstransform3d.h"
-#include "qdeclarativeitem3d.h"
-
-#include <QtCore/qscopedpointer.h>
-#include <QtCore/qpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsLookAtTransformPrivate;
-
-class QGraphicsLookAtTransform : public QGraphicsTransform3D
-{
- Q_OBJECT
- Q_PROPERTY(bool preserveUpVector READ preserveUpVector WRITE setPreserveUpVector NOTIFY preserveUpVectorChanged)
- Q_PROPERTY(QDeclarativeItem3D* subject READ subject WRITE setSubject NOTIFY subjectChanged )
-public:
- QGraphicsLookAtTransform(QObject *parent = 0);
- ~QGraphicsLookAtTransform();
-
- bool preserveUpVector() const;
- void setPreserveUpVector(bool value);
-
- QDeclarativeItem3D* subject() const;
- void setSubject(QDeclarativeItem3D* value);
-
- void applyTo(QMatrix4x4 *matrix) const;
- QGraphicsTransform3D *clone(QObject *parent) const;
-
-private Q_SLOTS:
- void subjectPositionChanged();
- void ancestryChanged();
-
-Q_SIGNALS:
- void preserveUpVectorChanged();
- void subjectChanged();
-
-private:
- QScopedPointer<QGraphicsLookAtTransformPrivate> d_ptr;
-
- Q_DISABLE_COPY(QGraphicsLookAtTransform)
- Q_DECLARE_PRIVATE(QGraphicsLookAtTransform)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/threed/qmldir b/src/imports/threed/qmldir
deleted file mode 100644
index 773d9a63..00000000
--- a/src/imports/threed/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-plugin qthreedqmlplugin
diff --git a/src/imports/threed/qt3dnamespace.cpp b/src/imports/threed/qt3dnamespace.cpp
deleted file mode 100644
index 34878cd2..00000000
--- a/src/imports/threed/qt3dnamespace.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt3dnamespace.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass Qt3D Qt3DNamespace
- \brief The QML global object Qt3D provides useful functions for 3D applications.
- \ingroup qt3d::qml3d
-*/
-
-/*!
- \qmlmethod Qt3D::vector2d(real x, real y)
- Returns a Vector2D with the specified \c x and \c y.
-*/
-
-QVector2D Qt3DNamespace::vector2d(qreal x, qreal y)
-{
- return QVector2D(x, y);
-}
-
-/*!
- \qmlmethod Qt3D::vector4d(real x, real y, real z, real w)
- Returns a Vector4D with the specified \c x, \c y, \c z, and \c w.
-*/
-
-QVector4D Qt3DNamespace::vector4d(qreal x, qreal y, qreal z, qreal w)
-{
- return QVector4D(x, y, z, w);
-}
-
-/*!
- \qmlmethod Qt3D::quaternion(real scalar, real x, real y, real z)
- Returns a Quaternion with the specified \c scalar, \c x, \c y, and \c z.
-*/
-
-QQuaternion Qt3DNamespace::quaternion(qreal scalar, qreal x, qreal y, qreal z)
-{
- return QQuaternion(scalar, x, y, z);
-}
-
-/*!
- \qmlmethod Qt3D::matrix4x4(real m11, real m12, real m13, real m14, real m21, real m22, real m23, real m24, real m31, real m32, real m33, real m34, real m41, real m42, real m43, real m44)
- Returns a Matrix4x4 with the specified 16 components, which are specified
- in row-major order.
-*/
-
-QMatrix4x4 Qt3DNamespace::matrix4x4
- (qreal m11, qreal m12, qreal m13, qreal m14,
- qreal m21, qreal m22, qreal m23, qreal m24,
- qreal m31, qreal m32, qreal m33, qreal m34,
- qreal m41, qreal m42, qreal m43, qreal m44)
-{
- return QMatrix4x4(m11, m12, m13, m14,
- m21, m22, m23, m24,
- m31, m32, m33, m34,
- m41, m42, m43, m44);
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/threed/qt3dnamespace.h b/src/imports/threed/qt3dnamespace.h
deleted file mode 100644
index de65a070..00000000
--- a/src/imports/threed/qt3dnamespace.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT3DNAMESPACE_H
-#define QT3DNAMESPACE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qvariant.h>
-#include <QtGui/qvector2d.h>
-#include <QtGui/qvector3d.h>
-#include <QtGui/qvector4d.h>
-#include <QtGui/qmatrix4x4.h>
-#include <QtGui/qquaternion.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Qt3DNamespace : public QObject
-{
- Q_OBJECT
-public:
- Qt3DNamespace(QObject *parent = 0) : QObject(parent) {}
- ~Qt3DNamespace() {}
-
-public Q_SLOTS:
- QVector2D vector2d(qreal x, qreal y);
- QVector4D vector4d(qreal x, qreal y, qreal z, qreal w);
- QQuaternion quaternion(qreal scalar, qreal x, qreal y, qreal z);
- QMatrix4x4 matrix4x4(qreal m11, qreal m12, qreal m13, qreal m14,
- qreal m21, qreal m22, qreal m23, qreal m24,
- qreal m31, qreal m32, qreal m33, qreal m34,
- qreal m41, qreal m42, qreal m43, qreal m44);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QT3DNAMESPACE_H
diff --git a/src/imports/threed/scale3d.cpp b/src/imports/threed/scale3d.cpp
deleted file mode 100644
index 7b2ede95..00000000
--- a/src/imports/threed/scale3d.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "scale3d.h"
-
-QT_BEGIN_NAMESPACE
-
-void Scale3D::setScale(const QVariant &value)
-{
- QVector3D newScale;
- if (value.type() == QVariant::Vector3D) {
- newScale = value.value<QVector3D>();
- } else {
- bool ok = false;
- double val = value.toDouble(&ok);
- if (!ok) {
- qWarning("Scale3D: scale value is not a vector3D or single floating-point value");
- return;
- }
- newScale = QVector3D(qreal(val), qreal(val), qreal(val));
- }
- if (newScale != QGraphicsScale3D::scale()) {
- QGraphicsScale3D::setScale(newScale);
- emit variantScaleChanged();
- }
-}
-
-QGraphicsTransform3D *Scale3D::clone(QObject *parent) const
-{
- Scale3D *copy = new Scale3D(parent);
- copy->setOrigin(origin());
- copy->setScale(scale());
- return copy;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/threed/scale3d.h b/src/imports/threed/scale3d.h
deleted file mode 100644
index a648bae2..00000000
--- a/src/imports/threed/scale3d.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SCALE3D_H
-#define SCALE3D_H
-
-#include "qgraphicsscale3d.h"
-
-#include <QtCore/qvariant.h>
-#include <QtDeclarative/qdeclarative.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Scale3D : public QGraphicsScale3D
-{
- Q_OBJECT
- Q_PROPERTY(QVariant scale READ scale WRITE setScale NOTIFY variantScaleChanged)
-public:
- Scale3D(QObject *parent = 0) : QGraphicsScale3D(parent) {}
- ~Scale3D() {}
-
- QVariant scale() const { return QGraphicsScale3D::scale(); }
- void setScale(const QVariant &value);
-
- QGraphicsTransform3D *clone(QObject *parent) const;
-
-Q_SIGNALS:
- void variantScaleChanged();
-
-private:
- Q_DISABLE_COPY(Scale3D)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(Scale3D)
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/threed/shaderprogram.cpp b/src/imports/threed/shaderprogram.cpp
deleted file mode 100644
index 7b775b5b..00000000
--- a/src/imports/threed/shaderprogram.cpp
+++ /dev/null
@@ -1,979 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "shaderprogram.h"
-#include "shaderprogram_p.h"
-#include "qglabstracteffect.h"
-#include <QtOpenGL/qglshaderprogram.h>
-#include <QWeakPointer>
-
-#include <QDeclarativeEngine>
-#include <QDeclarativeContext>
-#include <QFile>
-
-#include "qglscenenode.h"
-/*!
- \qmlclass ShaderProgram ShaderProgram
- \brief The ShaderProgram item is derivative class of the more general Effect class in QML/3d.
- Whereas the Effect class provides support for standard effects under OpenGL, the ShaderProgramEffect supports effects based on custom shader programs for the GPU.
- \since 4.8
- \ingroup qt3d::qml3d
- \inherits Effect
-
- The ShaderProgram class provides Qml/3d users with the ability to use a QGLShaderProgram within the
- logical context of the normal \l Effect class provided by Qml/3d.
-
- If the system does not support shaders, then ShaderProgram will
- behave the same as \l Effect, with support for simple lit
- materials only.
-
- \section1 Attributes
-
- ShaderProgram provides a standard set of 8 vertex attributes that
- can be provided via the geometry \l Mesh:
-
- \table
- \header \o Shader Variable \o Mesh Attribute \o Purpose
- \row \o \c qt_Vertex \o QGL::Position
- \o The primary position of the vertex.
- \row \o \c qt_Normal \o QGL::Normal
- \o The normal at each vertex, for lit material effects.
- \row \o \c qt_Color \o QGL::Color
- \o The color at each vertex, for per-vertex color effects.
- \row \o \c qt_MultiTexCoord0 \o QGL::TextureCoord0
- \o The texture co-ordinate at each vertex for texture unit 0.
- \row \o \c qt_MultiTexCoord1 \o QGL::TextureCoord1
- \o Secondary texture co-ordinate at each vertex.
- \row \o \c qt_MultiTexCoord2 \o QGL::TextureCoord2
- \o Tertiary texture co-ordinate at each vertex.
- \row \o \c qt_Custom0 \o QGL::CustomVertex0
- \o First custom vertex attribute that can be used for any
- user-defined purpose.
- \row \o \c qt_Custom1 \o QGL::CustomVertex1
- \o Second custom vertex attribute that can be used for any
- user-defined purpose.
- \endtable
-
- These attributes are used in the vertexShader, as in the following
- example of a simple texture shader:
-
- \code
- attribute highp vec4 qt_Vertex;
- attribute highp vec4 qt_MultiTexCoord0;
- uniform mediump mat4 qt_ModelViewProjectionMatrix;
- varying highp vec4 texCoord;
-
- void main(void)
- {
- gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;
- texCoord = qt_MultiTexCoord0;
- }
- \endcode
-
- \section1 Standard uniform variables
-
- ShaderProgram provides a standard set of uniform variables for
- common values from the environment:
-
- \table
- \header \o Shader Variable \o Purpose
- \row \o \c qt_ModelViewProjectionMatrix
- \o Combination of the modelview and projection matrices into a
- single 4x4 matrix.
- \row \o \c qt_ModelViewMatrix
- \o Modelview matrix without the projection. This is typically
- used for performing calculations in eye co-ordinates.
- \row \o \c qt_ProjectionMatrix
- \o Projection matrix without the modelview.
- \row \o \c qt_NormalMatrix
- \o Normal matrix, which is the transpose of the inverse of the
- top-left 3x3 part of the modelview matrix. This is typically
- used in lighting calcuations to transform \c qt_Normal.
- \row \o \c qt_WorldMatrix
- \o Modelview matrix without the eye position and orientation
- component. See QGLPainter::worldMatrix() for further
- information.
- \row \o \c qt_Texture0
- \o Sampler holding the texture from the Effect::texture property.
- \row \o \c qt_Color
- \o Set to the value of the Effect::color property.
- \endtable
-
- The above variables are usually declared in the shaders as follows
- (where \c highp may be replaced with \c mediump or \c lowp depending
- upon the shader's precision requirements):
-
- \code
- uniform highp mat4 qt_ModelViewProjectionMatrix;
- uniform highp mat4 qt_ModelViewMatrix;
- uniform highp mat3 qt_NormalMatrix;
- uniform sampler2D qt_Texture0;
- uniform highp vec4 qt_Color;
- \endcode
-
- Other lighting and material values, such as the ambient, diffuse,
- and specular colors, can be passed to the shader program using
- custom uniform variables, or the standard variable names described
- in the QGLShaderProgramEffect documentation.
-
- \section1 Custom uniform variables
-
- Many properties defined on the ShaderProgram are automatically exposed as
- uniforms for the fragment and vertex shaders under the same name.
-
- QML and shader types do not match exactly, so the following table shows
- how QML properties should be declared in qml compared to shader programs:
-
- \table
- \header \o QML Property \o Shader Program Variable
-\row \o \code property double myDouble : 1.0 \endcode \o uniform highp float myDouble;
- \row \o \code property real myReal : 1.0 \endcode \o uniform mediump float myReal;
- \row \o \code property bool myBoolean : true \endcode \o uniform bool myBoolean;
- \row \o \code property int myInt : 1 \endcode \o uniform int myInt;
- \row \o \code property variant myPoint : Qt.point(1, 1) \endcode \o uniform mediump vec2 myPoint;
- \row \o \code property variant myPointF : Qt.point(1.0, 1.0) \endcode \o uniform mediump vec2 myPointF;
- \row \o \code property variant mySize : Qt.size(1.0, 1.0) \endcode \o uniform mediump vec2 mySize;
- \row \o \code property color myColor : "#80c342" \endcode \o uniform lowp vec4 myColor;
- \row \o \code property variant myMatrix3x3 :
- [1.0, 0.0, 0.0,
- 0.0, 1.0, 0.0,
- 0.0, 0.0, 1.0] \endcode \o uniform mat3 myMatrix3x3;
- \row \o \code property variant myMatrix4x4 :
- [1.0 , 0.0, 0.0, 0.0,
- 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0 ]\endcode \o uniform mat4 myMatrix4x4;
- \row \o \code property string imageExample :
- "http://example.com/image.png" \endcode \o uniform sampler2D imageExample;
- \endtable
-
- Note: The precision hints in this table are just examples. highp,
- mediump, and lowp do not map directly onto floats, doubles, colors etc.
- Choose the most appropriate variable type for your qml or javascript, and
- the most appropriate precision for your shader program.
-
- Be aware that variant properties in general and matrices in particular
- can have significant performance implications. Conversion from variants
- can be slow, and matrices can consume multiple slots for uniforms, which
- are usually limited by hardware.
-
- String properties are assumed to be urls to images for use in textures.
- Where these images are remote, they are loaded in the background and bound
- to the effect when they are ready.
- \sa QGLGraphicsViewportItem
-*/
-
-class ShaderProgramEffect;
-QT_BEGIN_NAMESPACE
-
-class ShaderProgramPrivate
-{
-public:
- ShaderProgramPrivate()
- : regenerate(false)
- , shadersSupported(true) // Assume supported until known otherwise.
- , effect(0)
- {
- }
-
- QString vertexShader;
- QString fragmentShader;
- QUrl vertexShaderSource;
- QUrl fragmentShaderSource;
- bool regenerate;
- bool shadersSupported;
- ShaderProgramEffect *effect;
-};
-
-
-/*
- \internal
- Construction for the ShaderProgramEffect class consists of setting the key parameter values of the
- class to undefined. As such, a shader program effect with no further initialisation will do nothing at all
- until further creation of shader programs for it has been carried out.
-*/
-ShaderProgramEffect::ShaderProgramEffect(ShaderProgram* parent)
-{
- this->parent = parent;
- nextTextureUnit = 1;
- propertyListener = new ShaderProgramPropertyListenerEx(parent, this);
-}
-
-/*
- \internal
- Destruction entails deletion of the underlying \l QGLShaderProgram which forms the functional core of the
- class.
-*/
-ShaderProgramEffect::~ShaderProgramEffect()
-{
- QList<QGLTexture2D*> textures = texture2Ds.values();
- QGLTexture2D* texture;
- foreach (texture, textures)
- delete texture;
-}
-
-/*
- \internal
- The act of shader programe creation can be undertakn in the manner defined for the QGLShaderProgram class.
- Failure to successfully carry out creation will result in a warning message. Success will auto-populate the
- parameter fields of the ShaderProgramEffect with the necessary values based on the shader program.
-
- The vertex shader source is defined as a QString in the \a vertexShader parameter, while the fragment shader
- is provided in the \a fragmentShader parameter.
-*/
-bool ShaderProgramEffect::create
- (const QString& vertexShader, const QString& fragmentShader)
-{
- if (!QGLShaderProgram::hasOpenGLShaderPrograms())
- return false;
-
- setVertexShader(vertexShader.toLatin1());
- setFragmentShader(fragmentShader.toLatin1());
-
- return true;
-}
-
-/*!
- \internal
- Convenience function to setup the relationship between object properties
- and shader uniforms for later use.
- */
-void ShaderProgramEffect::afterLink()
-{
- propertyIdsToUniformLocations.clear();
- uniformLocationsToTextureUnits.clear();
- nextTextureUnit = 1;
- propertyListener->disconnect();
- if (parent.data() == 0)
- {
- return;
- }
- QObject::connect(propertyListener, SIGNAL(propertyChanged()), parent.data(), SIGNAL(effectChanged()));
-
- const QMetaObject* parentMetaObject = parent.data()->metaObject();
- int parentMethodCount = parentMetaObject->methodCount();
-
- for (int i = parentMetaObject->propertyOffset();
- i < parentMetaObject->propertyCount(); i++)
- {
- QMetaProperty metaProperty = parentMetaObject->property(i);
- QByteArray propertyName = metaProperty.name();
- int location = program()->uniformLocation(propertyName);
- // -1 indicates that the program does not use the variable,
- // so ignore those variables.
- if (location != -1)
- {
- dirtyProperties.append(i);
- propertyIdsToUniformLocations[i] = location;
- if (metaProperty.hasNotifySignal())
- {
- QMetaMethod notifySignal = metaProperty.notifySignal();
-
- int signalIndex = notifySignal.methodIndex();
-
- // Connect the myFooChanged() signal from the ShaderProgram
- // to the corresponding imaginary slot on the listener
- // Use the method count to make sure that we don't stomp on
- // real methods and add the property index to tell the
- // properties apart.
- // Warning: Subclasses of ShaderProgramPropertyListener will
- // generate spurious property updates and lots of warnings
- // and might even crash
- QMetaObject::connect(parent.data(), signalIndex,
- propertyListener, parentMethodCount + i);
- } else {
- qWarning() << "Warning: No notification signal found for property: " << propertyName;
- propertiesWithoutNotificationSignal.append(i);
- }
- }
- }
-
- // Refresh everything
- this->setPropertiesDirty();
-}
-
-/*!
- \internal
- Precondition: list is a list of floats
- */
-static inline void setUniformFromFloatList(QGLShaderProgram *program, int uniformLocation, QList<QVariant> list)
-{
- switch(list.length())
- {
- case 1:
- program->setUniformValue(uniformLocation, list.at(0).toFloat());
- break;
- case 2:
- program->setUniformValue(uniformLocation,
- list.at(0).toFloat(),
- list.at(1).toFloat());
- break;
- case 3:
- program->setUniformValue(uniformLocation,
- list.at(0).toFloat(),
- list.at(1).toFloat(),
- list.at(2).toFloat());
- break;
- case 4:
- program->setUniformValue(uniformLocation,
- list.at(0).toFloat(),
- list.at(1).toFloat(),
- list.at(2).toFloat(),
- list.at(3).toFloat());
- break;
- case 9:
- {
- QMatrix3x3 matrix;
- for (int i = 0; i < 9; i++)
- {
- matrix(i / 3, i % 3) = list.at(i).toFloat();
- }
- program->setUniformValue(uniformLocation, matrix);
- }
- break;
- case 16:
- {
- QMatrix4x4 matrix;
- for (int i = 0; i < 16; i++)
- {
- matrix( i / 4, i % 4) = list.at(i).toFloat();
- }
- program->setUniformValue(uniformLocation, matrix);
- }
- break;
- default:
- // Very little information available to make this warning any more helpful
- qWarning() << "Warning: unexpected list size: " << list.size() << ", only 1-4, 9 and 16 supported";
- }
-}
-
-/*!
- \internal
- This performs all updates for the shader program given a QGLPainter \a painter, and the type of update
- being carried out based on the \a updates field, which is an enumeration of the possible painter updates.
-*/
-void ShaderProgramEffect::update
- (QGLPainter *painter, QGLPainter::Updates updates)
-{
- if (changedTextures.count() > 0)
- {
- foreach (int i, changedTextures)
- {
- if (!images.contains(i))
- {
- changedTextures.remove(i);
- continue;
- }
-
- if (!images[i].isNull())
- {
- setUniform(i, images[i], painter);
- } else
- {
- qWarning() << "Warning: ShaderProgramEffect failed to apply texture for uniform" << i << (urls.contains(i) ? QLatin1String(" url: ") + urls[i] : QString());
- }
- changedTextures.remove(i);
- }
- }
-
- // Update the standard uniform variables.
- QGLShaderProgramEffect::update(painter, updates);
-
- // Assign custom properties if they exist
- if (!parent.data() || !(propertyIdsToUniformLocations.count() > 0))
- return;
-
- // update dirty properties and remove them from the list
- int propertyIndex;
- QList<int> propertiesNotUpdated;
- foreach (propertyIndex, dirtyProperties)
- {
- if (!setUniformForPropertyIndex(propertyIndex, painter))
- {
- propertiesNotUpdated.append(propertyIndex);
- };
- }
- dirtyProperties.clear();
- dirtyProperties.append(propertiesNotUpdated);
-
- // always update the properties we can't track
- foreach (propertyIndex, propertiesWithoutNotificationSignal)
- {
- setUniformForPropertyIndex(propertyIndex, painter);
- }
-}
-
-inline QGLTexture2D* ShaderProgramEffect::textureForUniformValue(int uniformLocation)
-{
- QGLTexture2D* result = texture2Ds.value(uniformLocation);
- if (result == 0)
- {
- result = new QGLTexture2D();
- texture2Ds[uniformLocation] = result;
- }
- return result;
-}
-
-inline bool ShaderProgramEffect::setUniformForPropertyIndex(int propertyIndex, QGLPainter *painter)
-{
- QGLShaderProgram *program = this->program();
- int uniformLocation = propertyIdsToUniformLocations[propertyIndex];
-
- QVariant value =
- parent.data()->metaObject()->property(propertyIndex).read(parent.data());
-
- switch(value.type())
- {
- case QVariant::Double:
- // Convert double to float to pass to shader program
- case QMetaType::Float:
- program->setUniformValue(uniformLocation, value.toFloat());
- break;
- case QVariant::Int:
- program->setUniformValue(uniformLocation, value.toInt());
- break;
- case QVariant::UInt:
- program->setUniformValue(uniformLocation, value.toUInt());
- break;
- case QVariant::Bool:
- program->setUniformValue(uniformLocation, value.toBool());
- break;
- case QVariant::Color:
- program->setUniformValue(uniformLocation, value.value<QColor>());
- break;
- case QVariant::List:
- setUniformFromFloatList(program, uniformLocation, value.toList());
- break;
- case QVariant::Point:
- program->setUniformValue(uniformLocation, value.toPoint());
- break;
- case QVariant::PointF:
- program->setUniformValue(uniformLocation, value.toPointF());
- break;
- case QVariant::Size:
- program->setUniformValue(uniformLocation, value.toSize());
- break;
- case QVariant::SizeF:
- program->setUniformValue(uniformLocation, value.toSizeF());
- break;
- case QVariant::Matrix4x4:
- program->setUniformValue(uniformLocation, value.value<QMatrix4x4>());
- break;
- case QVariant::Vector2D:
- program->setUniformValue(uniformLocation, value.value<QVector2D>());
- break;
- case QVariant::Vector3D:
- program->setUniformValue(uniformLocation, value.value<QVector3D>());
- break;
- case QVariant::Vector4D:
- program->setUniformValue(uniformLocation, value.value<QVector4D>());
- break;
- case QVariant::String:
- {
- // We assume strings are URLs to images for textures
- QString urlString = value.toString();
- processTextureUrl(uniformLocation, urlString);
- }
- break;
- case QVariant::Image:
- {
- QImage image(value.toString());
- setUniform(uniformLocation, image, painter);
- }
- break;
- default:
- qWarning() << "Unrecognized variant for property " << parent.data()->metaObject()->property(propertyIndex).name() << " of type " << value.typeName() << ", could not set corresponding shader variable";
- }
- return true;
-}
-
-/*!
- \internal Helper function for applying a \a pixmap to a texture for a shader program. This function should be called from within update() in order to have access to the right GL context through the \a painter.
- */
-void ShaderProgramEffect::setUniform
- (int uniformLocation, const QPixmap pixmap, QGLPainter* painter)
-{
- // TODO: Perspective correction
- QGLTexture2D* texture = textureForUniformValue(uniformLocation);
- int unit = textureUnitForUniformValue(uniformLocation);
- if (texture != 0)
- {
- texture->setPixmap(pixmap);
- painter->glActiveTexture(GL_TEXTURE0 + unit);
- texture->bind();
- program()->setUniformValue(uniformLocation, unit);
- }
-}
-
-/*!
- \internal Helper function for applying an \a images to a texture for a shader program. This function should be called from within update() in order to have access to the right GL context through the \a painter.
- */
-void ShaderProgramEffect::setUniform
- (int uniformLocation, const QImage& image, QGLPainter* painter)
-{
- // TODO: Perspective correction
- QGLTexture2D* texture = textureForUniformValue(uniformLocation);
- int unit = textureUnitForUniformValue(uniformLocation);
- if (texture != 0)
- {
- texture->setImage(image);
- painter->glActiveTexture(GL_TEXTURE0 + unit);
- texture->bind();
- program()->setUniformValue(uniformLocation, unit);
- }
-}
-
-/*!
- \internal Find the texture unit to associate with \a uniformLocation.
-*/
-int ShaderProgramEffect::textureUnitForUniformValue(int uniformLocation)
-{
- int unit = uniformLocationsToTextureUnits.value(uniformLocation, -1);
- if (unit == -1) {
- unit = nextTextureUnit++;
- uniformLocationsToTextureUnits[uniformLocation] = unit;
- }
- return unit;
-}
-
-/*!
- \internal set all properties dirty so they are reuploaded
- next update()
- */
-void ShaderProgramEffect::setPropertiesDirty()
-{
- dirtyProperties = this->propertyIdsToUniformLocations.keys();
-}
-
-/*!
- \internal Set a specific property as dirty so that it is reuploaded
- next update()
- */
-void ShaderProgramEffect::setPropertyDirty(int property)
-{
- if (dirtyProperties.indexOf(property) == -1)
- {
- dirtyProperties.append(property);
- }
-}
-
-/*!
- \internal Update the image for the texture bound at \a uniform location with
- the the image at \a urlString. If \a urlString is a remote resource, this
- starts an asycnrounous loading process.
-
- Note: Consecutive calls with the same url for a given uniform are ignored.
-*/
-void ShaderProgramEffect::processTextureUrl(int uniformLocation, QString urlString)
-{
- QUrl url(urlString);
- if (urlString.isEmpty() &&
- urls.contains(uniformLocation) &&
- !urls[uniformLocation].isNull())
- {
- if (images.contains(uniformLocation) && !images[uniformLocation].isNull())
- {
- images[uniformLocation] = QImage();
- urls.remove(uniformLocation);
- changedTextures.insert(uniformLocation);
- return;
- }
- };
-
- bool async = true;
- // Try to make path absolute:
- if (url.isRelative())
- {
- async = false;
- // Get the baseUrl from the declarative engine
- QDeclarativeContext *context =
- QDeclarativeEngine::contextForObject(parent.data());
-
- if (context)
- {
- QUrl baseurl = context->baseUrl();
- QUrl absolute = baseurl.resolved(urlString);
-
- if (absolute.isValid())
- {
- url = absolute;
- urlString = absolute.toString();
- } else {
- qWarning() << "Warning: failed to resolve relative path " <<
- urlString;
- }
- }
- };
-
- if (urlString != urls[uniformLocation])
- {
- if (url.scheme() != QLatin1String("file"))
- {
- // TODO - support network URL's for loading - note that this feature is for
- // the Qt3D 1.1 release and there is no point in implementing it until for example
- // model loading and all other parts of Qt3D support it. Also when it is implemented
- // it has to be done with a facility that does not depend on private headers in
- // QtDeclarative which can change within minor dot-point releases.
- qWarning("Network URL's not yet supported - %s", qPrintable(urlString));
- }
- else
- {
- QString localFile = url.toLocalFile();
- if (localFile.endsWith(QLatin1String(".dds")))
- {
- qWarning("Shader effects with compressed textures not supported: %s",
- qPrintable(urlString));
- }
- else
- {
- QImage im(localFile);
- if (im.isNull())
- {
- qWarning("Could not load image from local file path - %s", qPrintable(localFile));
- }
- else
- {
- images[uniformLocation] = im;
- changedTextures.insert(uniformLocation);
- }
- }
- }
- }
-}
-
-/*!
- \internal
- Construction of the shader program and assignment of its \a parent object.
-*/
-ShaderProgram::ShaderProgram(QObject *parent)
- : QDeclarativeEffect(parent)
-{
- d = new ShaderProgramPrivate();
-}
-
-/*!
- \internal
- Destruction of the ShaderProgram entails deletion of private data, and explicit deletion of the
- underlying ShaderProgramEffect defined by the class.
-*/
-ShaderProgram::~ShaderProgram()
-{
- delete d->effect;
- delete d;
-}
-
-/*!
- \qmlproperty string ShaderProgram::vertexShader
-
- This property defines the source for the vertex shader to be implemented by this
- instance of the ShaderProgram. This property and the vertexShaderSource()
- property both effect the same underlying object, so setting one will override
- the other.
-
- \sa fragmentShader, vertexShaderSource
-*/
-QString ShaderProgram::vertexShader() const
-{
- return d->vertexShader;
-}
-
-void ShaderProgram::setVertexShader(const QString& value)
-{
- if (!d->vertexShaderSource.isEmpty() || value != d->vertexShader)
- {
- d->vertexShader = value;
- d->regenerate = true;
- d->vertexShaderSource = QUrl();
- emit shaderChanged();
- emit effectChanged();
- }
-}
-
-/*!
- \qmlproperty string ShaderProgram::fragmentShader
- This property defines the source for the fragment shader (ie. pixel shader) to be
- implemented by this instance of the ShaderProgram. This property and the
- fragmentShaderSource() property both effect the same underlying object, so
- setting one will override the other.
-
- \sa vertexShader, fragmentShaderSource
-*/
-QString ShaderProgram::fragmentShader() const
-{
- return d->fragmentShader;
-}
-
-void ShaderProgram::setFragmentShader(const QString& value)
-{
- if (!d->fragmentShaderSource.isEmpty() || value != d->fragmentShader)
- {
- d->fragmentShader = value;
- d->regenerate = true;
- d->fragmentShaderSource = QUrl();
- emit shaderChanged();
- emit effectChanged();
- }
-}
-
-/*!
- \qmlproperty QUrl ShaderProgram::vertexShaderSource
- This property allows the source for the vertex shader to be set to the contents
- of a file containing shader source code. This property and the vertexShader()
- property both effect the same underlying object, so setting one will override
- the other.
-
- Note that at present networked URLs are not supported, only local files. If a
- URL has not been set for the vertex shader, for example because it was
- specified via the vertexShader() in-line shader code property, then this property
- will return a null (empty) QUrl.
-
- \sa vertexShader, fragmentShaderSource
-*/
-QUrl ShaderProgram::vertexShaderSource() const
-{
- return d->vertexShaderSource;
-}
-
-void ShaderProgram::setVertexShaderSource(const QUrl &url)
-{
- if (!url.isEmpty() && url.isValid() && url != d->vertexShaderSource)
- {
- if (url.scheme() == QLatin1String("file"))
- {
- QString fn = url.toLocalFile();
- QFile vs(fn);
- if (vs.open(QIODevice::ReadOnly))
- {
- d->vertexShader = vs.readAll();
- d->vertexShaderSource = url;
- emit shaderChanged();
- emit effectChanged();
- d->regenerate = true;
- }
- else
- {
- qWarning() << "Unable to read" << url;
- }
- }
- else
- {
- qWarning() << "vertexShaderSource property does not (yet) support non-file URLs";
- }
- }
-}
-
-/*!
- \qmlproperty QUrl ShaderProgram::fragmentShaderSource
- This property allows the source for the fragment shader to be set to the contents
- of a file containing shader source code. This property and the vertexShader()
- property both effect the same underlying object, so setting one will override
- the other.
-
- Note that at present networked URLs are not supported, only local files. If a
- URL has not been set for the fragment shader, for example because it was
- specified via the fragmentShader() in-line shader code property, then this property
- will return a null (empty) QUrl.
-
- \sa fragmentShader, vertexShaderSource
-*/
-QUrl ShaderProgram::fragmentShaderSource() const
-{
- return d->fragmentShaderSource;
-}
-
-void ShaderProgram::setFragmentShaderSource(const QUrl &url)
-{
- if (!url.isEmpty() && url.isValid() && url != d->fragmentShaderSource)
- {
- if (url.scheme() == QLatin1String("file"))
- {
- QString fn = url.toLocalFile();
- QFile fs(fn);
- if (fs.open(QIODevice::ReadOnly))
- {
- d->fragmentShader = fs.readAll();
- d->fragmentShaderSource = url;
- emit shaderChanged();
- emit effectChanged();
- d->regenerate = true;
- }
- else
- {
- qWarning() << "Unable to read fragment shader" << url;
- }
- }
- else
- {
- qWarning() << "fragmentShaderSource property does not (yet) support non-file URLs";
- }
- }
-}
-
-/*!
- \internal
- Enables the effect for a given \a painter. If the effect has not been created yet, this function will
- attempt to do so.
-*/
-void ShaderProgram::enableEffect(QGLPainter *painter)
-{
- if (!d->shadersSupported && !d->regenerate) {
- // Use a simple fallback effect.
- QDeclarativeEffect::enableEffect(painter);
- return;
- }
- if (!d->effect) {
- // note that the ShaderProgramEffect can also be created when this
- // effect is applied to a QGLSceneNode if that happens first
- d->effect = new ShaderProgramEffect(this);
- if (!d->effect->create(d->vertexShader, d->fragmentShader)) {
- delete d->effect;
- d->effect = 0;
- QDeclarativeEffect::enableEffect(painter);
- d->regenerate = false;
- d->shadersSupported = false;
- return;
- }
- d->shadersSupported = true;
- } else if (d->regenerate) {
- if (!d->effect->create(d->vertexShader, d->fragmentShader)) {
- delete d->effect;
- d->effect = 0;
- QDeclarativeEffect::enableEffect(painter);
- d->regenerate = false;
- d->shadersSupported = false;
- return;
- }
- d->shadersSupported = true;
- }
- d->regenerate = false;
- painter->setUserEffect(d->effect);
- painter->setColor(color());
- QGLTexture2D *tex = texture2D();
- painter->glActiveTexture(GL_TEXTURE0);
- if (tex)
- tex->bind();
- else
- glBindTexture(GL_TEXTURE_2D, 0);
-}
-
-/*!
- \internal
- Set a scenenode's material and effect properties to enact this effect.
-
- This can happen before glInitialize, so setup is delayed until the effect is
- used or explicitly initialized.
-*/
-void ShaderProgram::applyTo(QGLSceneNode *node)
-{
- if (!d->effect) {
- // This function is often called during setup, before glInitilization,
- // so create the effect now, and then initializion it later.
- d->effect = new ShaderProgramEffect(this);
- d->regenerate = true;
- }
- node->setUserEffect(d->effect);
-}
-
-/*!
- \internal
- Mark all properties as dirty to be re-uploaded in the next update
-*/
-void ShaderProgram::markAllPropertiesDirty()
-{
- d->effect->setPropertiesDirty();
-}
-
-/*!
- \internal
- Mark a \a property as dirty to be re-uploaded in the next update
- */
-void ShaderProgram::markPropertyDirty(int property)
-{
- d->effect->setPropertyDirty(property);
-}
-
-/*!
- \qmlsignal ShaderProgram::onFinishedLoading()
- Emitted when the last remote resource request is resolved, and implies that
- the effect is ready to be displayed.
-*/
-
-/*!
- \internal
- A subclass without the Q_OBJECT macro in order to use the qt_metacall trick to track property changes.
-
- It is also conveniently placed to connect appropriate properties to
- Effect::effectChanged() to trigger timely updates.
- */
-ShaderProgramPropertyListenerEx::ShaderProgramPropertyListenerEx(ShaderProgram *parent, ShaderProgramEffect* effect)
- : ShaderProgramPropertyListener(parent), effect(effect)
-{
- shaderProgramMethodCount = parent->metaObject()->methodCount();
-}
-
-/*!
- \internal
-*/
-ShaderProgramPropertyListenerEx::~ShaderProgramPropertyListenerEx()
-{
-}
-
-/*!
- \internal
- Find calls to the "imaginary" slots, and mark the appropriate property
- as dirty.
-*/
-int ShaderProgramPropertyListenerEx::qt_metacall(QMetaObject::Call c, int id, void **a)
-{
- if (c == QMetaObject::InvokeMetaMethod )
- {
- if (id >= shaderProgramMethodCount) {
- effect->setPropertyDirty(id - shaderProgramMethodCount);
- emit propertyChanged();
- }
- // Consume the metacall
- return -1;
- }
-
- return ShaderProgramPropertyListener::qt_metacall(c, id, a);
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/threed/shaderprogram.h b/src/imports/threed/shaderprogram.h
deleted file mode 100644
index d1986614..00000000
--- a/src/imports/threed/shaderprogram.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHADERPROGRAM_H
-#define SHADERPROGRAM_H
-
-#include "qdeclarativeeffect.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class ShaderProgramPrivate;
-class QGLSceneNode;
-
-class ShaderProgram : public QDeclarativeEffect
-{
- Q_OBJECT
- Q_PROPERTY(QString vertexShader READ vertexShader WRITE setVertexShader NOTIFY shaderChanged)
- Q_PROPERTY(QString fragmentShader READ fragmentShader WRITE setFragmentShader NOTIFY shaderChanged)
- Q_PROPERTY(QUrl vertexShaderSource READ vertexShaderSource WRITE setVertexShaderSource NOTIFY shaderChanged)
- Q_PROPERTY(QUrl fragmentShaderSource READ fragmentShaderSource WRITE setFragmentShaderSource NOTIFY shaderChanged)
-public:
- ShaderProgram(QObject *parent = 0);
- virtual ~ShaderProgram();
-
- QString vertexShader() const;
- void setVertexShader(const QString& value);
-
- QString fragmentShader() const;
- void setFragmentShader(const QString& value);
-
- QUrl vertexShaderSource() const;
- void setVertexShaderSource(const QUrl &url);
-
- QUrl fragmentShaderSource() const;
- void setFragmentShaderSource(const QUrl &url);
-
- virtual void enableEffect(QGLPainter *painter);
- virtual void applyTo(QGLSceneNode *node);
-public Q_SLOTS:
- void markAllPropertiesDirty();
- void markPropertyDirty(int property);
-Q_SIGNALS:
- void finishedLoading();
- void shaderChanged();
-private:
- ShaderProgramPrivate *d;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(ShaderProgram)
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/threed/shaderprogram_p.h b/src/imports/threed/shaderprogram_p.h
deleted file mode 100644
index 6b67c4ce..00000000
--- a/src/imports/threed/shaderprogram_p.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SHADERPROGRAM_P_H
-#define SHADERPROGRAM_P_H
-
-#include <QtCore/qsharedpointer.h>
-#include <QtOpenGL/qglshaderprogram.h>
-
-#include "qdeclarativeeffect.h"
-#include "qglshaderprogrameffect.h"
-
-QT_BEGIN_NAMESPACE
-
-class ShaderProgram;
-class ShaderProgramEffect;
-
-/*!
- \internal
- This class's purpose is to be a proxy for signals for the main shader
- program.
-
- This is necessary so the qt_metacall trick can be used to tell apart
- the update signals from QML generated properties. (In short, each update
- signal is connected to an imaginary slot, but calling the slot is
- intercepted and replaced by a call to the appropriate update function).
-*/
-class ShaderProgramPropertyListener : public QObject
-{
- Q_OBJECT
-public:
- ShaderProgramPropertyListener(QObject* parent = 0)
- : QObject(parent)
- {
- }
- virtual ~ShaderProgramPropertyListener()
- {
- }
-Q_SIGNALS:
- void propertyChanged();
-};
-
-/*!
- \internal
- \sa ShaderProgramPropertyListener
-*/
-class ShaderProgramPropertyListenerEx : public ShaderProgramPropertyListener
-{
-public:
- ShaderProgramPropertyListenerEx(ShaderProgram* parent, ShaderProgramEffect* effect);
- ~ShaderProgramPropertyListenerEx();
-
-protected:
- virtual int qt_metacall(QMetaObject::Call c, int id, void **a);
- ShaderProgramEffect* effect;
-private:
- int shaderProgramMethodCount;
-};
-
-
-/*!
- \internal
- The ShaderProgramEffect class underlies the ShaderProgram class in Qml/3d.
- It contains the actual QGLShaderProgram along with all of the necessary
- parameters to use that program.
-*/
-class ShaderProgramEffect : public QGLShaderProgramEffect
-{
-public:
- ShaderProgramEffect(ShaderProgram* parent);
- virtual ~ShaderProgramEffect();
-
- bool create(const QString& vertexShader, const QString& fragmentShader);
-
- void update(QGLPainter *painter, QGLPainter::Updates updates);
- bool setUniformForPropertyIndex(int propertyIndex, QGLPainter *painter);
-
- void setPropertiesDirty();
- void setPropertyDirty(int property);
-
- void setAttributeFields(QGL::VertexAttribute fields);
-protected:
- void processTextureUrl(int uniformLocation, QString urlString);
- void afterLink();
-
-private:
- void setUniform(int uniformValue, const QImage& image,
- QGLPainter* painter);
- void setUniform(int uniformValue, const QPixmap pixmap,
- QGLPainter* painter);
- QGLTexture2D* textureForUniformValue(int uniformLocation);
- int textureUnitForUniformValue(int uniformLocation);
-
- QWeakPointer<ShaderProgram> parent;
- int nextTextureUnit;
- QMap<int, int> propertyIdsToUniformLocations;
- QMap<int, int> uniformLocationsToTextureUnits;
- QList<int> dirtyProperties;
- QArray<int> propertiesWithoutNotificationSignal;
- ShaderProgramPropertyListener* propertyListener;
-
- // Thes maps are all referenced by uniform location
- QMap<int, QGLTexture2D*> texture2Ds;
- QMap<int, QImage> images;
- QMap<int, QString> urls;
-
- // These are sets of uniform locations
- QSet<int> loadingTextures;
- QSet<int> changedTextures;
-};
-
-QT_END_NAMESPACE
-
-#endif // SHADERPROGRAM_P_H
diff --git a/src/imports/threed/skybox.cpp b/src/imports/threed/skybox.cpp
deleted file mode 100644
index aa0edbbc..00000000
--- a/src/imports/threed/skybox.cpp
+++ /dev/null
@@ -1,339 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "skybox.h"
-#include "qglbuilder.h"
-#include "qglcube.h"
-#include "qglpainter.h"
-#include "qglview.h"
-#include "viewport.h"
-
-#include <QDir>
-#include <QFileInfo>
-#include <QEvent>
-
-/*!
- \qmlclass Skybox Skybox
- \brief The Skybox item provides a simple 6-texture environment.
- \since 4.8
- \ingroup qt3d::qml3d
-
- The six textures of the Skybox completely encloses the camera,
- giving the illusion of a full 3D environment. Although the illusion
- is far from perfect it is adequate for many simple purposes. It is
- most suited to sky, clouds, remote landscapes (such as mountains) or
- possibly city skylines - anything where the textures represent an
- environment that is effectively infinitely distant from the camera.
-
- To use a skybox create a directory with six appropriately named images
- and place this alongside the main qml file, then specify the directory
- name for the \l{source} property:
-
- \code
- Viewport {
-
- Skybox {
- source: "skybox"
- }
-
- Cube { }
- }
- \endcode
-
- For an illustration of its use see the flickr3d example.
-*/
-const char * Skybox::EXPECTED_NAMES[] = {
- "_west", "_up", "_east", "_down", "_south", "_north", 0 };
-
-Skybox::Skybox(QObject *parent)
- : m_ready(false)
- , m_scene(0)
- , m_view(0)
- , m_camera(new QGLCamera(this))
-{
- m_view = qobject_cast<Viewport*>(parent);
-
- //Set the eye to to 0,0,0 and the near plane/view size such that
- //a wide variety of aspect ratios will display without undue
- //cropping against the near plane.
- m_camera->setEye(QVector3D());
- m_camera->setNearPlane(0.1f);
- m_camera->setViewSize(QSizeF(0.17f, 0.17f));
-
- QGLBuilder builder;
- builder.newSection(QGL::Faceted);
- QVector3D blb(-1.0, -1.0, -1.0);
- QVector3D blf(-1.0, -1.0, 1.0);
- QVector3D tlf(-1.0, 1.0, 1.0);
- QVector3D tlb(-1.0, 1.0, -1.0);
- QVector3D brb(1.0, -1.0, -1.0);
- QVector3D brf(1.0, -1.0, 1.0);
- QVector3D trf(1.0, 1.0, 1.0);
- QVector3D trb(1.0, 1.0, -1.0);
- QVector2D bl(0.0f, 0.0f);
- QVector2D br(1.0f, 0.0f);
- QVector2D tr(1.0f, 1.0f);
- QVector2D tl(0.0f, 1.0f);
- {
- QGeometryData q; // left
- builder.currentNode()->setObjectName("left");
- q.appendVertex(blf, blb, tlb, tlf);
- q.appendTexCoord(bl, br, tr, tl);
- builder.addQuads(q);
- m_faces[0] = builder.currentNode();
- m_faces[0]->setMaterial(new QGLMaterial);
- }
- {
- builder.newNode(); // top
- builder.currentNode()->setObjectName("top");
- QGeometryData q;
- q.appendVertex(trf, tlf, tlb, trb);
- q.appendTexCoord(bl, br, tr, tl);
- builder.addQuads(q);
- m_faces[1] = builder.currentNode();
- m_faces[1]->setMaterial(new QGLMaterial);
- }
- {
- builder.newNode(); // right
- builder.currentNode()->setObjectName("right");
- QGeometryData q;
- q.appendVertex(brb, brf, trf, trb);
- q.appendTexCoord(bl, br, tr, tl);
- builder.addQuads(q);
- m_faces[2] = builder.currentNode();
- m_faces[2]->setMaterial(new QGLMaterial);
- }
- {
- builder.newNode(); // bottom
- builder.currentNode()->setObjectName("bottom");
- QGeometryData q;
- q.appendVertex(brb, blb, blf, brf);
- q.appendTexCoord(bl, br, tr, tl);
- builder.addQuads(q);
- m_faces[3] = builder.currentNode();
- m_faces[3]->setMaterial(new QGLMaterial);
- }
- {
- builder.newNode(); // front
- builder.currentNode()->setObjectName("front");
- QGeometryData q;
- q.appendVertex(brf, blf, tlf, trf);
- q.appendTexCoord(bl, br, tr, tl);
- builder.addQuads(q);
- m_faces[4] = builder.currentNode();
- m_faces[4]->setMaterial(new QGLMaterial);
- }
- {
- builder.newNode(); // back
- builder.currentNode()->setObjectName("back");
- QGeometryData q;
- q.appendVertex(blb, brb, trb, tlb);
- q.appendTexCoord(bl, br, tr, tl);
- builder.addQuads(q);
- m_faces[5] = builder.currentNode();
- m_faces[5]->setMaterial(new QGLMaterial);
- }
- m_scene = builder.finalizedSceneNode();
- m_scene->setObjectName("SkyboxList");
- m_scene->setEffect(QGL::FlatReplaceTexture2D);
- m_scene->setEffectEnabled(true);
- m_scene->setParent(this);
-}
-
-/*!
- \internal
- Destroy this skybox returning all resources
-*/
-Skybox::~Skybox()
-{
-
-}
-/*!
- \internal
-
- Implement the event property to catch when the skybox is placed into a
- viewport parent.
-*/
-bool Skybox::event(QEvent *event)
-{
- if (event->type() == QEvent::ParentChange && !m_view)
- {
- setViewport(qobject_cast<Viewport*>(parent()));
- }
- return QObject::event(event);
-}
-
-/*!
- \qmlproperty Viewport Mesh::viewport
-
- This property holds the viewport which this Skybox will be displayed
- inside. The skybox will completely fill the viewport, but since it is
- drawn first, and with depth buffering off, all other content in the
- given viewport will overlay the skybox making it appear infinitely
- distant.
-
- Generally this property should not need to be set as the skybox can be
- simply placed inside the viewport element in which it should display.
-*/
-void Skybox::setViewport(Viewport *view)
-{
- if (m_view != view)
- {
- m_view = view;
- emit viewportChanged();
- }
-}
-
-void Skybox::scanLocalDir(const QString &imagePath)
-{
- m_imagePath = imagePath;
- QStringList notFound;
- const char **exp = EXPECTED_NAMES;
- for ( ; *exp; ++exp)
- notFound << QLatin1String(*exp);
- QFileInfo info(m_imagePath);
- if (info.exists() && info.isDir())
- {
- QDir imDir(imagePath);
- QFileInfoList files = imDir.entryInfoList(QDir::Files);
- QFileInfoList::const_iterator it = files.constBegin();
- for ( ; it != files.constEnd() && notFound.size() > 0; ++it)
- {
- QFileInfo ent = *it;
- QString tok = ent.baseName().toLower();
- for (int ix = 0; EXPECTED_NAMES[ix]; ++ix)
- {
- if (tok.contains(EXPECTED_NAMES[ix]))
- {
- QUrl url;
- url.setScheme("file");
- url.setPath(ent.absoluteFilePath());
- m_faces[ix]->material()->setTextureUrl(url);
- m_faces[ix]->material()->texture()->setHorizontalWrap(QGL::ClampToEdge);
- m_faces[ix]->material()->texture()->setVerticalWrap(QGL::ClampToEdge);
- notFound.removeOne(QLatin1String(EXPECTED_NAMES[ix]));
- break;
- }
- }
- }
- if (notFound.size() > 0)
- {
- qWarning() << imagePath << "did not contain a skybox image for" << notFound;
- }
- }
- else
- {
- qWarning() << imagePath << "was not a directory of skybox images";
- }
-}
-
-/*!
- \qmlproperty url Skybox::source
-
- The location where the 6 textures for the skybox are stored. The textures are
- in any image format that Qt can load, but must have names that contain the following
- strings:
- \list
- \o "_up"
- \o "_down"
- \o "_west"
- \o "_east"
- \o "_north"
- \o "_south"
- \endlist
- These textures are then attached to the appropriate faces of the skybox.
-*/
-void Skybox::setSource(const QUrl &source)
-{
- if (source != m_source)
- {
- m_source = source;
- if (m_source.scheme() == QLatin1String("file"))
- {
- scanLocalDir(m_source.toLocalFile());
- }
- else
- {
- // TODO - handle network case
- qWarning() << "Network support for skybox images not yet implemented";
- }
- emit sourceChanged();
- }
-}
-
-void Skybox::draw(QGLPainter *painter) const
-{
- if (!m_view)
- return;
- painter->modelViewMatrix().push();
- painter->modelViewMatrix().setToIdentity();
-
- QGLCamera *cam = m_view->camera();
- m_camera->setCenter(-cam->eye());
- painter->setCamera(m_camera);
-
- glDisable(GL_DEPTH_TEST);
-
- m_scene->draw(painter);
-
- glEnable(GL_DEPTH_TEST);
-
- painter->setCamera(cam);
- painter->modelViewMatrix().pop();
-}
-
-/*!
- \internal
-*/
-void Skybox::classBegin()
-{
-}
-
-/*!
- \internal
- Checks that all loading and initialisation has been finished, and emits the loaded() signal if
- the component is complete.
-
- \sa loaded()
-*/
-void Skybox::componentComplete()
-{
-}
diff --git a/src/imports/threed/skybox.h b/src/imports/threed/skybox.h
deleted file mode 100644
index b9baef85..00000000
--- a/src/imports/threed/skybox.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SKYBOX_H
-#define SKYBOX_H
-
-#include <QString>
-#include <QObject>
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtDeclarative/qdeclarative.h>
-#include <QtDeclarative/qdeclarativeengine.h>
-#include <QtDeclarative/qdeclarativeparserstatus.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGLSceneNode;
-class QGLPainter;
-class QGLView;
-class QGLCamera;
-class Viewport;
-
-class Skybox : public QObject, public QDeclarativeParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QDeclarativeParserStatus)
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(Viewport *viewport READ viewport WRITE setViewport NOTIFY viewportChanged)
-public:
- Skybox(QObject *parent = 0);
- ~Skybox();
- QUrl source() const { return m_source; }
- void setSource(const QUrl &url);
- void draw(QGLPainter *painter) const;
- Viewport *viewport() const
- {
- return m_view;
- }
- void setViewport(Viewport *view);
-
- void classBegin();
- void componentComplete();
-
-Q_SIGNALS:
- void sourceChanged();
- void viewportChanged();
-
-protected:
- bool event(QEvent *event);
-
-private:
- void scanLocalDir(const QString &imagePath);
-
- static const char *EXPECTED_NAMES[];
-
- bool m_ready;
- QGLSceneNode *m_scene;
- QString m_imagePath;
- QUrl m_source;
- QGLSceneNode *m_faces[6];
- Viewport *m_view;
- QGLCamera *m_camera;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(Skybox)
-
-QT_END_HEADER
-
-#endif // SKYBOX_H
diff --git a/src/imports/threed/threed.cpp b/src/imports/threed/threed.cpp
deleted file mode 100644
index 3effca86..00000000
--- a/src/imports/threed/threed.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarativeengine.h>
-#include <QtDeclarative/qdeclarativecontext.h>
-#include <QtDeclarative/qdeclarative.h>
-
-#include "qdeclarativeitem3d.h"
-#include "qdeclarativemesh.h"
-#include "viewport.h"
-#include "qdeclarativeeffect.h"
-#include "scale3d.h"
-#include "skybox.h"
-
-#include "qgraphicsrotation3d.h"
-#include "qgraphicstranslation3d.h"
-#include "qgraphicsscale3d.h"
-#include "qgraphicsbillboardtransform.h"
-#include "qglscenenode.h"
-
-#include "qgraphicslookattransform.h"
-#include "shaderprogram.h"
-#include "qt3dnamespace.h"
-
-#include "billboarditem3d.h"
-
-QML_DECLARE_TYPE(QGraphicsTransform3D)
-QML_DECLARE_TYPE(QGraphicsRotation3D)
-QML_DECLARE_TYPE(QGraphicsTranslation3D)
-QML_DECLARE_TYPE(QGraphicsScale3D)
-QML_DECLARE_TYPE(QGraphicsBillboardTransform)
-QML_DECLARE_TYPE(QGraphicsLookAtTransform)
-QML_DECLARE_TYPE(QGLMaterial)
-QML_DECLARE_TYPE(QGLLightModel)
-QML_DECLARE_TYPE(QGLLightParameters)
-QML_DECLARE_TYPE(QGLCamera)
-
-QT_BEGIN_NAMESPACE
-
-class QThreedQmlModule : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt3D"));
- qmlRegisterType<QGLSceneNode>(uri,1,0,"SceneNode");
- qmlRegisterType<QDeclarativeEffect>(uri,1,0,"Effect");
- qmlRegisterType<QDeclarativeMesh>(uri,1,0,"Mesh");
- qmlRegisterType<QDeclarativeItem3D>(uri,1,0,"Item3D");
- qmlRegisterType<QGLLightModel>(uri,1,0,"LightModel");
- qmlRegisterType<QGLLightParameters>(uri,1,0,"Light");
- qmlRegisterType<QGLCamera>(uri,1,0,"Camera");
- qmlRegisterType<QGraphicsRotation3D>(uri,1,0,"Rotation3D");
- qmlRegisterType<QGraphicsTranslation3D>(uri,1,0,"Translation3D");
- qmlRegisterType<Scale3D>(uri,1,0,"Scale3D");
- qmlRegisterType<QGraphicsBillboardTransform>(uri,1,0,"BillboardTransform");
- qmlRegisterType<QGraphicsLookAtTransform>(uri,1,0,"LookAt");
- qmlRegisterType<QGLMaterial>(uri,1,0,"Material");
- qmlRegisterType<ShaderProgram>(uri,1,0,"ShaderProgram");
- qmlRegisterType<Skybox>(uri, 1, 0, "Skybox");
- qmlRegisterType<BillboardItem3D>(uri, 1, 0, "BillboardItem3D");
-
- qmlRegisterType<Viewport>(uri,1,0,"Viewport");
-
- // Needed to make QDeclarativeListProperty<QGraphicsTransform3D> work.
- qmlRegisterType<QGraphicsTransform3D>();
- qmlRegisterType<QGraphicsScale3D>();
-
-#ifdef QT_USE_SCENEGRAPH
- qmlRegisterType<ViewportSG>(uri,2,0,"Viewport");
-#endif
- }
- void initializeEngine(QDeclarativeEngine *engine, const char *uri)
- {
- Q_UNUSED(uri);
- QDeclarativeContext *context = engine->rootContext();
- context->setContextProperty(QLatin1String("Qt3D"), new Qt3DNamespace);
- }
-};
-
-QT_END_NAMESPACE
-
-#include "threed.moc"
-
-Q_EXPORT_PLUGIN2(qthreedqmlplugin, QT_PREPEND_NAMESPACE(QThreedQmlModule));
diff --git a/src/imports/threed/threed.pro b/src/imports/threed/threed.pro
deleted file mode 100644
index c674d22e..00000000
--- a/src/imports/threed/threed.pro
+++ /dev/null
@@ -1,74 +0,0 @@
-TEMPLATE = lib
-TARGET = qthreedqmlplugin
-CONFIG += qt plugin
-
-CONFIG += qt3dquick_deploy_pkg
-include(../../../pkg.pri)
-
-# See the README in the root dir re this code
-package {
- target.path += $$QT3D_INSTALL_IMPORTS/Qt3D
- INSTALLS += target
-} else {
- CONFIG += qt3dquick qt3d
- DESTDIR = $$QT3D_INSTALL_IMPORTS/Qt3D
-}
-
-win32 {
- CONFIG(debug, debug|release) {
- TARGET = $$member(TARGET, 0)d
- }
-}
-
-symbian {
- CONFIG += epocallowdlldata
- MMP_RULES += EXPORTUNFROZEN
- LIBS += -lQt3D$${QT_LIBINFIX} -lQt3DQuick$${QT_LIBINFIX}
- TARGET.CAPABILITY = All -Tcb
- TARGET.UID3 = 0x20031E9B
-}
-
-SOURCES += \
- threed.cpp \
- qt3dnamespace.cpp \
- scale3d.cpp \
- viewport.cpp \
- qgraphicslookattransform.cpp \
- shaderprogram.cpp \
- skybox.cpp \
- billboarditem3d.cpp
-
-HEADERS += \
- qt3dnamespace.h \
- scale3d.h \
- viewport.h \
- qgraphicslookattransform.h \
- shaderprogram.h \
- shaderprogram_p.h \
- skybox.h \
- billboarditem3d.h
-
-# See the file README.library_xml for more on this
-QML_INFRA_FILES += \
- qmldir \
- library.xml \
- plugins.qmltypes
-
-package {
- copyqmlinfra_install.files = $$QML_INFRA_FILES
- copyqmlinfra_install.path = $$QT3D_INSTALL_IMPORTS/Qt3D
- INSTALLS += copyqmlinfra_install
-} else {
- copyqmlinfra.input = QML_INFRA_FILES
- copyqmlinfra.output = $$[QT_INSTALL_IMPORTS]/Qt3D/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
- copyqmlinfra.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
- copyqmlinfra.CONFIG += no_link_no_clean
- copyqmlinfra.variable_out = PRE_TARGETDEPS
- QMAKE_EXTRA_COMPILERS += copyqmlinfra
-}
-
-OTHER_FILES += \
- README.plugins_types \
- README.library_xml
-
-
diff --git a/src/imports/threed/viewport.cpp b/src/imports/threed/viewport.cpp
deleted file mode 100644
index 5f4169e3..00000000
--- a/src/imports/threed/viewport.cpp
+++ /dev/null
@@ -1,1289 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "viewport.h"
-#include "qdeclarativeeffect.h"
-
-#include "qgllightmodel.h"
-#include "qgllightparameters.h"
-#include "qglcamera.h"
-#include "qglview.h"
-#include "qglsubsurface.h"
-#include "qray3d.h"
-#include "qglframebufferobjectsurface.h"
-#include "skybox.h"
-
-#include <QtGui/qpainter.h>
-#include <QtGui/qgraphicsview.h>
-#include <QtGui/qgraphicsscene.h>
-#include <QtGui/qgraphicssceneevent.h>
-#include <QtGui/qevent.h>
-#include <QtOpenGL/qglframebufferobject.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qpointer.h>
-
-/*!
- \qmlclass Viewport Viewport
- \brief The Viewport item defines the logical viewport for a 3D scene. It includes all necessary
- references and parameters for the contents of the scene, as well as drawing and painting functions
- \since 4.8
- \ingroup qt3d::qml3d
-
- The Viewport item is usually the outermost in a 3D scene, specifying
- the size of the view, the camera position, lights, and the main 3D object:
-
- \code
- import QtQuick 1.0
- import Qt3D 1.0
-
- Viewport {
- width: 640; height: 480
- camera: Camera {}
- light: Light {}
- Item3D {
- mesh: Mesh { source: "meshes/teapot.bez" }
- effect: Effect {}
- }
- }
- \endcode
-
- \sa Camera
-*/
-
-QT_BEGIN_NAMESPACE
-
-class ViewportPrivate
-{
-public:
- ViewportPrivate();
- ~ViewportPrivate();
-
- bool picking;
- bool showPicking;
- bool showSceneGraph;
- int dumpCount;
- bool navigation;
- bool fovzoom;
- bool blending;
- bool itemsInitialized;
- bool needsPick;
- QGLCamera *camera;
- QGLLightParameters *light;
- QGLLightModel *lightModel;
- QWidget *viewWidget;
- int pickId;
- QGLFramebufferObject *pickFbo;
- QMap<int, QObject *> objects;
- QPointer<QObject> pressedObject;
- Qt::MouseButton pressedButton;
- QPointer<QObject> enteredObject;
- bool panning;
- QPointF startPan;
- QPointF lastPan;
- QVector3D startEye;
- QVector3D startCenter;
- QVector3D startUpVector;
- Qt::KeyboardModifiers panModifiers;
- QMap<int, QObject*> earlyDrawList;
-
- void setDefaults(QGLPainter *painter);
-};
-
-ViewportPrivate::ViewportPrivate()
- : picking(false)
- , showPicking(false)
- , showSceneGraph(false)
- , dumpCount(10) // maybe this needs to be higher?
- , navigation(true)
- , fovzoom(false)
- , blending(false)
- , itemsInitialized(false)
- , needsPick(true)
- , camera(0)
- , light(0)
- , lightModel(0)
- , viewWidget(0)
- , pickId(1)
- , pickFbo(0)
- , pressedObject(0)
- , pressedButton(Qt::NoButton)
- , enteredObject(0)
- , panning(false)
- , startPan(-1, -1)
- , lastPan(-1, -1)
- , panModifiers(Qt::NoModifier)
-{
-}
-
-ViewportPrivate::~ViewportPrivate()
-{
- delete pickFbo;
-}
-
-void ViewportPrivate::setDefaults(QGLPainter *painter)
-{
- // Set the default depth buffer options.
- glDepthFunc(GL_LESS);
- glDepthMask(GL_TRUE);
-#if defined(QT_OPENGL_ES)
- glDepthRangef(0.0f, 1.0f);
-#else
- glDepthRange(0.0f, 1.0f);
-#endif
-
- // Set the default blend options.
- glDisable(GL_BLEND);
- if (painter->hasOpenGLFeature(QOpenGLFunctions::BlendColor))
- painter->glBlendColor(0, 0, 0, 0);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if (painter->hasOpenGLFeature(QOpenGLFunctions::BlendEquation))
- painter->glBlendEquation(GL_FUNC_ADD);
- else if (painter->hasOpenGLFeature(QOpenGLFunctions::BlendEquationSeparate))
- painter->glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
-}
-
-/*!
- \internal
- Construct the class and assign it a \a parent QDeclarativeItem.
-*/
-Viewport::Viewport(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
-{
- d = new ViewportPrivate();
- setFlag(QGraphicsItem::ItemHasNoContents, false);
-
- connect(this, SIGNAL(viewportChanged()), this, SLOT(update3d()));
-
- setCamera(new QGLCamera(this));
- setLight(new QGLLightParameters(this));
-
- setAcceptedMouseButtons(Qt::LeftButton);
- setAcceptHoverEvents(true);
-}
-
-/*!
- \internal
- Class destruction and cleanup.
-*/
-Viewport::~Viewport()
-{
- delete d;
-}
-
-/*!
- \qmlproperty bool Viewport::picking
-
- User interaction in QML/3d is handled through the concept of object picking. Each
- item has a unique picking id which is queried for a given screen click position when the
- mouse is clicked.
-
- If this property is set to true, picking will be supported for this
- viewport, while if the property is false, no picking will be applied.
-
- The default value for this property is false.
-
- \sa showPicking
-*/
-bool Viewport::picking() const
-{
- return d->picking;
-}
-
-void Viewport::setPicking(bool value)
-{
- d->picking = value;
- emit viewportChanged();
-}
-
-/*!
- \qmlproperty bool Viewport::showPicking
- The underlying mechanism for picking is based on painting an off-screen buffer with a flat
- coloured image containing all of the objects with a unique color value.
-
- Setting this property to true will display this flat-colour picking
- representation in the viewport, which can be useful for debugging
- problems with object selection.
-
- The default value for this property is false.
-
- \sa picking
-*/
-
-bool Viewport::showPicking() const
-{
- return d->showPicking;
-}
-
-void Viewport::setShowPicking(bool value)
-{
- d->showPicking = value;
- emit viewportChanged();
-}
-
-/*!
- \qmlproperty bool Viewport::showSceneGraph
-
- This property controls whether or not the 3D scenegraph structure is dumped
- to the console when the viewport is first rendered. Studying the output can be very
- useful for optimising the scene, and for detecting issues with rendering, such
- as misplaced textures, materials, geometry and so on.
-
- By default the value is set to false.
-*/
-bool Viewport::showSceneGraph() const
-{
- return d->showSceneGraph;
-}
-
-void Viewport::setShowSceneGraph(bool show)
-{
- if (show != d->showSceneGraph)
- {
- d->showSceneGraph = show;
- emit showSceneGraphChanged();
- }
-}
-
-/*!
- \qmlproperty bool Viewport::navigation
-
- This property is used to set or unset camera navigation in for the viewport.
- Camera navigation allows the user to move the camera position around using the mouse.
-
- By default, camera navigation is set to true.
-*/
-bool Viewport::navigation() const
-{
- return d->navigation;
-}
-
-void Viewport::setNavigation(bool value)
-{
- d->navigation = value;
- emit viewportChanged();
-}
-
-/*!
- \qmlproperty bool Viewport::fovzoom
-
- This property is used to set or unset zooming based on field-of-view (fov). Normally
- zooming is achieved by moving the camera physically closer to the target object. This
- options achieves zooming by narrowing or broadening the fov.
-
- By default, fov zooming is set to false.
-*/
-bool Viewport::fovzoom() const
-{
- return d->fovzoom;
-}
-
-void Viewport::setFovzoom(bool value)
-{
- d->fovzoom = value;
- emit viewportChanged();
-}
-
-
-/*!
- \qmlproperty bool Viewport::blending
-
- The blending property is used to enable or disable GL_BLEND
- on the viewport, for alpha blending of drawn objects.
-
- By default, blending is set to false.
-
- \sa Effect::blending
-*/
-bool Viewport::blending() const
-{
- return d->blending;
-}
-
-void Viewport::setBlending(bool value)
-{
- d->blending = value;
- emit viewportChanged();
-}
-
-/*!
- \qmlproperty Camera Viewport::camera
-
- This property sets the camera parameters which will be used for
- the appropriate viewing transforms in OpenGL. The default is
- a perspective camera with its eye located at (0, 0, 10) looking
- at the center (0, 0, 0), with the y axis as up.
-*/
-QGLCamera *Viewport::camera() const
-{
- return d->camera;
-}
-
-void Viewport::setCamera(QGLCamera *value)
-{
- if (d->camera != value) {
- if (d->camera) {
- disconnect(d->camera, SIGNAL(projectionChanged()),
- this, SLOT(cameraChanged()));
- disconnect(d->camera, SIGNAL(viewChanged()),
- this, SLOT(cameraChanged()));
- }
- d->camera = value;
- if (d->camera) {
- connect(d->camera, SIGNAL(projectionChanged()),
- this, SLOT(cameraChanged()));
- connect(d->camera, SIGNAL(viewChanged()),
- this, SLOT(cameraChanged()));
- }
- cameraChanged();
- }
-}
-
-/*!
- \qmlproperty Light Viewport::light
-
- This property defines the main scene light to use for 3D items
- that are drawn in this viewport.
-
- \sa lightModel
-*/
-
-QGLLightParameters *Viewport::light() const
-{
- return d->light;
-}
-
-void Viewport::setLight(QGLLightParameters *value)
-{
- if (d->light != value) {
- if (d->light) {
- disconnect(d->light, SIGNAL(lightChanged()),
- this, SLOT(update3d()));
- }
- d->light = value;
- if (d->light) {
- connect(d->light, SIGNAL(lightChanged()),
- this, SLOT(update3d()));
- }
- emit viewportChanged();
- }
-}
-
-/*!
- \qmlproperty LightModel Viewport::lightModel
- The user is able to set a lighting model for the 3d environment through the use of the
- lightModel property. By default the light model is undefined.
-
- \sa light
-*/
-QGLLightModel *Viewport::lightModel() const
-{
- return d->lightModel;
-}
-
-void Viewport::setLightModel(QGLLightModel *value)
-{
- if (d->lightModel != value) {
- if (d->lightModel) {
- disconnect(d->lightModel, SIGNAL(lightModelChanged()),
- this, SLOT(update3d()));
- }
- d->lightModel = value;
- if (d->lightModel) {
- connect(d->lightModel, SIGNAL(lightModelChanged()),
- this, SLOT(update3d()));
- }
- emit viewportChanged();
- }
-}
-
-class ViewportSubsurface : public QGLSubsurface
-{
-public:
- ViewportSubsurface(QGLAbstractSurface *surface, const QRect &region,
- qreal adjust)
- : QGLSubsurface(surface, region), m_adjust(adjust) {}
-
- qreal aspectRatio() const;
-
-private:
- qreal m_adjust;
-};
-
-qreal ViewportSubsurface::aspectRatio() const
-{
- return QGLSubsurface::aspectRatio() * m_adjust;
-}
-
-/*!
- \internal
- The main paint function for the Viewport class. It takes a QPainter \a p, which performs the
- painting of objects in the 3d environment.
-
- The paint function is responsible for setting up the viewing transform, as well as other display
- options, before calling the draw function to perform the actual drawing of the scene.
-
- Note, currently \a style and \a widget are unused, but are reserved for later development.
-*/
-void Viewport::paint(QPainter *p, const QStyleOptionGraphicsItem * style, QWidget *widget)
-{
- Q_UNUSED(style);
-
- if (!d->viewWidget)
- d->viewWidget = widget;
- d->needsPick = true;
-
- QGLPainter painter;
- if (!painter.begin(p)) {
- if (widget) {
- // Probably running with a plain QDeclarativeView (e.g. qmlviewer).
- // We need to have switched the surrounding QGraphicsView to use a
- // QGLWidget as its viewport.
- QGraphicsView *view =
- qobject_cast<QGraphicsView *>(widget->parentWidget());
- if (!view) {
- return;
- } else {
- QGLWidget *glw = qobject_cast<QGLWidget *>(view->viewport());
- if (!glw) {
- qWarning("GL graphics system is not active; cannot use 3D items");
- return;
- }
- }
- }
- }
-
- // Initialize the objects in the scene if this is the first paint.
- if (!d->itemsInitialized)
- initializeGL(&painter);
-
- painter.setEye(QGL::NoEye);
- qreal adjust = 1.0f;
-
- // Modify the GL viewport to only cover the extent of this QDeclarativeItem.
- QTransform transform = p->combinedTransform();
- QRect viewport = transform.mapRect(boundingRect()).toRect();
- ViewportSubsurface surface(painter.currentSurface(), viewport, adjust);
- painter.pushSurface(&surface);
-
- // Perform early drawing operations.
- earlyDraw(&painter);
-
- // Set up the camera the way QGLView would if we were using it.
- if (d->camera) {
- painter.setCamera(d->camera);
- } else {
- QGLCamera defCamera;
- painter.setCamera(&defCamera);
- }
-
- // Draw the Item3D children.
- painter.setPicking(d->showPicking);
- draw(&painter);
- painter.setPicking(false);
- painter.popSurface();
-
- // Disable the effect to return control to the GL paint engine.
- painter.disableEffect();
-
- // Try to restore the GL state to something paint-engine compatible.
- glDisable(GL_CULL_FACE);
- d->setDefaults(&painter);
- glDisable(GL_DEPTH_TEST);
-
-}
-
-/*!
- \internal
-*/
-void Viewport::earlyDraw(QGLPainter *painter)
-{
- // If we have a parent, then assume that the parent has painted
- // the background and overpaint over the top of it. If we don't
- // have a parent, then clear to black.
- if (parentItem()) {
- glClear(GL_DEPTH_BUFFER_BIT);
- } else {
- painter->setClearColor(Qt::black);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
-
- // Force the effect to be updated. The GL paint engine
- // has left the GL state in an unknown condition.
- painter->disableEffect();
-
-#ifdef GL_RESCALE_NORMAL
- glEnable(GL_RESCALE_NORMAL);
-#endif
-
- // Set the default effect for the scene.
- painter->setStandardEffect(QGL::LitMaterial);
- painter->setFaceColor(QGL::AllFaces, Qt::white);
-}
-
-/*!
- \internal
- The draw function for the viewport sets up all of the lighting parameters for the scene before
- iterating through the top level items in the scene and drawing them using \a painter.
-
- As a matter of course each item will draw its child items, and so on, until the entire image has
- been populated.
-*/
-void Viewport::draw(QGLPainter *painter)
-{
- // Set up the initial depth, blend, and other options.
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS);
- glDepthMask(GL_TRUE);
-#if defined(QT_OPENGL_ES)
- glDepthRangef(0.0f, 1.0f);
-#else
- glDepthRange(0.0f, 1.0f);
-#endif
-
- // At present only skyboxes work, with early draw and they are drawn
- // without blending and without a lighting model - just flat texture rendering
- int cnt = d->earlyDrawList.size();
- int order = 0;
- while (cnt)
- {
- QMap<int, QObject *>::const_iterator it = d->earlyDrawList.constFind(order);
- while (it != d->earlyDrawList.constEnd())
- {
- // TODO: make more than just skybox work with early draw
- Skybox *sb = qobject_cast<Skybox *>(*it);
- if (sb)
- sb->draw(painter);
- ++it;
- --cnt;
- }
- ++order;
- }
-
- if (d->blending)
- glEnable(GL_BLEND);
- else
- glDisable(GL_BLEND);
- if (painter->hasOpenGLFeature(QOpenGLFunctions::BlendColor))
- painter->glBlendColor(0, 0, 0, 0);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if (painter->hasOpenGLFeature(QOpenGLFunctions::BlendEquation))
- painter->glBlendEquation(GL_FUNC_ADD);
- else if (painter->hasOpenGLFeature(QOpenGLFunctions::BlendEquationSeparate))
- painter->glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
- glDisable(GL_CULL_FACE);
-
- painter->setObjectPickId(-1);
- QObjectList list = QObject::children();
- painter->setMainLight(d->light, QMatrix4x4());
- painter->setLightModel(d->lightModel);
- foreach (QObject *child, list) {
- QDeclarativeItem3D *item = qobject_cast<QDeclarativeItem3D *>(child);
- if (item)
- {
- if (d->showSceneGraph && (d->dumpCount == 0))
- qDumpItem(item);
- item->draw(painter);
- }
- }
- if (d->dumpCount >= 0)
- --d->dumpCount;
-}
-
-/*!
- \internal
- Initialize the GL viewport for the first time on \a painter.
-*/
-
-void Viewport::initializeGL(QGLPainter *painter)
-{
- // Initialize the Item3D objects attached to this scene.
- QObjectList list = QObject::children();
- foreach (QObject *child, list) {
- QDeclarativeItem3D *item = qobject_cast<QDeclarativeItem3D *>(child);
- if (item) {
- setItemViewport(item);
- item->initialize(painter);
- }
- // TODO: make this more generic with some sort of abstract interface
- // so that more than just skybox works with early draw
- Skybox *sb = qobject_cast<Skybox *>(child);
- if (sb)
- {
- sb->setViewport(this);
- registerEarlyDrawObject(sb, 0);
- }
- }
- d->itemsInitialized = true;
-}
-
-/*!
- \internal
- Registers \a obj with this viewport as a pickable object and
- return its pick identifier.
-*/
-int Viewport::registerPickableObject(QObject *obj)
-{
- int id = (d->pickId)++;
- d->objects[id] = obj;
- return id;
-}
-
-void Viewport::registerEarlyDrawObject(QObject *obj, int order)
-{
- d->earlyDrawList.insertMulti(order, obj);
-}
-
-/*!
- \internal
- Returns the registered object that is under the mouse position
- specified by (\a x, \a y). This function may need to regenerate
- the contents of the pick buffer by repainting the scene.
-*/
-QObject *Viewport::objectForPoint(qreal x, qreal y)
-{
- if (!d->viewWidget)
- return 0;
-
- // Check the viewport boundaries in case a mouse move has
- // moved the pointer outside the window.
- QRectF rect = boundingRect();
- if (!rect.contains(QPointF(x, y)))
- return 0;
-
- QPainter qpainter;
- QGLPainter painter;
- QGLWidget *glw = qobject_cast<QGLWidget *>(d->viewWidget);
- bool painterValid = false;
- bool doubleBuffer = false;
- if (glw && painter.begin(glw)) {
- doubleBuffer = glw->doubleBuffer();
- painterValid = true;
- } else if (qpainter.begin(d->viewWidget) && painter.begin(&qpainter)) {
- painterValid = true;
- }
-
- if (!painterValid && !QGLContext::currentContext()) {
- // Won't be able to read or generate a pick buffer, so bail out.
- return 0;
- }
-
- int objectId = -1;
-
- QSize size(qRound(width()), qRound(height()));
- QSize fbosize(QGL::nextPowerOfTwo(size));
- if (!d->needsPick && d->pickFbo && d->pickFbo->size() == fbosize
- && painterValid) {
- // The previous pick fbo contents should still be valid.
- d->pickFbo->bind();
- objectId = painter.pickObject(qRound(x), fbosize.height() - 1 - qRound(y));
- d->pickFbo->release();
- } else {
- // Regenerate the pick fbo contents.
- QGLAbstractSurface *mainSurface = 0;
- QGLAbstractSurface *fboSurface = 0;
- int height;
- if (!doubleBuffer) {
- if (d->pickFbo && d->pickFbo->size() != fbosize) {
- delete d->pickFbo;
- d->pickFbo = 0;
- }
- if (!d->pickFbo) {
- d->pickFbo = new QGLFramebufferObject
- (fbosize, QGLFramebufferObject::CombinedDepthStencil);
- }
- height = fbosize.height();
- fboSurface = new QGLFramebufferObjectSurface(d->pickFbo);
- mainSurface = fboSurface;
- } else if (painterValid) {
- // Use the QGLWidget's back buffer for picking to avoid the
- // need to create a separate fbo in GPU memory.
- mainSurface = painter.currentSurface();
- height = mainSurface->viewportGL().height();
- }
- QGLSubsurface surface(mainSurface, QRect(QPoint(0, 0), size));
- // If our view is a hijacked QWidget, we're going to have failed
- // to find a QGLWidget, but we'll still have a QGLContext and be able
- // to draw the pick buffer into the pickFbo.
- if (painterValid || painter.begin(&surface)) {
- if (painterValid)
- painter.pushSurface(&surface);
- painter.setPicking(true);
- painter.clearPickObjects();
- painter.setClearColor(Qt::black);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- painter.setEye(QGL::NoEye);
- glEnable(GL_DEPTH_TEST);
- glDepthFunc(GL_LESS);
- glDepthMask(GL_TRUE);
-#if defined(QT_OPENGL_ES)
- glDepthRangef(0.0f, 1.0f);
-#else
- glDepthRange(0.0f, 1.0f);
-#endif
- glDisable(GL_BLEND);
- if (painter.hasOpenGLFeature(QOpenGLFunctions::BlendColor))
- painter.glBlendColor(0, 0, 0, 0);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- if (painter.hasOpenGLFeature(QOpenGLFunctions::BlendEquation))
- painter.glBlendEquation(GL_FUNC_ADD);
- else if (painter.hasOpenGLFeature(QOpenGLFunctions::BlendEquationSeparate))
- painter.glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
- glDisable(GL_CULL_FACE);
- if (d->camera) {
- painter.setCamera(d->camera);
- } else {
- QGLCamera defCamera;
- painter.setCamera(&defCamera);
- }
- draw(&painter);
- painter.setPicking(false);
- objectId = painter.pickObject(qRound(x), height - 1 - qRound(y));
- painter.popSurface();
- painter.end();
- }
- delete fboSurface;
- }
-
- d->needsPick = doubleBuffer;
- return d->objects.value(objectId, 0);
-}
-
-/*!
- \internal
-*/
-void Viewport::update3d()
-{
- update();
-}
-
-/*!
- \internal
-*/
-void Viewport::cameraChanged()
-{
- update();
-}
-
-static inline void sendEnterEvent(QObject *object)
-{
- QEvent event(QEvent::Enter);
- QCoreApplication::sendEvent(object, &event);
-}
-
-static inline void sendLeaveEvent(QObject *object)
-{
- QEvent event(QEvent::Leave);
- QCoreApplication::sendEvent(object, &event);
-}
-
-/*!
- \internal
-*/
-void Viewport::mousePressEvent(QGraphicsSceneMouseEvent *e)
-{
- QObject *object;
- if (!d->panning && d->picking)
- object = objectForPoint(e->pos());
- else
- object = 0;
- if (d->pressedObject) {
- // Send the press event to the pressed object. Use a position
- // of (0, 0) if the mouse is still within the pressed object,
- // or (-1, -1) if the mouse is no longer within the pressed object.
- QMouseEvent event
- (QEvent::MouseButtonPress,
- (d->pressedObject == object) ? QPoint(0, 0) : QPoint(-1, -1),
- e->screenPos(), e->button(), e->buttons(), e->modifiers());
- QCoreApplication::sendEvent(d->pressedObject, &event);
- } else if (object) {
- // Record the object that was pressed and forward the event.
- d->pressedObject = object;
- d->enteredObject = 0;
- d->pressedButton = e->button();
-
- // Send a mouse press event for (0, 0).
- QMouseEvent event(QEvent::MouseButtonPress, QPoint(0, 0),
- e->screenPos(), e->button(), e->buttons(),
- e->modifiers());
- QCoreApplication::sendEvent(object, &event);
- } else if (d->navigation && e->button() == Qt::LeftButton) {
- d->panning = true;
- d->lastPan = d->startPan = e->pos();
- d->startEye = d->camera->eye();
- d->startCenter = d->camera->center();
- d->startUpVector = d->camera->upVector();
- d->panModifiers = e->modifiers();
-#ifndef QT_NO_CURSOR
- setCursor(Qt::ClosedHandCursor);
-#endif
- } else {
- QDeclarativeItem::mousePressEvent(e);
- return;
- }
- e->setAccepted(true);
-}
-
-/*!
- \internal
-*/
-void Viewport::mouseReleaseEvent(QGraphicsSceneMouseEvent *e)
-{
- if (d->panning && e->button() == Qt::LeftButton) {
- d->panning = false;
-#ifndef QT_NO_CURSOR
- unsetCursor();
-#endif
- }
- if (d->pressedObject) {
- // Notify the previously pressed object about the release.
- QObject *object = objectForPoint(e->pos());
- QObject *pressed = d->pressedObject;
- if (e->button() == d->pressedButton) {
- d->pressedObject = 0;
- d->pressedButton = Qt::NoButton;
- d->enteredObject = object;
-
- // Send the release event to the pressed object. Use a position
- // of (0, 0) if the mouse is still within the pressed object,
- // or (-1, -1) if the mouse is no longer within the pressed object.
- QMouseEvent event
- (QEvent::MouseButtonRelease,
- (pressed == object) ? QPoint(0, 0) : QPoint(-1, -1),
- e->screenPos(), e->button(), e->buttons(), e->modifiers());
- QCoreApplication::sendEvent(pressed, &event);
-
- // Send leave and enter events if necessary.
- if (object != pressed) {
- sendLeaveEvent(pressed);
- if (object)
- sendEnterEvent(object);
- }
- } else {
- // Some other button than the original was released.
- // Forward the event to the pressed object.
- QMouseEvent event
- (QEvent::MouseButtonRelease,
- (pressed == object) ? QPoint(0, 0) : QPoint(-1, -1),
- e->screenPos(), e->button(), e->buttons(), e->modifiers());
- QCoreApplication::sendEvent(pressed, &event);
- }
- e->setAccepted(true);
- } else {
- QDeclarativeItem::mouseReleaseEvent(e);
- }
-}
-
-/*!
- \internal
-*/
-void Viewport::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e)
-{
- if (d->picking) {
- QObject *object = objectForPoint(e->pos());
- if (object) {
- // Simulate a double click event for (0, 0).
- QMouseEvent event
- (QEvent::MouseButtonDblClick, QPoint(0, 0),
- e->screenPos(), e->button(), e->buttons(), e->modifiers());
- QCoreApplication::sendEvent(object, &event);
- e->setAccepted(true);
- return;
- }
- }
- QDeclarativeItem::mouseDoubleClickEvent(e);
-}
-
-/*!
- \internal
-*/
-void Viewport::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
-{
- if (d->panning) {
- QPointF delta = e->pos() - d->startPan;
- if (e->modifiers() == d->panModifiers) {
- d->camera->setEye(d->startEye);
- d->camera->setCenter(d->startCenter);
- d->camera->setUpVector(d->startUpVector);
- } else {
- d->startPan = d->lastPan;
- delta = e->pos() - d->startPan;
- d->startEye = d->camera->eye();
- d->startCenter = d->camera->center();
- d->startUpVector = d->camera->upVector();
- d->panModifiers = e->modifiers();
- }
- d->lastPan = e->pos();
- if ((e->modifiers() & Qt::ControlModifier) != 0)
- wheel(delta.y() * -60);
- else if ((e->modifiers() & Qt::ShiftModifier) != 0)
- pan(delta.x(), delta.y());
- else
- rotate(delta.x(), delta.y());
- } else if (d->picking) {
- QObject *object = objectForPoint(e->pos());
- if (d->pressedObject) {
- // Send the move event to the pressed object. Use a position
- // of (0, 0) if the mouse is still within the pressed object,
- // or (-1, -1) if the mouse is no longer within the pressed object.
- QMouseEvent event
- (QEvent::MouseMove,
- (d->pressedObject == object) ? QPoint(0, 0) : QPoint(-1, -1),
- e->screenPos(), e->button(), e->buttons(), e->modifiers());
- QCoreApplication::sendEvent(d->pressedObject, &event);
- } else if (object) {
- if (object != d->enteredObject) {
- if (d->enteredObject)
- sendLeaveEvent(d->enteredObject);
- d->enteredObject = object;
- sendEnterEvent(d->enteredObject);
- }
- QMouseEvent event
- (QEvent::MouseMove, QPoint(0, 0),
- e->screenPos(), e->button(), e->buttons(), e->modifiers());
- QCoreApplication::sendEvent(object, &event);
- } else if (d->enteredObject) {
- sendLeaveEvent(d->enteredObject);
- d->enteredObject = 0;
- } else {
- QDeclarativeItem::mouseMoveEvent(e);
- return;
- }
- } else {
- QDeclarativeItem::mouseMoveEvent(e);
- return;
- }
- e->setAccepted(true);
-}
-
-/*!
- \internal
-*/
-void Viewport::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
-{
- if (hoverEvent(e))
- e->setAccepted(true);
- else
- QDeclarativeItem::hoverEnterEvent(e);
-}
-
-/*!
- \internal
-*/
-void Viewport::hoverMoveEvent(QGraphicsSceneHoverEvent *e)
-{
- if (hoverEvent(e))
- e->setAccepted(true);
- else
- QDeclarativeItem::hoverMoveEvent(e);
-}
-
-/*!
- \internal
-*/
-void Viewport::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
-{
- if (!d->pressedObject && d->enteredObject) {
- sendLeaveEvent(d->enteredObject);
- d->enteredObject = 0;
- e->setAccepted(true);
- } else {
- QDeclarativeItem::hoverLeaveEvent(e);
- }
-}
-
-/*!
- \internal
-*/
-void Viewport::wheelEvent(QGraphicsSceneWheelEvent *e)
-{
- if (d->navigation) {
- wheel(e->delta());
- e->setAccepted(true);
- } else {
- QDeclarativeItem::wheelEvent(e);
- }
-}
-
-/*!
- \internal
-*/
-void Viewport::keyPressEvent(QKeyEvent *e)
-{
- // Process the "Keys" property on the item first.
- keyPressPreHandler(e);
- if (e->isAccepted())
- return;
-
- qreal sep;
-
- if (!d->navigation) {
- QDeclarativeItem::keyPressEvent(e);
- return;
- }
-
- switch (e->key()) {
-
- case Qt::Key_Left:
- {
- if ((e->modifiers() & Qt::ShiftModifier) != 0) {
- pan(-10, 0);
- } else if ((e->modifiers() & Qt::ControlModifier) != 0) {
- sep = d->camera->eyeSeparation();
- sep -= (sep / 10.0f);
- if (sep < 0.0f)
- sep = 0.0f;
- d->camera->setEyeSeparation(sep);
- } else {
- rotate(-10, 0);
- }
- }
- break;
-
- case Qt::Key_Right:
- {
- if ((e->modifiers() & Qt::ShiftModifier) != 0) {
- pan(10, 0);
- } else if ((e->modifiers() & Qt::ControlModifier) != 0) {
- sep = d->camera->eyeSeparation();
- sep += (sep / 10.0f);
- d->camera->setEyeSeparation(sep);
- } else {
- rotate(10, 0);
- }
- }
- break;
-
- case Qt::Key_Up:
- {
- if ((e->modifiers() & Qt::ControlModifier) != 0)
- wheel(120);
- else if ((e->modifiers() & Qt::ShiftModifier) != 0)
- pan(0, -10);
- else
- rotate(0, -10);
- }
- break;
-
- case Qt::Key_Down:
- {
- if ((e->modifiers() & Qt::ControlModifier) != 0)
- wheel(-120);
- else if ((e->modifiers() & Qt::ShiftModifier) != 0)
- pan(0, 10);
- else
- rotate(0, 10);
- }
- break;
-
- default:
- QDeclarativeItem::keyPressEvent(e);
- return;
- }
-
- e->setAccepted(true);
-}
-
-/*!
- \internal
-*/
-bool Viewport::hoverEvent(QGraphicsSceneHoverEvent *e)
-{
- if (!d->panning && d->picking) {
- QObject *object = objectForPoint(e->pos());
- if (d->pressedObject) {
- // Send the move event to the pressed object. Use a position
- // of (0, 0) if the mouse is still within the pressed object,
- // or (-1, -1) if the mouse is no longer within the pressed object.
- QMouseEvent event
- (QEvent::MouseMove,
- (d->pressedObject == object) ? QPoint(0, 0) : QPoint(-1, -1),
- e->screenPos(), Qt::NoButton, Qt::NoButton, e->modifiers());
- QCoreApplication::sendEvent(d->pressedObject, &event);
- } else if (object) {
- if (object != d->enteredObject) {
- if (d->enteredObject)
- sendLeaveEvent(d->enteredObject);
- d->enteredObject = object;
- sendEnterEvent(d->enteredObject);
- }
- QMouseEvent event
- (QEvent::MouseMove, QPoint(0, 0),
- e->screenPos(), Qt::NoButton, Qt::NoButton, e->modifiers());
- QCoreApplication::sendEvent(object, &event);
- } else if (d->enteredObject) {
- sendLeaveEvent(d->enteredObject);
- d->enteredObject = 0;
- }
- return true;
- }
- return false;
-}
-
-// Zoom in and out according to the change in wheel delta.
-void Viewport::wheel(qreal delta)
-{
- if (d->fovzoom) {
- //Use field-of view as zoom (much like a traditional camera)
- qreal scale = qAbs(viewDelta(delta, delta).x());
- if (delta < 0)
- scale = -scale;
- if (scale >= 0.0f)
- scale += 1.0f;
- else
- scale = 1.0f / (1.0f - scale);
- qreal fov = d->camera->fieldOfView();
- if (fov != 0.0f)
- d->camera->setFieldOfView(d->camera->fieldOfView() / scale);
- else
- d->camera->setViewSize(d->camera->viewSize() / scale);
- } else {
- // enable this to get wheel navigation that actually zooms by moving the
- // camera back, as opposed to making the angle of view wider.
- QVector3D viewVector= camera()->eye() - camera()->center();
- qreal zoomMag = viewVector.length();
- qreal zoomIncrement = -float(delta) / 100.0f;
- if (!qFuzzyIsNull(zoomIncrement))
- {
- zoomMag += zoomIncrement;
- if (zoomMag < 1.0f)
- zoomMag = 1.0f;
-
- QRay3D viewLine(camera()->center(), viewVector.normalized());
- camera()->setEye(viewLine.point(zoomMag));
- }
- }
-}
-
-// Pan left/right/up/down without rotating about the object.
-void Viewport::pan(qreal deltax, qreal deltay)
-{
- QPointF delta = viewDelta(deltax, deltay);
- QVector3D t = d->camera->translation(delta.x(), -delta.y(), 0.0f);
-
- // Technically panning the eye left should make the object appear to
- // move off to the right, but this looks weird on-screen where the user
- // actually thinks they are picking up the object and dragging it rather
- // than moving the eye. We therefore apply the inverse of the translation
- // to make it "look right".
- d->camera->setEye(d->camera->eye() - t);
- d->camera->setCenter(d->camera->center() - t);
-}
-
-// Rotate about the object being viewed.
-void Viewport::rotate(qreal deltax, qreal deltay)
-{
- QRectF rect = boundingRect();
- int rotation = d->camera->screenRotation();
- if (rotation == 90 || rotation == 270) {
- qSwap(deltax, deltay);
- }
- if (rotation == 90 || rotation == 180) {
- deltax = -deltax;
- }
- if (rotation == 180 || rotation == 270) {
- deltay = -deltay;
- }
- qreal anglex = deltax * 90.0f / rect.width();
- qreal angley = deltay * 90.0f / rect.height();
- QQuaternion q = d->camera->pan(-anglex);
- q *= d->camera->tilt(-angley);
- d->camera->rotateCenter(q);
-}
-
-// Convert deltas in the X and Y directions into percentages of
-// the view width and height.
-QPointF Viewport::viewDelta(qreal deltax, qreal deltay)
-{
- QRectF rect = boundingRect();
- qreal w = rect.width();
- qreal h = rect.height();
- bool scaleToWidth;
- qreal scaleFactor, scaleX, scaleY;
- QSizeF viewSize = d->camera->viewSize();
- if (w >= h) {
- if (viewSize.width() >= viewSize.height())
- scaleToWidth = true;
- else
- scaleToWidth = false;
- } else {
- if (viewSize.width() >= viewSize.height())
- scaleToWidth = false;
- else
- scaleToWidth = true;
- }
- int rotation = d->camera->screenRotation();
- if (rotation == 90 || rotation == 270) {
- scaleToWidth = !scaleToWidth;
- qSwap(deltax, deltay);
- }
- if (rotation == 90 || rotation == 180) {
- deltax = -deltax;
- }
- if (rotation == 180 || rotation == 270) {
- deltay = -deltay;
- }
- if (scaleToWidth) {
- scaleFactor = 2.0f / viewSize.width();
- scaleX = scaleFactor * h / w;
- scaleY = scaleFactor;
- } else {
- scaleFactor = 2.0f / viewSize.height();
- scaleX = scaleFactor;
- scaleY = scaleFactor * w / h;
- }
- return QPointF(deltax * scaleX / w, deltay * scaleY / h);
-}
-
-QVariant Viewport::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
-{
- if (change == QGraphicsItem::ItemChildAddedChange)
- {
- QGraphicsItem *newItem = value.value<QGraphicsItem*>();
- if (QDeclarativeItem3D* item3d =
- qobject_cast<QDeclarativeItem3D*>(newItem))
- {
- setItemViewport(item3d);
- }
- };
- return QGraphicsItem::itemChange(change, value);
-}
-QT_END_NAMESPACE
diff --git a/src/imports/threed/viewport.h b/src/imports/threed/viewport.h
deleted file mode 100644
index c0c9c055..00000000
--- a/src/imports/threed/viewport.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtQuick3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 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 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIEWPORT_H
-#define VIEWPORT_H
-
-#include <QtDeclarative/qdeclarativeitem.h>
-
-#include "qdeclarativeitem3d.h"
-#include "qdeclarativeviewport.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class ViewportPrivate;
-class QGLCamera;
-class QGLLightModel;
-class QGLLightParameters;
-class QDeclarativeEffect;
-
-class Viewport : public QDeclarativeItem, public QDeclarativeViewport
-{
- Q_OBJECT
- Q_PROPERTY(bool picking READ picking WRITE setPicking NOTIFY viewportChanged)
- Q_PROPERTY(bool showPicking READ showPicking WRITE setShowPicking NOTIFY viewportChanged)
- Q_PROPERTY(bool showSceneGraph READ showSceneGraph WRITE setShowSceneGraph NOTIFY showSceneGraphChanged)
- Q_PROPERTY(bool navigation READ navigation WRITE setNavigation NOTIFY viewportChanged)
- Q_PROPERTY(bool fovzoom READ fovzoom WRITE setFovzoom NOTIFY viewportChanged)
- Q_PROPERTY(bool blending READ blending WRITE setBlending NOTIFY viewportChanged)
- Q_PROPERTY(QGLCamera *camera READ camera WRITE setCamera)
- Q_PROPERTY(QGLLightParameters *light READ light WRITE setLight NOTIFY viewportChanged)
- Q_PROPERTY(QGLLightModel *lightModel READ lightModel WRITE setLightModel NOTIFY viewportChanged)
-public:
- Viewport(QDeclarativeItem *parent = 0);
- ~Viewport();
-
- bool picking() const;
- void setPicking(bool value);
-
- bool showPicking() const;
- void setShowPicking(bool value);
-
- bool showSceneGraph() const;
- void setShowSceneGraph(bool show);
-
- bool navigation() const;
- void setNavigation(bool value);
-
- bool fovzoom() const;
- void setFovzoom(bool value);
-
- bool blending() const;
- void setBlending(bool value);
-
- QGLCamera *camera() const;
- void setCamera(QGLCamera *value);
-
- QGLLightParameters *light() const;
- void setLight(QGLLightParameters *value);
-
- QGLLightModel *lightModel() const;
- void setLightModel(QGLLightModel *value);
-
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
-
- int registerPickableObject(QObject *obj);
- virtual void registerEarlyDrawObject(QObject *obj, int order);
-
- Q_INVOKABLE QObject *objectForPoint(qreal x, qreal y);
-
-Q_SIGNALS:
- void viewportChanged();
- void showSceneGraphChanged();
-
-public Q_SLOTS:
- void update3d();
-
-private Q_SLOTS:
- void cameraChanged();
-
-protected:
- void mousePressEvent(QGraphicsSceneMouseEvent *event);
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
- void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
- void wheelEvent(QGraphicsSceneWheelEvent *event);
- void keyPressEvent(QKeyEvent *event);
- virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value);
-
-private:
- ViewportPrivate *d;
-
- void earlyDraw(QGLPainter *painter);
- void draw(QGLPainter *painter);
- void initializeGL(QGLPainter *painter);
-
- bool hoverEvent(QGraphicsSceneHoverEvent *event);
-
- QObject *objectForPoint(const QPointF &pos)
- {
- return objectForPoint(pos.x(), pos.y());
- }
-
- void wheel(qreal delta);
- void pan(qreal deltax, qreal deltay);
- void rotate(qreal deltax, qreal deltay);
- QPointF viewDelta(qreal deltax, qreal deltay);
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(Viewport)
-
-QT_END_HEADER
-
-#endif