summaryrefslogtreecommitdiffstats
path: root/src/threed/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'src/threed/graphicsview')
-rw-r--r--src/threed/graphicsview/graphicsview.pri21
-rw-r--r--src/threed/graphicsview/qglgraphicsviewportitem.cpp365
-rw-r--r--src/threed/graphicsview/qglgraphicsviewportitem.h100
-rw-r--r--src/threed/graphicsview/qgraphicsbillboardtransform.cpp258
-rw-r--r--src/threed/graphicsview/qgraphicsbillboardtransform.h82
-rw-r--r--src/threed/graphicsview/qgraphicsembedscene.cpp469
-rw-r--r--src/threed/graphicsview/qgraphicsembedscene.h88
-rw-r--r--src/threed/graphicsview/qgraphicsrotation3d.cpp274
-rw-r--r--src/threed/graphicsview/qgraphicsrotation3d.h91
-rw-r--r--src/threed/graphicsview/qgraphicsscale3d.cpp339
-rw-r--r--src/threed/graphicsview/qgraphicsscale3d.h88
-rw-r--r--src/threed/graphicsview/qgraphicstransform3d.cpp112
-rw-r--r--src/threed/graphicsview/qgraphicstransform3d.h71
-rw-r--r--src/threed/graphicsview/qgraphicstranslation3d.cpp233
-rw-r--r--src/threed/graphicsview/qgraphicstranslation3d.h87
15 files changed, 0 insertions, 2678 deletions
diff --git a/src/threed/graphicsview/graphicsview.pri b/src/threed/graphicsview/graphicsview.pri
deleted file mode 100644
index b43dbe66..00000000
--- a/src/threed/graphicsview/graphicsview.pri
+++ /dev/null
@@ -1,21 +0,0 @@
-
-INCLUDEPATH += $$PWD
-VPATH += $$PWD
-
-HEADERS += \
- graphicsview/qglgraphicsviewportitem.h \
- graphicsview/qgraphicsbillboardtransform.h \
- graphicsview/qgraphicsembedscene.h \
- graphicsview/qgraphicsrotation3d.h \
- graphicsview/qgraphicsscale3d.h \
- graphicsview/qgraphicstransform3d.h \
- graphicsview/qgraphicstranslation3d.h
-
-SOURCES += \
- qglgraphicsviewportitem.cpp \
- qgraphicsbillboardtransform.cpp \
- qgraphicsembedscene.cpp \
- qgraphicsrotation3d.cpp \
- qgraphicsscale3d.cpp \
- qgraphicstransform3d.cpp \
- qgraphicstranslation3d.cpp
diff --git a/src/threed/graphicsview/qglgraphicsviewportitem.cpp b/src/threed/graphicsview/qglgraphicsviewportitem.cpp
deleted file mode 100644
index c99b695e..00000000
--- a/src/threed/graphicsview/qglgraphicsviewportitem.cpp
+++ /dev/null
@@ -1,365 +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 "qglgraphicsviewportitem.h"
-#include "qglpainter.h"
-#include "qglsubsurface.h"
-#include <QtGui/qpainter.h>
-#include <QtGui/qgraphicsscene.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGLGraphicsViewportItem
- \brief The QGLGraphicsViewportItem class provides a rectangular viewport for arbitrary OpenGL painting.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-*/
-
-class QGLGraphicsViewportItemPrivate : public QObject
-{
- Q_OBJECT
-public:
- QGLGraphicsViewportItemPrivate(QGLGraphicsViewportItem *item)
- : q(item)
- {
- defaultCamera = camera = new QGLCamera(this);
- connect(camera, SIGNAL(projectionChanged()),
- this, SLOT(cameraChanged()));
- connect(camera, SIGNAL(viewChanged()),
- this, SLOT(cameraChanged()));
- }
-
- void changeCamera(QGLCamera *c);
- void setDefaults(QGLPainter *painter);
-
- QGLGraphicsViewportItem *q;
- QRectF rect;
- QGLCamera *camera;
- QGLCamera *defaultCamera;
- QColor backgroundColor;
-
-private Q_SLOTS:
- void cameraChanged();
-};
-
-void QGLGraphicsViewportItemPrivate::changeCamera(QGLCamera *c)
-{
- disconnect(camera, SIGNAL(projectionChanged()),
- this, SLOT(cameraChanged()));
- disconnect(camera, SIGNAL(viewChanged()),
- this, SLOT(cameraChanged()));
- camera = c;
- connect(camera, SIGNAL(projectionChanged()),
- this, SLOT(cameraChanged()));
- connect(camera, SIGNAL(viewChanged()),
- this, SLOT(cameraChanged()));
-}
-
-void QGLGraphicsViewportItemPrivate::cameraChanged()
-{
- q->update();
-}
-
-void QGLGraphicsViewportItemPrivate::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);
-}
-
-/*!
- Constructs a new GL graphics viewport and attaches it to \a parent.
-*/
-QGLGraphicsViewportItem::QGLGraphicsViewportItem(QGraphicsItem *parent)
- : QGraphicsItem(parent), d_ptr(new QGLGraphicsViewportItemPrivate(this))
-{
-}
-
-/*!
- Constructs a new GL graphics viewport and attaches it to \a parent.
- The boundingRect() is initially set to \a rect.
-*/
-QGLGraphicsViewportItem::QGLGraphicsViewportItem(const QRectF& rect, QGraphicsItem *parent)
- : QGraphicsItem(parent), d_ptr(new QGLGraphicsViewportItemPrivate(this))
-{
- d_ptr->rect = rect;
-}
-
-/*!
- Constructs a new GL graphics viewport and attaches it to \a parent.
- The boundingRect() is initially set to (\a x, \a y, \a w, \a h).
-*/
-QGLGraphicsViewportItem::QGLGraphicsViewportItem
- (qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent)
- : QGraphicsItem(parent), d_ptr(new QGLGraphicsViewportItemPrivate(this))
-{
- d_ptr->rect = QRectF(x, y, w, h);
-}
-
-/*!
- Destroys this GL graphics viewport.
-*/
-QGLGraphicsViewportItem::~QGLGraphicsViewportItem()
-{
-}
-
-/*!
- Returns the rectangular area of the view that is occupied by
- this GL graphics viewport.
-
- \sa setRect(), boundingRect()
-*/
-QRectF QGLGraphicsViewportItem::rect() const
-{
- Q_D(const QGLGraphicsViewportItem);
- return d->rect;
-}
-
-/*!
- Sets the rectangular area of the view that is occupied by
- this GL graphics viewport to \a rect.
-
- \sa rect(), boundingRect()
-*/
-void QGLGraphicsViewportItem::setRect(const QRectF &rect)
-{
- Q_D(QGLGraphicsViewportItem);
- if (d->rect == rect)
- return;
- prepareGeometryChange();
- d->rect = rect;
- update();
-}
-
-/*!
- \fn void QGLGraphicsViewportItem::setRect(qreal x, qreal y, qreal w, qreal h)
- \overload
-
- Sets the rectangular area of the view that is occupied by
- this GL graphics viewport to (\a x, \a y, \a w, \a h).
-
- \sa rect(), boundingRect()
-*/
-
-/*!
- Returns the bounding rectangle for this GL graphics viewport,
- which is the same as rect().
-
- \sa rect()
-*/
-QRectF QGLGraphicsViewportItem::boundingRect() const
-{
- Q_D(const QGLGraphicsViewportItem);
- return d->rect;
-}
-
-/*!
- Returns the camera parameters. The camera defines the projection
- to apply to convert eye co-ordinates into window co-ordinates,
- and the position and orientation of the viewer's eye.
-
- This item will be updated whenever the camera's parameters change.
-
- \sa setCamera()
-*/
-QGLCamera *QGLGraphicsViewportItem::camera() const
-{
- Q_D(const QGLGraphicsViewportItem);
- return d->camera;
-}
-
-/*!
- Sets the camera parameters to \a camera. The camera defines the
- projection to apply to convert eye co-ordinates into window
- co-ordinates, and the position and orientation of the viewer's eye.
-
- If \a camera is null, then the default camera object will be used.
-
- This function will call update() to force the viewport to update
- with the new camera parameters upon the next event loop. Afterwards,
- this item will be updated whenever the camera's parameters change.
-
- \sa camera()
-*/
-void QGLGraphicsViewportItem::setCamera(QGLCamera *camera)
-{
- Q_D(QGLGraphicsViewportItem);
- if (!camera)
- camera = d->defaultCamera;
- if (d->camera != camera) {
- d->changeCamera(camera);
- update();
- }
-}
-
-/*!
- Returns the background color, which is used to clear the viewport
- before calling paintGL(). The default value is an invalid QColor,
- which indicates that the viewport should not be cleared.
-
- \sa setBackgroundColor()
-*/
-QColor QGLGraphicsViewportItem::backgroundColor() const
-{
- Q_D(const QGLGraphicsViewportItem);
- return d->backgroundColor;
-}
-
-/*!
- Sets the background \a color, which is used to clear the viewport
- before calling paintGL().
-
- \sa backgroundColor()
-*/
-void QGLGraphicsViewportItem::setBackgroundColor(const QColor& color)
-{
- Q_D(QGLGraphicsViewportItem);
- d->backgroundColor = color;
-}
-
-/*!
- Paints this GL graphics viewport onto \a painter, with the specified
- \a option and \a widget parameters.
-
- This override creates a QGLPainter for \a painter and passes
- it to paintGL().
-
- \sa paintGL()
-*/
-void QGLGraphicsViewportItem::paint
- (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_D(QGLGraphicsViewportItem);
-
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- if (d->rect.isEmpty())
- return;
-
- // Initialize a QGLPainter for the surface and bail out if not active.
- QGLPainter glpainter;
- if (!glpainter.begin(painter)) {
- qWarning("GL graphics system is not active; cannot use 3D items");
- return;
- }
-
- // Set up the GL viewport to limit drawing to the bounds of this item.
- QRect viewport = painter->deviceTransform().mapRect(rect()).toRect();
- QGLSubsurface surface(glpainter.currentSurface(), viewport);
- glpainter.pushSurface(&surface);
-
- // Set up the desired drawing options.
- glDisable(GL_CULL_FACE);
- d->setDefaults(&glpainter);
- if (d->backgroundColor.isValid()) {
- // We clear the background by drawing a triangle fan so
- // that the background color will blend with the underlying
- // screen content if it has an alpha component.
- glDisable(GL_DEPTH_TEST);
- if (d->backgroundColor.alpha() != 255)
- glEnable(GL_BLEND);
- else
- glDisable(GL_BLEND);
- QVector2DArray array;
- array.append(-1, -1);
- array.append(1, -1);
- array.append(1, 1);
- array.append(-1, 1);
- glpainter.projectionMatrix().setToIdentity();
- glpainter.modelViewMatrix().setToIdentity();
- glpainter.setStandardEffect(QGL::FlatColor);
- glpainter.setColor(d->backgroundColor);
- glpainter.setVertexAttribute(QGL::Position, array);
- glpainter.draw(QGL::TriangleFan, 4);
- }
- glClear(GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
- glDisable(GL_BLEND);
-
- // Apply the camera.
- glpainter.setEye(QGL::NoEye);
- glpainter.setCamera(d->camera);
-
- // Paint the GL contents.
- paintGL(&glpainter);
-
- // Disable the current drawing effect so that QGLPainter will
- // forcibly update the GL context the next time QGLPainter is used.
- glpainter.disableEffect();
-
- // Try to restore the GL state to something paint-engine compatible.
- glDisable(GL_CULL_FACE);
- d->setDefaults(&glpainter);
- glDisable(GL_DEPTH_TEST);
-
- glpainter.popSurface();
-}
-
-/*!
- \fn void QGLGraphicsViewportItem::paintGL(QGLPainter *painter)
-
- Paints this GL graphics viewport onto \a painter. This function is called
- from paint().
-
- \sa paint()
-*/
-
-QT_END_NAMESPACE
-
-#include "qglgraphicsviewportitem.moc"
diff --git a/src/threed/graphicsview/qglgraphicsviewportitem.h b/src/threed/graphicsview/qglgraphicsviewportitem.h
deleted file mode 100644
index b7b10364..00000000
--- a/src/threed/graphicsview/qglgraphicsviewportitem.h
+++ /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$
-**
-****************************************************************************/
-
-#ifndef QGLGRAPHICSVIEWPORTITEM_H
-#define QGLGRAPHICSVIEWPORTITEM_H
-
-#include "qglnamespace.h"
-#include <QtGui/qgraphicsitem.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QGLGraphicsViewportItemPrivate;
-class QGLPainter;
-class QGLCamera;
-
-class Q_QT3D_EXPORT QGLGraphicsViewportItem : public QGraphicsItem
-{
-public:
- QGLGraphicsViewportItem(QGraphicsItem *parent = 0);
- QGLGraphicsViewportItem(const QRectF& rect, QGraphicsItem *parent = 0);
- QGLGraphicsViewportItem(qreal x, qreal y, qreal w, qreal h,
- QGraphicsItem *parent = 0);
- ~QGLGraphicsViewportItem();
-
- QRectF rect() const;
- void setRect(const QRectF &rect);
- inline void setRect(qreal x, qreal y, qreal w, qreal h);
-
- QRectF boundingRect() const;
-
- QGLCamera *camera() const;
- void setCamera(QGLCamera *camera);
-
- QColor backgroundColor() const;
- void setBackgroundColor(const QColor& color);
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
-protected:
- virtual void paintGL(QGLPainter *painter) = 0;
-
-private:
- QScopedPointer<QGLGraphicsViewportItemPrivate> d_ptr;
-
- Q_DECLARE_PRIVATE(QGLGraphicsViewportItem)
- Q_DISABLE_COPY(QGLGraphicsViewportItem)
-};
-
-void QGLGraphicsViewportItem::setRect(qreal x, qreal y, qreal w, qreal h)
-{
- setRect(QRectF(x, y, w, h));
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/graphicsview/qgraphicsbillboardtransform.cpp b/src/threed/graphicsview/qgraphicsbillboardtransform.cpp
deleted file mode 100644
index 449d9172..00000000
--- a/src/threed/graphicsview/qgraphicsbillboardtransform.cpp
+++ /dev/null
@@ -1,258 +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 "qgraphicsbillboardtransform.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsBillboardTransform
- \brief The QGraphicsBillboardTransform class implements a transformation that causes objects to face the camera.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- Sometimes it can be useful to make an object face towards the camera
- no matter what orientation the scene is in. The common name for
- this technique is "billboarding".
-
- When applied as a transformation, this class will replace the top-left
- 3x3 part of the transformation matrix with the identity. This has the
- effect of removing the rotation and scale components from the current
- world co-ordinate orientation.
-*/
-
-/*!
- \qmlclass BillboardTransform QGraphicsBillboardTransform
- \brief The BillboardTransform 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 the camera
- no matter what orientation the scene is in. The common name for
- this technique is "billboarding".
-
- When applied as a transformation, this class will replace the top-left
- 3x3 part of the transformation matrix with the identity. This has the
- effect of removing the rotation and scale components from the current
- world co-ordinate orientation. In QML, this can be used as follows
- to orient a pane to point towards the viewer:
-
- \code
- Item3D {
- mesh: Mesh { source: "pane.obj" }
- position: Qt.vector3d(2, 0, -20)
- transform: BillboardTransform {}
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-
- Because the billboard transformation will strip any further
- alterations to 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 },
- BillboardTransform {}
- ]
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-
- The \c scale property is applied to the matrix after \c transform has
- performed the billboard transformation, so the above can also be written
- as follows:
-
- \code
- Item3D {
- mesh: Mesh { source: "pane.obj" }
- position: Qt.vector3d(2, 0, -20)
- scale: 0.5
- transform: [
- Rotation3D { angle: 30 },
- BillboardTransform {}
- ]
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-
- By default the billboard transform will cause the object to
- face directly at the camera no matter how the world co-ordinate
- system is rotated. Sometimes the billboard needs to stay at right
- angles to the "ground plane" even if the user's viewpoint is
- elevated. This behavior can be enabled using the preserveUpVector
- property:
-
- \code
- Pane {
- position: Qt.vector3d(2, 0, -20)
- transform: BillboardTransform { preserveUpVector: true }
- effect: Effect { texture: "picture.jpg" }
- }
- \endcode
-*/
-
-class QGraphicsBillboardTransformPrivate
-{
-public:
- QGraphicsBillboardTransformPrivate() : preserveUpVector(false) {}
-
- bool preserveUpVector;
-};
-
-/*!
- Construct a billboard transform and attach it to \a parent.
-*/
-QGraphicsBillboardTransform::QGraphicsBillboardTransform(QObject *parent)
- : QGraphicsTransform3D(parent), d_ptr(new QGraphicsBillboardTransformPrivate)
-{
-}
-
-/*!
- Destroy this billboard transform.
-*/
-QGraphicsBillboardTransform::~QGraphicsBillboardTransform()
-{
-}
-
-/*!
- \property QGraphicsBillboardTransform::preserveUpVector
- \brief true to preserve the up orientation.
-
- 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".
-*/
-
-/*!
- \qmlproperty bool BillboardTransform::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 QGraphicsBillboardTransform::preserveUpVector() const
-{
- Q_D(const QGraphicsBillboardTransform);
- return d->preserveUpVector;
-}
-
-void QGraphicsBillboardTransform::setPreserveUpVector(bool value)
-{
- Q_D(QGraphicsBillboardTransform);
- if (d->preserveUpVector != value) {
- d->preserveUpVector = value;
- emit transformChanged();
- emit preserveUpVectorChanged();
- }
-}
-
-/*!
- \internal
-*/
-void QGraphicsBillboardTransform::applyTo(QMatrix4x4 *matrix) const
-{
- Q_D(const QGraphicsBillboardTransform);
- if (!d->preserveUpVector) {
- // 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;
- } else {
- // 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;
- }
- matrix->optimize();
-}
-
-/*!
- \internal
-*/
-QGraphicsTransform3D *QGraphicsBillboardTransform::clone(QObject *parent) const
-{
- Q_D(const QGraphicsBillboardTransform);
- QGraphicsBillboardTransform *copy = new QGraphicsBillboardTransform(parent);
- copy->setPreserveUpVector(d->preserveUpVector);
- return copy;
-}
-
-/*!
- \fn void QGraphicsBillboardTransform::preserveUpVectorChanged()
-
- Signal that is emitted when preserveUpVector() changes.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/graphicsview/qgraphicsbillboardtransform.h b/src/threed/graphicsview/qgraphicsbillboardtransform.h
deleted file mode 100644
index 61ec4072..00000000
--- a/src/threed/graphicsview/qgraphicsbillboardtransform.h
+++ /dev/null
@@ -1,82 +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 QGRAPHICSBILLBOARDTRANSFORM_H
-#define QGRAPHICSBILLBOARDTRANSFORM_H
-
-#include "qgraphicstransform3d.h"
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsBillboardTransformPrivate;
-
-class Q_QT3D_EXPORT QGraphicsBillboardTransform : public QGraphicsTransform3D
-{
- Q_OBJECT
- Q_PROPERTY(bool preserveUpVector READ preserveUpVector WRITE setPreserveUpVector NOTIFY preserveUpVectorChanged)
-public:
- QGraphicsBillboardTransform(QObject *parent = 0);
- ~QGraphicsBillboardTransform();
-
- bool preserveUpVector() const;
- void setPreserveUpVector(bool value);
-
- void applyTo(QMatrix4x4 *matrix) const;
- QGraphicsTransform3D *clone(QObject *parent) const;
-
-Q_SIGNALS:
- void preserveUpVectorChanged();
-
-private:
- QScopedPointer<QGraphicsBillboardTransformPrivate> d_ptr;
-
- Q_DISABLE_COPY(QGraphicsBillboardTransform)
- Q_DECLARE_PRIVATE(QGraphicsBillboardTransform)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/graphicsview/qgraphicsembedscene.cpp b/src/threed/graphicsview/qgraphicsembedscene.cpp
deleted file mode 100644
index 9e245880..00000000
--- a/src/threed/graphicsview/qgraphicsembedscene.cpp
+++ /dev/null
@@ -1,469 +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 "qgraphicsembedscene.h"
-#include "qglnamespace.h"
-#include <QtOpenGL/qglframebufferobject.h>
-#include <QtGui/qapplication.h>
-#include <QtGui/qpainter.h>
-#include <QtGui/qevent.h>
-#include <QtGui/qgraphicssceneevent.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsEmbedScene
- \brief The QGraphicsEmbedScene class provides a method to render a QGraphicsScene into a texture.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- \section1 Rendering the scene into a texture
-
- Embedded scenes are rendered into textures with renderToTexture()
- before the main 3D scene painting with QGLPainter starts. The following
- example shows the sequence of operations for a QGLWidget:
-
- \code
- void MyGLWidget::paintGL()
- {
- GLuint textureId = scene.renderToTexture();
-
- QGLPainter painter(this);
- painter.glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, textureId);
- ... // draw the 3D object
- painter.glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, 0);
- }
- \endcode
-
- When using QGLView, override the QGLWidget::paintGL() function
- explicitly to render scenes into textures before QGLView::paintGL()
- is called:
-
- \code
- void MyGLView::paintGL()
- {
- textureId = scene.renderToTexture();
- QGLView::paintGL();
- }
-
- void MyGLView::paintGL(QGLPainter *painter)
- {
- painter->glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, textureId);
- ... // draw the 3D object
- painter->glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, 0);
- }
- \endcode
-
- The texture is oriented so that (0, 0) corresponds to the bottom-left
- of the scene, and (1, 1) corresponds to the top-right of the scene.
- The texture may be scaled up to a power of two in size for better
- performance.
-
- \section1 Delivering mouse and keyboard events
-
- Mouse and keyboard events originate with the widget that is
- displaying the 3D scene. The application needs to intercept
- these events and decide which 3D object in the scene should
- get the event.
-
- The application then performs an intersection between the 3D
- object and a line in 3D space (usually a QRay3D) to determine
- the texture co-ordinate of where the user clicked on the object.
- How the intersection is determined is application-specific; different
- algorithms are needed based on the type of object (cube, sphere,
- parameterized mesh, etc).
-
- Once the texture co-ordinate has been determined, the application
- passes the widget event and the texture co-ordinate to deliverEvent().
- QGraphicsEmbedScene will then route the event to the appropriate
- graphics item in the embedded scene.
-
- Keyboard, focus in/out, and other non-mouse events do not need a
- texture co-ordinate. Pass (0, 0) as the texture co-ordinate for
- those event types.
-
- \section1 Updating the 3D scene
-
- The application will probably want to perform an update() whenever
- something changes in the embedded scene. The application should
- listen for the QGraphicsScene::changed() and
- QGraphicsScene::sceneRectChanged() signals.
-
- \section1 Performance notes
-
- QGraphicsEmbedScene renders the scene into a framebuffer object,
- which will involve GL state switching. The scene will be
- effectively triple-buffered: render into the fbo, then render
- the fbo into the GL window's back buffer, and finally copy to the
- GL window's front buffer.
-
- If the scene is showing a video item or something else that is
- highly animated, then it may be better to render the source into a
- texture some other way.
-
- If the embedded scene is itself a 3D scene drawn with GL, then use
- QGLPainter::pushSurface() and a QGLFramebufferObjectSurface instead
- of QGraphicsEmbedScene.
-
- \section1 Limitations
-
- When rendered into a texture, the scene does not have a QGraphicsView
- or a viewport QWidget associated with it. Graphics items that require a
- widget rendering surface will not work correctly.
-*/
-
-class QGraphicsEmbedScenePrivate : public QObject
-{
- Q_OBJECT
-public:
- QGraphicsEmbedScenePrivate(QGraphicsScene *scene, QObject *parent = 0)
- : QObject(parent)
- , dirty(true)
- , fbo(0)
- {
- format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
-
- connect(scene, SIGNAL(changed(QList<QRectF>)), this, SLOT(update()));
- connect(scene, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(update()));
- }
- ~QGraphicsEmbedScenePrivate()
- {
- delete fbo;
- }
-
- bool dirty;
- QGLFramebufferObject *fbo;
- QGLFramebufferObjectFormat format;
- QPoint pressedPos;
-
-public Q_SLOTS:
- void update() { dirty = true; }
-};
-
-/*!
- Constructs an embedded graphics scene and attaches it to \a parent.
-*/
-QGraphicsEmbedScene::QGraphicsEmbedScene(QObject *parent)
- : QGraphicsScene(parent)
- , d_ptr(new QGraphicsEmbedScenePrivate(this))
-{
-}
-
-/*!
- Constructs an embedded graphics scene, using \a sceneRect for its
- scene rectangle, and attaches it to \a parent.
-*/
-QGraphicsEmbedScene::QGraphicsEmbedScene(const QRectF &sceneRect, QObject *parent)
- : QGraphicsScene(sceneRect, parent)
- , d_ptr(new QGraphicsEmbedScenePrivate(this))
-{
-}
-
-/*!
- Constructs an embedded graphics scene, using (\a x, \a y, \a width,
- \a height) for its scene rectangle, and attaches it to \a parent.
-*/
-QGraphicsEmbedScene::QGraphicsEmbedScene(qreal x, qreal y, qreal width, qreal height, QObject *parent)
- : QGraphicsScene(x, y, width, height, parent)
- , d_ptr(new QGraphicsEmbedScenePrivate(this))
-{
-}
-
-/*!
- Destroys this embedded graphics scene.
-*/
-QGraphicsEmbedScene::~QGraphicsEmbedScene()
-{
-}
-
-/*!
- Returns the framebuffer object format to use when renderToTexture()
- is called. The default is a framebuffer format with depth and
- stencil buffers, RGBA format, and no multisampling.
-
- \sa setFormat()
-*/
-QGLFramebufferObjectFormat QGraphicsEmbedScene::format() const
-{
- Q_D(const QGraphicsEmbedScene);
- return d->format;
-}
-
-/*!
- Sets the framebuffer object \a format to use when renderToTexture()
- is called.
-
- \sa format()
-*/
-void QGraphicsEmbedScene::setFormat(const QGLFramebufferObjectFormat &format)
-{
- Q_D(QGraphicsEmbedScene);
- d->format = format;
-}
-
-/*!
- Renders this scene to a GL texture and returns the texture identifier.
- If the scene has not changed since the last call, then the same
- texture identifier will be returned without repainting the scene.
-
- The \a levelOfDetail is a hint that allows some control over the
- texture size. The default value of 1 indicates that the texture size
- should be the same or similar to the size of the scene. A value of 2
- would indicate that the texture size should have twice the width and
- height. A value of 0.5 would indicate half the size.
-
- The primary use for \a levelOfDetail is to render the scene with a
- greater level of detail when the 3D object showing the texture is
- larger on-screen than the scene's natural size. The parameter can
- also be used to reduce the level of detail in the texture when the
- 3D object is very small.
-
- It is assumed that a QGLContext is bound when this function is
- called. Usually this is the QGLContext that is bound by a QPainter
- for 2D painting into a GL surface. Note however that a QGLPainter must
- not be active on the QGLContext when this function is called.
-
- \sa format()
-*/
-GLuint QGraphicsEmbedScene::renderToTexture(qreal levelOfDetail)
-{
- Q_D(QGraphicsEmbedScene);
-
- // Determine the fbo size we will need.
- QSize size = (sceneRect().size() * levelOfDetail).toSize();
- QSize fboSize = QGL::nextPowerOfTwo(size);
- if (fboSize.isEmpty())
- fboSize = QSize(16, 16);
-
- // Create or re-create the fbo.
- if (!d->fbo || d->fbo->size() != fboSize) {
- delete d->fbo;
- d->fbo = new QGLFramebufferObject(fboSize, d->format);
- if (!d->fbo->isValid()) {
- delete d->fbo;
- d->fbo = 0;
- return 0;
- }
- d->dirty = true;
- }
-
- // Return the previous texture contents if the scene hasn't changed.
- if (!d->dirty && d->fbo)
- return d->fbo->texture();
-
- // Render the scene into the fbo, scaling the QPainter's view
- // transform up to the power-of-two fbo size.
- QPainter painter(d->fbo);
- painter.setWindow(0, 0, size.width(), size.height());
- painter.setViewport(0, 0, fboSize.width(), fboSize.height());
- render(&painter);
- painter.end();
- d->dirty = false;
- return d->fbo->texture();
-}
-
-/*!
- Delivers \a event to this scene. If \a event is a mouse event, then
- \a texCoord indicates the texture co-ordinate on the side of the
- 3D object where the user clicked. This \a texCoord is used to determine
- the actual scene co-ordinate to deliver: (0, 0) corresponds to the
- bottom-left corner of the scene and (1, 1) corresponds to the
- top-right corner of the scene.
-
- The \a event normally originates from a QWidget or QGraphicsItem that
- contains the 3D object. The caller performs a ray intersection in
- 3D space on the position within \a event to determine the \a texCoord
- and then passes \a event on to deliverEvent() for further processing.
-*/
-void QGraphicsEmbedScene::deliverEvent(QEvent *event, const QPointF &texCoord)
-{
- Q_D(QGraphicsEmbedScene);
-
- // Map the texture co-ordinate into "screen" co-ordinates.
- // Mouse move and release events can extend beyond the boundaries
- // of the scene, for "click and drag off-screen" operations.
- // Mouse press and double-click events need to be constrained.
- QRectF bounds = sceneRect();
- int screenX = qRound(texCoord.x() * bounds.width());
- int screenY = qRound((1.0f - texCoord.y()) * bounds.height());
- switch (event->type()) {
- case QEvent::GraphicsSceneMousePress:
- case QEvent::GraphicsSceneMouseDoubleClick:
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonDblClick:
- if (screenX < 0)
- screenX = 0;
- else if (screenX >= bounds.width())
- screenX = qRound(bounds.width() - 1);
- if (screenY < 0)
- screenY = 0;
- else if (screenY >= bounds.height())
- screenY = qRound(bounds.height() - 1);
- d->pressedPos = QPoint(screenX, screenY);
- break;
- default: break;
- }
-
- // Convert the event and deliver it to the scene.
- switch (event->type()) {
- case QEvent::GraphicsSceneMouseMove:
- case QEvent::GraphicsSceneMousePress:
- case QEvent::GraphicsSceneMouseRelease:
- case QEvent::GraphicsSceneMouseDoubleClick: {
- QGraphicsSceneMouseEvent *ev =
- static_cast<QGraphicsSceneMouseEvent *>(event);
- QGraphicsSceneMouseEvent e(ev->type());
- e.setPos(QPointF(screenX, screenY));
- e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y()));
- e.setScreenPos(QPoint(screenX, screenY));
- e.setButtonDownScreenPos(ev->button(), d->pressedPos);
- e.setButtonDownScenePos
- (ev->button(), QPointF(d->pressedPos.x() + bounds.x(),
- d->pressedPos.y() + bounds.y()));
- e.setButtons(ev->buttons());
- e.setButton(ev->button());
- e.setModifiers(ev->modifiers());
- e.setAccepted(false);
- QApplication::sendEvent(this, &e);
- }
- break;
-
-#ifndef QT_NO_WHEELEVENT
- case QEvent::GraphicsSceneWheel: {
- QGraphicsSceneWheelEvent *ev =
- static_cast<QGraphicsSceneWheelEvent *>(event);
- QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel);
- e.setPos(QPointF(screenX, screenY));
- e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y()));
- e.setScreenPos(QPoint(screenX, screenY));
- e.setButtons(ev->buttons());
- e.setModifiers(ev->modifiers());
- e.setDelta(ev->delta());
- e.setOrientation(ev->orientation());
- e.setAccepted(false);
- QApplication::sendEvent(this, &e);
- }
- break;
-#endif
-
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseMove: {
- QMouseEvent *ev = static_cast<QMouseEvent *>(event);
- QEvent::Type type;
- if (ev->type() == QEvent::MouseButtonPress)
- type = QEvent::GraphicsSceneMousePress;
- else if (ev->type() == QEvent::MouseButtonRelease)
- type = QEvent::GraphicsSceneMouseRelease;
- else if (ev->type() == QEvent::MouseButtonDblClick)
- type = QEvent::GraphicsSceneMouseDoubleClick;
- else
- type = QEvent::GraphicsSceneMouseMove;
- QGraphicsSceneMouseEvent e(type);
- e.setPos(QPointF(screenX, screenY));
- e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y()));
- e.setScreenPos(QPoint(screenX, screenY));
- e.setButtonDownScreenPos(ev->button(), d->pressedPos);
- e.setButtonDownScenePos
- (ev->button(), QPointF(d->pressedPos.x() + bounds.x(),
- d->pressedPos.y() + bounds.y()));
- e.setButtons(ev->buttons());
- e.setButton(ev->button());
- e.setModifiers(ev->modifiers());
- e.setAccepted(false);
- QApplication::sendEvent(this, &e);
- }
- break;
-
-#ifndef QT_NO_WHEELEVENT
- case QEvent::Wheel: {
- QWheelEvent *ev = static_cast<QWheelEvent *>(event);
- QGraphicsSceneWheelEvent e(QEvent::GraphicsSceneWheel);
- e.setPos(QPointF(screenX, screenY));
- e.setScenePos(QPointF(screenX + bounds.x(), screenY + bounds.y()));
- e.setScreenPos(QPoint(screenX, screenY));
- e.setButtons(ev->buttons());
- e.setModifiers(ev->modifiers());
- e.setDelta(ev->delta());
- e.setOrientation(ev->orientation());
- e.setAccepted(false);
- QApplication::sendEvent(this, &e);
- }
- break;
-#endif
-
- default: {
- // Send the event directly without any conversion.
- // Typically used for keyboard, focus, and enter/leave events.
- QApplication::sendEvent(this, event);
- }
- break;
-
- }
-}
-
-/*!
- \internal
-*/
-void QGraphicsEmbedScene::drawBackground(QPainter *painter, const QRectF &rect)
-{
- if (backgroundBrush().style() == Qt::NoBrush) {
- // Fill the fbo with the transparent color as there won't
- // be a window or graphics item drawing a previous background.
- painter->save();
- painter->setCompositionMode(QPainter::CompositionMode_Source);
- painter->fillRect(rect, Qt::transparent);
- painter->restore();
- } else {
- QGraphicsScene::drawBackground(painter, rect);
- }
-}
-
-QT_END_NAMESPACE
-
-#include "qgraphicsembedscene.moc"
diff --git a/src/threed/graphicsview/qgraphicsembedscene.h b/src/threed/graphicsview/qgraphicsembedscene.h
deleted file mode 100644
index 30504aea..00000000
--- a/src/threed/graphicsview/qgraphicsembedscene.h
+++ /dev/null
@@ -1,88 +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 QGRAPHICSEMBEDSCENE_H
-#define QGRAPHICSEMBEDSCENE_H
-
-#include "qglnamespace.h"
-#include <QtGui/qgraphicsscene.h>
-#include <QtOpenGL/qgl.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Qt3D)
-
-class QGraphicsEmbedScenePrivate;
-class QGLFramebufferObjectFormat;
-
-class Q_QT3D_EXPORT QGraphicsEmbedScene : public QGraphicsScene
-{
- Q_OBJECT
-public:
- QGraphicsEmbedScene(QObject *parent = 0);
- QGraphicsEmbedScene(const QRectF &sceneRect, QObject *parent = 0);
- QGraphicsEmbedScene(qreal x, qreal y, qreal width, qreal height, QObject *parent = 0);
- virtual ~QGraphicsEmbedScene();
-
- QGLFramebufferObjectFormat format() const;
- void setFormat(const QGLFramebufferObjectFormat &format);
-
- GLuint renderToTexture(qreal levelOfDetail = 1.0f);
-
- void deliverEvent(QEvent *event, const QPointF &texCoord);
-
-protected:
- void drawBackground(QPainter *painter, const QRectF &rect);
-
-private:
- QScopedPointer<QGraphicsEmbedScenePrivate> d_ptr;
-
- Q_DECLARE_PRIVATE(QGraphicsEmbedScene)
- Q_DISABLE_COPY(QGraphicsEmbedScene)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/graphicsview/qgraphicsrotation3d.cpp b/src/threed/graphicsview/qgraphicsrotation3d.cpp
deleted file mode 100644
index d23e2936..00000000
--- a/src/threed/graphicsview/qgraphicsrotation3d.cpp
+++ /dev/null
@@ -1,274 +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 "qgraphicsrotation3d.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsRotation3D
- \brief The QGraphicsRotation3D class supports arbitrary rotation around an axis in 3D space.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- \sa QGraphicsTranslation3D, QGraphicsScale3D
-*/
-
-/*!
- \qmlclass Rotation3D QGraphicsRotation3D
- \brief The Rotation3D item supports arbitrary rotation around an axis in 3D space.
- \since 4.8
- \ingroup qt3d::qml3d
-
- Frequently a user will create and item in the 3d world and immediately
- wish to apply a rotation to that item before it is displayed, or,
- optionally, perform an animation on that rotation parameter based on
- user inputs, or other events. Such an rotation can easily be defined
- in QML using the following code:
-
- \code
- Item3D {
- id: helicoptor
- mesh: Mesh {source: "monkey.3ds"}
- effect: Effect {}
- cullFaces: "CullBackFaces"
-
- transform: [
- Rotation3D {
- id: rotate1
- angle: 5
- axis: Qt.vector3d(1, 0, 0)
- },
- Rotation3D {
- id: rotate2
- angle: 5
- axis: Qt.vector3d(0, 1, 0)
- },
- Rotation3D {
- id: rotate3
- angle: 45
- axis: Qt.vector3d(0, 0, 1)
- }
- ]
-
- SequentialAnimation {
- NumberAnimation {target: rotate1; property: "angle"; to : 360.0; duration: 3000; easing.type:easeOutQuad }
- }
- }
- \endcode
-
- Notice here that we create a list of rotations for the \c transform
- property of the container item. By doing this we allow rotations
- around each of the axes individually in a manner which is conducive
- to animation and interaction.
-
- Each of the rotations has an \c axis property which is a QVector3D.
- This vector contains a value for each of the three components
- corresponding to x, y, and z. In the above example, we first
- rotate by 5 degrees about the x axis, then 5 degrees about the y
- axis, and finally by 45 degrees about the z axis.
-
- By giving each rotation a unique \c id users can then refer to these
- rotations in the QML source in order to perform rotational animations.
-
- \sa Translation3D, Scale3D
-*/
-
-class QGraphicsRotation3DPrivate
-{
-public:
- QGraphicsRotation3DPrivate() : axis(0, 0, 1), angle(0) {}
-
- QVector3D origin;
- QVector3D axis;
- qreal angle;
-};
-
-/*!
- Create a 3D rotation transformation and attach it to \a parent.
-*/
-QGraphicsRotation3D::QGraphicsRotation3D(QObject *parent)
- : QGraphicsTransform3D(parent)
- , d_ptr(new QGraphicsRotation3DPrivate)
-{
-}
-
-/*!
- Destroy this 3D rotation transformation.
-*/
-QGraphicsRotation3D::~QGraphicsRotation3D()
-{
-}
-
-/*!
- \property QGraphicsRotation3D::origin
- \brief the origin about which to rotate.
-
- The default value for this property is (0, 0, 0).
-*/
-
-/*!
- \qmlproperty vector3D Rotation3D::origin
-
- The origin about which to rotate. The default value for this
- property is (0, 0, 0).
-*/
-
-QVector3D QGraphicsRotation3D::origin() const
-{
- Q_D(const QGraphicsRotation3D);
- return d->origin;
-}
-
-void QGraphicsRotation3D::setOrigin(const QVector3D &value)
-{
- Q_D(QGraphicsRotation3D);
- if (d->origin != value) {
- d->origin = value;
- emit transformChanged();
- emit originChanged();
- }
-}
-
-/*!
- \property QGraphicsRotation3D::angle
- \brief the angle to rotate around the axis, in degrees anti-clockwise.
-
- The default value for this property is 0.
-*/
-
-/*!
- \qmlproperty real Rotation3D::angle
-
- The angle to rotate around the axis, in degrees anti-clockwise.
- The default value for this property is 0.
-*/
-
-qreal QGraphicsRotation3D::angle() const
-{
- Q_D(const QGraphicsRotation3D);
- return d->angle;
-}
-
-void QGraphicsRotation3D::setAngle(qreal value)
-{
- Q_D(QGraphicsRotation3D);
- if (d->angle != value) {
- d->angle = value;
- emit transformChanged();
- emit angleChanged();
- }
-}
-
-/*!
- \property QGraphicsRotation3D::axis
- \brief the axis to rotate around.
-
- The default value for this property is (0, 0, 1); i.e. the z-axis.
-*/
-
-/*!
- \qmlproperty vector3D Rotation3D::axis
-
- The axis to rotate around. The default value for this property
- is (0, 0, 1); i.e. the z-axis.
-*/
-
-QVector3D QGraphicsRotation3D::axis() const
-{
- Q_D(const QGraphicsRotation3D);
- return d->axis;
-}
-
-void QGraphicsRotation3D::setAxis(const QVector3D &value)
-{
- Q_D(QGraphicsRotation3D);
- if (d->axis != value) {
- d->axis = value;
- emit transformChanged();
- emit axisChanged();
- }
-}
-
-/*!
- \internal
-*/
-void QGraphicsRotation3D::applyTo(QMatrix4x4 *matrix) const
-{
- Q_D(const QGraphicsRotation3D);
- matrix->translate(d->origin);
- matrix->rotate(d->angle, d->axis.x(), d->axis.y(), d->axis.z());
- matrix->translate(-d->origin);
-}
-
-/*!
- \internal
-*/
-QGraphicsTransform3D *QGraphicsRotation3D::clone(QObject *parent) const
-{
- Q_D(const QGraphicsRotation3D);
- QGraphicsRotation3D *copy = new QGraphicsRotation3D(parent);
- copy->setOrigin(d->origin);
- copy->setAxis(d->axis);
- copy->setAngle(d->angle);
- return copy;
-}
-
-/*!
- \fn void QGraphicsRotation3D::originChanged()
-
- Signal that is emitted when origin() changes.
-*/
-
-/*!
- \fn void QGraphicsRotation3D::angleChanged()
-
- Signal that is emitted when angle() changes.
-*/
-
-/*!
- \fn void QGraphicsRotation3D::axisChanged()
-
- Signal that is emitted when axis() changes.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/graphicsview/qgraphicsrotation3d.h b/src/threed/graphicsview/qgraphicsrotation3d.h
deleted file mode 100644
index 4ba47e84..00000000
--- a/src/threed/graphicsview/qgraphicsrotation3d.h
+++ /dev/null
@@ -1,91 +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 QGRAPHICSROTATION3D_H
-#define QGRAPHICSROTATION3D_H
-
-#include "qgraphicstransform3d.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsRotation3DPrivate;
-
-class Q_QT3D_EXPORT QGraphicsRotation3D : public QGraphicsTransform3D
-{
- Q_OBJECT
- Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
- Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
- Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
-public:
- QGraphicsRotation3D(QObject *parent = 0);
- ~QGraphicsRotation3D();
-
- QVector3D origin() const;
- void setOrigin(const QVector3D &value);
-
- qreal angle() const;
- void setAngle(qreal value);
-
- QVector3D axis() const;
- void setAxis(const QVector3D &value);
-
- void applyTo(QMatrix4x4 *matrix) const;
- QGraphicsTransform3D *clone(QObject *parent) const;
-
-Q_SIGNALS:
- void originChanged();
- void angleChanged();
- void axisChanged();
-
-private:
- QScopedPointer<QGraphicsRotation3DPrivate> d_ptr;
-
- Q_DISABLE_COPY(QGraphicsRotation3D)
- Q_DECLARE_PRIVATE(QGraphicsRotation3D)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/graphicsview/qgraphicsscale3d.cpp b/src/threed/graphicsview/qgraphicsscale3d.cpp
deleted file mode 100644
index cbf060bd..00000000
--- a/src/threed/graphicsview/qgraphicsscale3d.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 "qgraphicsscale3d.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsScale3D
- \brief The QGraphicsScale3D class supports scaling of items in 3D.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- \sa QGraphicsRotation3D, QGraphicsTranslation3D
-*/
-
-/*!
- \qmlclass Scale3D QGraphicsScale3D
- \brief The Scale3D item supports scaling of items in 3D.
- \since 4.8
- \ingroup qt3d::qml3d
-
- 3D items in QML can have a simple scale applied directly as follows:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- scale: 0.5
- }
- \endcode
-
- An alternative is to use Scale3D to apply a transform directly
- to an item as part of a sequence of transformations:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- transform: [
- Translation3D { translate: Qt.vector3d(5, 0, 0) },
- Scale3D { scale: 0.5 }
- ]
- }
- \endcode
-
- This allows the application writer to control exactly when the
- scale occurs relative to other transformations. In the example
- above, the item is first translated by 5 units along the x-axis,
- and then the co-ordinates are scaled by half. This is distinct
- from the following example which scales the object to half its
- original size and then translates it by 5 units along the x-axis:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- transform: [
- Scale3D { scale: 0.5 },
- Translation3D { translate: Qt.vector3d(5, 0, 0) }
- ]
- }
- \endcode
-
- The scale property on the item itself is applied before
- any of the transforms. So the previous example is equivalent to:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- scale: 0.5
- transform: [
- Translation3D { translate: Qt.vector3d(5, 0, 0) }
- ]
- }
- \endcode
-
- Scale values can also affect the x, y, and z axes by different amounts
- by using a \c{vector3D} value:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- transform: [
- Scale3D { scale: Qt.vector3d(0.5, 0.2, 1.0) },
- Translation3D { translate: Qt.vector3d(5, 0, 0) }
- ]
- }
- \endcode
-
- \sa Rotation3D, Translation3D
-*/
-
-class QGraphicsScale3DPrivate
-{
-public:
- QGraphicsScale3DPrivate()
- : scale(1, 1, 1)
- , isIdentityScale(true)
- , isIdentityOrigin(true)
- {}
-
- QVector3D origin;
- QVector3D scale;
- bool isIdentityScale;
- bool isIdentityOrigin;
-};
-
-/*!
- Construct a 3D scale transform and attach it to \a parent.
-*/
-QGraphicsScale3D::QGraphicsScale3D(QObject *parent)
- : QGraphicsTransform3D(parent), d_ptr(new QGraphicsScale3DPrivate)
-{
-}
-
-/*!
- Destroy this 3D scale transform.
-*/
-QGraphicsScale3D::~QGraphicsScale3D()
-{
-}
-
-/*!
- \property QGraphicsScale3D::origin
- \brief the origin about which to scale.
-
- The default value for this property is (0, 0, 0).
-*/
-
-/*!
- \qmlproperty vector3D Scale3D::origin
-
- The origin about which to scale. The default value for this
- property is (0, 0, 0).
-*/
-
-QVector3D QGraphicsScale3D::origin() const
-{
- Q_D(const QGraphicsScale3D);
- return d->origin;
-}
-
-void QGraphicsScale3D::setOrigin(const QVector3D &value)
-{
- Q_D(QGraphicsScale3D);
-
- // Optimise for the common case of setting the origin to 0, 0, 0
- // Also minimise the number of floating point compares required
- bool changed = false;
- QVector3D v = value;
-
- // Are we about to set to 0, 0, 0 ...?
- // Normalise inbound value & record in bool to save on compares
- bool isSetToZeroOrigin = false;
- if (qFuzzyIsNull(v.x()) && qFuzzyIsNull(v.y()) && qFuzzyIsNull(v.z()))
- {
- v = QVector3D(0, 0, 0);
- isSetToZeroOrigin = true;
- }
- if (!isSetToZeroOrigin)
- {
- if (d->origin != v)
- {
- d->origin = v;
- d->isIdentityOrigin = false;
- changed = true;
- }
- }
- else
- {
- if (!d->isIdentityOrigin)
- {
- d->origin = v;
- d->isIdentityOrigin = true;
- changed = true;
- }
- }
- if (changed)
- {
- emit transformChanged();
- emit originChanged();
- }
-}
-
-/*!
- \property QGraphicsScale3D::scale
- \brief the amount with which to scale each component.
-
- The default value for this property is QVector3D(1, 1, 1).
-*/
-
-/*!
- \qmlproperty vector3D Scale3D::scale
-
- The amount with which to scale each component. The default value for
- this property is (1, 1, 1).
-
- This property can be specified as either a vector3D or a single
- floating-point value. A single floating-point value will set
- the x, y, and z scale components to the same value. In other words,
- the following two transformations are equivalent:
-
- \code
- Scale3D { scale: 2 }
- Scale3D { scale: Qt.vector3d(2, 2, 2) }
- \endcode
-*/
-
-QVector3D QGraphicsScale3D::scale() const
-{
- Q_D(const QGraphicsScale3D);
- return d->scale;
-}
-
-void QGraphicsScale3D::setScale(const QVector3D &value)
-{
- Q_D(QGraphicsScale3D);
-
- // Optimise for the common case of setting the scale to 1, 1, 1
- // Also minimise the number of floating point compares required
- bool changed = false;
- QVector3D v = value;
-
- // Are we about to set to 1, 1, 1 ...?
- // Normalise inbound value & record in bool to save on compares
- bool isSetToIdentity = false;
- if (qFuzzyIsNull(v.x() - 1.0f) && qFuzzyIsNull(v.y() - 1.0f) && qFuzzyIsNull(v.z() - 1.0f))
- {
- v = QVector3D(1, 1, 1);
- isSetToIdentity = true;
- }
- if (!isSetToIdentity)
- {
- if (d->scale != v)
- {
- d->scale = v;
- d->isIdentityScale = false;
- changed = true;
- }
- }
- else
- {
- if (!d->isIdentityScale)
- {
- d->scale = v;
- d->isIdentityScale = true;
- changed = true;
- }
- }
- if (changed)
- {
- emit transformChanged();
- emit scaleChanged();
- }
-}
-
-/*!
- \internal
-*/
-void QGraphicsScale3D::applyTo(QMatrix4x4 *matrix) const
-{
- Q_D(const QGraphicsScale3D);
- if (!d->isIdentityScale)
- {
- if (d->isIdentityOrigin)
- {
- matrix->scale(d->scale);
- }
- else
- {
- matrix->translate(d->origin);
- matrix->scale(d->scale);
- matrix->translate(-d->origin);
- }
- }
-}
-
-/*!
- \internal
-*/
-QGraphicsTransform3D *QGraphicsScale3D::clone(QObject *parent) const
-{
- Q_D(const QGraphicsScale3D);
- QGraphicsScale3D *copy = new QGraphicsScale3D(parent);
- copy->setOrigin(d->origin);
- copy->setScale(d->scale);
- return copy;
-}
-
-/*!
- \fn void QGraphicsScale3D::originChanged()
-
- Signal that is emitted when origin() changes.
-*/
-
-/*!
- \fn void QGraphicsScale3D::scaleChanged()
-
- Signal that is emitted when scale() changes.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/graphicsview/qgraphicsscale3d.h b/src/threed/graphicsview/qgraphicsscale3d.h
deleted file mode 100644
index 36a6ede5..00000000
--- a/src/threed/graphicsview/qgraphicsscale3d.h
+++ /dev/null
@@ -1,88 +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 QGRAPHICSSCALE3D_H
-#define QGRAPHICSSCALE3D_H
-
-#include "qgraphicstransform3d.h"
-#include <QtCore/qscopedpointer.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsScale3DPrivate;
-
-class Q_QT3D_EXPORT QGraphicsScale3D : public QGraphicsTransform3D
-{
- Q_OBJECT
- Q_PROPERTY(QVector3D origin READ origin WRITE setOrigin NOTIFY originChanged)
- Q_PROPERTY(QVector3D scale READ scale WRITE setScale NOTIFY scaleChanged)
-public:
- QGraphicsScale3D(QObject *parent = 0);
- ~QGraphicsScale3D();
-
- QVector3D origin() const;
- void setOrigin(const QVector3D &value);
-
- QVector3D scale() const;
- void setScale(const QVector3D &value);
-
- void applyTo(QMatrix4x4 *matrix) const;
- QGraphicsTransform3D *clone(QObject *parent) const;
-
-Q_SIGNALS:
- void originChanged();
- void scaleChanged();
-
-private:
- QScopedPointer<QGraphicsScale3DPrivate> d_ptr;
-
- Q_DISABLE_COPY(QGraphicsScale3D)
- Q_DECLARE_PRIVATE(QGraphicsScale3D)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/graphicsview/qgraphicstransform3d.cpp b/src/threed/graphicsview/qgraphicstransform3d.cpp
deleted file mode 100644
index 1cc34383..00000000
--- a/src/threed/graphicsview/qgraphicstransform3d.cpp
+++ /dev/null
@@ -1,112 +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 "qgraphicstransform3d.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsTransform3D
- \brief The QGraphicsTransform3D class is an abstract base class for building 3D transformations.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- QGraphicsTransform3D lets you create and control advanced transformations
- that can be configured independently using specialized properties.
- Scene nodes have an associated list of transforms, which are applied
- in order, one at a time, to the modelview matrix. Transformations are
- computed in true 3D space using QMatrix4x4.
-
- QGraphicsTransform3D is particularly useful for animations. Whereas
- QGLPainter::modelViewMatrix() lets you assign any transform directly,
- there is no direct way to interpolate between two different
- transformations (e.g., when transitioning between two states, each for
- which the item has a different arbitrary transform assigned). Using
- QGraphicsTransform3D you can interpolate the property values of each
- independent transformation. The resulting operation is then combined into a
- single transform which is applied to the modelview matrix during drawing.
-
- If you want to create your own configurable transformation, you can create
- a subclass of QGraphicsTransform3D (or any or the existing subclasses), and
- reimplement the pure virtual applyTo() function, which takes a pointer to a
- QMatrix4x4. Each operation you would like to apply should be exposed as
- properties (e.g., customTransform->setVerticalShear(2.5)). Inside you
- reimplementation of applyTo(), you can modify the provided transform
- respectively.
-
- \sa QGraphicsScale3D, QGraphicsRotation3D, QGraphicsTranslation3D
- \sa QGraphicsBillboardTransform
-*/
-
-/*!
- \fn QGraphicsTransform3D::QGraphicsTransform3D(QObject *parent)
-
- Constructs a 3D transformation and attaches it to \a parent.
-*/
-
-/*!
- \fn QGraphicsTransform3D::~QGraphicsTransform3D()
-
- Destroys this 3D transformation.
-*/
-
-/*!
- \fn void QGraphicsTransform3D::applyTo(QMatrix4x4 *matrix) const
-
- Applies the effect of this transformation to the specified
- modelview \a matrix.
-*/
-
-/*!
- \fn QGraphicsTransform3D *QGraphicsTransform3D::clone(QObject *parent) const
-
- Clones a copy of this transformation and attaches the clone to \a parent.
-*/
-
-/*!
- \fn void QGraphicsTransform3D::transformChanged()
-
- Signal that is emitted whenever any of the transformation's
- parameters are changed.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/graphicsview/qgraphicstransform3d.h b/src/threed/graphicsview/qgraphicstransform3d.h
deleted file mode 100644
index 024a9786..00000000
--- a/src/threed/graphicsview/qgraphicstransform3d.h
+++ /dev/null
@@ -1,71 +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 QGRAPHICSTRANSFORM3D_H
-#define QGRAPHICSTRANSFORM3D_H
-
-#include <QtCore/qobject.h>
-#include <QtGui/qmatrix4x4.h>
-#include "qt3dglobal.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class Q_QT3D_EXPORT QGraphicsTransform3D : public QObject
-{
- Q_OBJECT
-public:
- QGraphicsTransform3D(QObject *parent = 0) : QObject(parent) {}
- ~QGraphicsTransform3D() {}
-
- virtual void applyTo(QMatrix4x4 *matrix) const = 0;
- virtual QGraphicsTransform3D *clone(QObject *parent = 0) const = 0;
-
-Q_SIGNALS:
- void transformChanged();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/threed/graphicsview/qgraphicstranslation3d.cpp b/src/threed/graphicsview/qgraphicstranslation3d.cpp
deleted file mode 100644
index 1b5d1211..00000000
--- a/src/threed/graphicsview/qgraphicstranslation3d.cpp
+++ /dev/null
@@ -1,233 +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 "qgraphicstranslation3d.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QGraphicsTranslation3D
- \brief The QGraphicsTranslation3D class supports translation of 3D items.
- \since 4.8
- \ingroup qt3d
- \ingroup qt3d::graphicsview
-
- QGraphicsTranslation3D is derived directly from QGraphicsTransform, and
- provides a \l translate property to specify the 3D vector to
- apply to incoming co-ordinates.
-
- The \l progress property can be used to perform animation along a
- translation vector by varying the progress value between 0 and 1.
- Overshoot animations are also possible by setting the progress
- value to something outside this range. The default progress
- value is 1.
-
- \sa QGraphicsRotation3D, QGraphicsScale3D
-*/
-
-/*!
- \qmlclass Translation3D QGraphicsTranslation3D
- \brief The Translation3D item supports translation of items in 3D.
- \since 4.8
- \ingroup qt3d::qml3d
-
- 3D items in QML are typically positioned directly as follows:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- position: Qt.vector3d(0, 5, 10)
- }
- \endcode
-
- However, it can sometimes be useful to translate an object along a
- vector under the control of an animation. The Translate3D
- element can be used for this purpose. The following example
- translates the object along a straight-line path 5 units to
- the right of its original position, and then back again:
-
- \code
- Item3D {
- mesh: Mesh { source: "chair.3ds" }
- position: Qt.vector3d(0, 5, 10)
- transform: [
- Translation3D {
- translate: Qt.vector3d(5, 0, 0)
- SequentialAnimation on progress {
- running: true
- loops: Animation.Infinite
- NumberAnimation { to : 1.0; duration: 300 }
- NumberAnimation { to : 0.0; duration: 300 }
- }
- }
- ]
- }
- \endcode
-
- \sa Rotation3D, Scale3D
-*/
-
-class QGraphicsTranslation3DPrivate
-{
-public:
- QGraphicsTranslation3DPrivate() : progress(1.0f) {}
-
- QVector3D translate;
- qreal progress;
-};
-
-/*!
- Constructs a new translation and attaches it to \a parent.
-*/
-QGraphicsTranslation3D::QGraphicsTranslation3D(QObject *parent)
- : QGraphicsTransform3D(parent), d_ptr(new QGraphicsTranslation3DPrivate)
-{
-}
-
-/*!
- Destroys this translation.
-*/
-QGraphicsTranslation3D::~QGraphicsTranslation3D()
-{
-}
-
-/*!
- \property QGraphicsTranslation3D::translate
- \brief the translation to apply to incoming co-ordinates.
-
- The default value for this property is (0, 0, 0).
-*/
-
-/*!
- \qmlproperty vector3D Translation3D::translate
-
- The translation to apply to incoming co-ordinates. The default value
- for this property is (0, 0, 0).
-*/
-
-QVector3D QGraphicsTranslation3D::translate() const
-{
- Q_D(const QGraphicsTranslation3D);
- return d->translate;
-}
-
-void QGraphicsTranslation3D::setTranslate(const QVector3D &value)
-{
- Q_D(QGraphicsTranslation3D);
- if (d->translate != value) {
- d->translate = value;
- emit transformChanged();
- emit translateChanged();
- }
-}
-
-/*!
- \property QGraphicsTranslation3D::progress
- \brief the progress along the translation vector, from 0 to 1.
-
- The default value for this property is 1.
-
- This property can be used to perform animation along a translation
- vector by varying the progress between 0 and 1. Overshoot animations
- are also possible by setting the value to something outside this range.
-*/
-
-/*!
- \qmlproperty real Translation3D::progress
-
- The progress along the translation vector, from 0 to 1. The default
- value for this property is 1.
-
- This property can be used to perform animation along a translation
- vector by varying the progress between 0 and 1. Overshoot animations
- are also possible by setting the value to something outside this range.
-*/
-
-qreal QGraphicsTranslation3D::progress() const
-{
- Q_D(const QGraphicsTranslation3D);
- return d->progress;
-}
-
-void QGraphicsTranslation3D::setProgress(qreal value)
-{
- Q_D(QGraphicsTranslation3D);
- if (d->progress != value) {
- d->progress = value;
- emit transformChanged();
- emit progressChanged();
- }
-}
-
-/*!
- \internal
-*/
-void QGraphicsTranslation3D::applyTo(QMatrix4x4 *matrix) const
-{
- Q_D(const QGraphicsTranslation3D);
- matrix->translate(d->translate * d->progress);
-}
-
-/*!
- \internal
-*/
-QGraphicsTransform3D *QGraphicsTranslation3D::clone(QObject *parent) const
-{
- Q_D(const QGraphicsTranslation3D);
- QGraphicsTranslation3D *copy = new QGraphicsTranslation3D(parent);
- copy->setTranslate(d->translate);
- copy->setProgress(d->progress);
- return copy;
-}
-
-/*!
- \fn void QGraphicsTranslation3D::translateChanged()
-
- Signal that is emitted when translate() changes.
-*/
-
-/*!
- \fn void QGraphicsTranslation3D::progressChanged()
-
- Signal that is emitted when progress() changes.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/threed/graphicsview/qgraphicstranslation3d.h b/src/threed/graphicsview/qgraphicstranslation3d.h
deleted file mode 100644
index 0ccab5d3..00000000
--- a/src/threed/graphicsview/qgraphicstranslation3d.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 QGRAPHICSTRANSLATION3D_H
-#define QGRAPHICSTRANSLATION3D_H
-
-#include "qgraphicstransform3d.h"
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsTranslation3DPrivate;
-
-class Q_QT3D_EXPORT QGraphicsTranslation3D : public QGraphicsTransform3D
-{
- Q_OBJECT
- Q_PROPERTY(QVector3D translate READ translate WRITE setTranslate NOTIFY translateChanged)
- Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged)
-public:
- QGraphicsTranslation3D(QObject *parent = 0);
- ~QGraphicsTranslation3D();
-
- QVector3D translate() const;
- void setTranslate(const QVector3D &value);
-
- qreal progress() const;
- void setProgress(qreal value);
-
- void applyTo(QMatrix4x4 *matrix) const;
- QGraphicsTransform3D *clone(QObject *parent) const;
-
-Q_SIGNALS:
- void translateChanged();
- void progressChanged();
-
-private:
- QScopedPointer<QGraphicsTranslation3DPrivate> d_ptr;
-
- Q_DISABLE_COPY(QGraphicsTranslation3D)
- Q_DECLARE_PRIVATE(QGraphicsTranslation3D)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif