summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/tank
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/tank')
-rw-r--r--examples/qt3d/tank/main.cpp69
-rw-r--r--examples/qt3d/tank/qt3d.icobin67646 -> 0 bytes
-rw-r--r--examples/qt3d/tank/qt3d.pngbin3677 -> 0 bytes
-rw-r--r--examples/qt3d/tank/quadplane.cpp107
-rw-r--r--examples/qt3d/tank/quadplane.h55
-rw-r--r--examples/qt3d/tank/tank.cpp136
-rw-r--r--examples/qt3d/tank/tank.desktop7
-rw-r--r--examples/qt3d/tank/tank.h59
-rw-r--r--examples/qt3d/tank/tank.pro21
-rw-r--r--examples/qt3d/tank/tank.rc1
-rw-r--r--examples/qt3d/tank/tankview.cpp114
-rw-r--r--examples/qt3d/tank/tankview.h70
12 files changed, 0 insertions, 639 deletions
diff --git a/examples/qt3d/tank/main.cpp b/examples/qt3d/tank/main.cpp
deleted file mode 100644
index 14e1ef43..00000000
--- a/examples/qt3d/tank/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QtGui/QApplication>
-
-#include <time.h>
-
-#include "tankview.h"
-
-int main(int argc, char *argv[])
-{
- qsrand(time(0));
-
- QApplication a(argc, argv);
- TankView view;
-
-#ifdef Q_OS_SYMBIAN
- view.setAttribute(Qt::WA_LockLandscapeOrientation, true);
- view.showFullScreen();
-#else
- if (view.stereoType() != QGLView::RedCyanAnaglyph)
- view.camera()->setEyeSeparation(0.3f);
- if (QApplication::arguments().contains(QLatin1String("-maximize")))
- view.showMaximized();
- else if (QApplication::arguments().contains(QLatin1String("-fullscreen")))
- view.showFullScreen();
- else
- view.show();
-#endif
-
- return a.exec();
-}
diff --git a/examples/qt3d/tank/qt3d.ico b/examples/qt3d/tank/qt3d.ico
deleted file mode 100644
index e6442baf..00000000
--- a/examples/qt3d/tank/qt3d.ico
+++ /dev/null
Binary files differ
diff --git a/examples/qt3d/tank/qt3d.png b/examples/qt3d/tank/qt3d.png
deleted file mode 100644
index 21ec0176..00000000
--- a/examples/qt3d/tank/qt3d.png
+++ /dev/null
Binary files differ
diff --git a/examples/qt3d/tank/quadplane.cpp b/examples/qt3d/tank/quadplane.cpp
deleted file mode 100644
index fb3cf16b..00000000
--- a/examples/qt3d/tank/quadplane.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#include "quadplane.h"
-#include "qgraphicsrotation3d.h"
-
-QGLMaterial *qCreateFloor()
-{
- quint32 sz = 512;
- QImage image(QSize(sz, sz), QImage::Format_ARGB32);
- QRgb col = qRgba(196, 196, 200, 255);
- image.fill(col);
- QPainter painter(&image);
- QPen pen = painter.pen();
- pen.setColor(QColor(col).darker());
- pen.setWidth(2);
- painter.setPen(pen);
- for (quint32 i = 0; i < sz; i += (sz / 8))
- {
- painter.drawLine(0, i, sz-1, i);
- painter.drawLine(i, 0, i, sz-1);
- }
- painter.end();
- QGLMaterial *mat = new QGLMaterial;
- QGLTexture2D *tex = new QGLTexture2D(mat);
- tex->setImage(image);
- mat->setTexture(tex);
- return mat;
-}
-
-QuadPlane::QuadPlane(QObject *parent, QSizeF size, int level)
- : QGLSceneNode(parent)
-{
- setObjectName("QuadPlane");
- if (level > 8)
- level = 8;
- if (level < 1)
- level = 1;
- int divisions = 1;
- for ( ; level--; divisions *= 2) {} // integer 2**n
- QSizeF div = size / float(divisions);
- QSizeF half = size / 2.0f;
- QGLBuilder builder;
- QGeometryData zip;
- QGeometryData zip2;
- for (int yy = 0; yy <= divisions; ++yy)
- {
- qreal y = half.height() - float(yy) * div.height();
- qreal texY = float(yy) / divisions;
- for (int xx = 0; xx <= divisions; ++xx)
- {
- qreal x = half.width() - float(xx) * div.width();
- qreal texX = float(xx) / divisions;
- zip.appendVertex(QVector3D(x, y, 0));
- zip.appendTexCoord(QVector2D(1.0f - texX, 1.0f - texY));
- }
- if (yy > 0)
- builder.addQuadsInterleaved(zip, zip2);
- zip2 = zip;
- zip2.detach();
- zip.clear();
- }
- QGLSceneNode *n = builder.finalizedSceneNode();
- addNode(n);
- n->setMaterial(qCreateFloor());
- QGraphicsRotation3D *rot = new QGraphicsRotation3D(n);
- rot->setAxis(QVector3D(1, 0, 0));
- rot->setAngle(90.0f);
- n->addTransform(rot);
-}
diff --git a/examples/qt3d/tank/quadplane.h b/examples/qt3d/tank/quadplane.h
deleted file mode 100644
index 2ffc1963..00000000
--- a/examples/qt3d/tank/quadplane.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QUADPLANE_H
-#define QUADPLANE_H
-
-#include "qglbuilder.h"
-
-#include <QSizeF>
-
-class QuadPlane : public QGLSceneNode
-{
-public:
- QuadPlane(QObject *parent = 0,
- QSizeF size = QSizeF(100.0f, 100.0f), int level = 3);
-};
-
-#endif // QUADPLANE_H
diff --git a/examples/qt3d/tank/tank.cpp b/examples/qt3d/tank/tank.cpp
deleted file mode 100644
index fe4fa8e8..00000000
--- a/examples/qt3d/tank/tank.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#include "tank.h"
-
-#include <QSequentialAnimationGroup>
-#include <QPropertyAnimation>
-#include <QImage>
-#include <QPainter>
-#include <QSize>
-
-#ifndef QT_NO_DEBUG
-#include <QThread>
-#include <QCoreApplication>
-#endif
-
-#include "qglbuilder.h"
-#include "qglcylinder.h"
-#include "qglmaterial.h"
-#include "qgltexture2d.h"
-#include "qgraphicsscale3d.h"
-#include "qgraphicsrotation3d.h"
-
-static inline int rval()
-{
- // return an int 64 <--> 192 inclusive
- return (qreal(qrand()) / qreal(RAND_MAX)) * 128 + 64;
-}
-
-static QGLMaterial *qCreateFluid()
-{
- QImage image(QSize(128,128), QImage::Format_ARGB32);
- QRgb col = qRgba(rval(), rval(), rval(), 196);
- image.fill(col);
- QPainter painter(&image);
- QLinearGradient linearGrad(QPointF(56, 56), QPointF(72, 72));
- linearGrad.setColorAt(0, col);
- linearGrad.setColorAt(1, QColor(col).lighter());
- linearGrad.setSpread(QGradient::ReflectSpread);
- painter.fillRect(image.rect(), linearGrad);
- painter.end();
- QGLMaterial *mat = new QGLMaterial;
- QColor white(Qt::white);
- white.setAlpha(128);
- mat->setAmbientColor(white);
- mat->setDiffuseColor(white);
- QGLTexture2D *tex = new QGLTexture2D(mat);
- tex->setImage(image);
- mat->setTexture(tex);
- return mat;
-}
-
-Tank::Tank(QObject *parent) :
- QGLSceneNode(parent)
-{
- QSequentialAnimationGroup *seq = new QSequentialAnimationGroup(this);
- QGraphicsScale3D *scale = new QGraphicsScale3D(this);
- addTransform(scale);
- QPropertyAnimation *anim = new QPropertyAnimation(scale, "scale");
- anim->setDuration(10000);
- anim->setStartValue(QVector3D(1.0f, 0.1f, 1.0f));
- anim->setEndValue(QVector3D(1.0f, 1.2f, 1.0f));
- anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
- seq->addAnimation(anim);
- seq->addPause(2000);
- anim = new QPropertyAnimation(scale, "scale");
- anim->setDuration(10000);
- anim->setStartValue(QVector3D(1.0f, 1.2f, 1.0f));
- anim->setEndValue(QVector3D(1.0f, 0.1f, 1.0f));
- anim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad));
- seq->addAnimation(anim);
- seq->setLoopCount(-1);
- seq->start();
-
- addNode(tankObject());
- setMaterial(qCreateFluid());
-}
-
-QGLSceneNode *Tank::tankObject()
-{
-#ifndef QT_NO_DEBUG
- // NOT THREADSAFE, NOT RE-ENTRANT
- Q_ASSERT(QThread::currentThread() == qApp->thread());
-#endif
- static QGLSceneNode *theTank = 0;
- if (!theTank)
- {
- QGLBuilder build;
- build << QGLCylinder(1.0f, 1.0f, 1.0f, 32);
- theTank = build.finalizedSceneNode();
- theTank->setObjectName("Tank Component");
- QGraphicsRotation3D *rot = new QGraphicsRotation3D(theTank);
- rot->setAxis(QVector3D(1, 0, 0));
- rot->setAngle(-90.0f);
- theTank->addTransform(rot);
- theTank->setY(-theTank->boundingBox().minimum().y());
- }
- return theTank;
-}
diff --git a/examples/qt3d/tank/tank.desktop b/examples/qt3d/tank/tank.desktop
deleted file mode 100644
index 17ebe2c6..00000000
--- a/examples/qt3d/tank/tank.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Tank
-Icon=/usr/share/icons/hicolor/80x80/apps/qt3d.png
-Exec=/usr/bin/invoker --type=e -s /usr/bin/invoker --type=d -s /usr/bin/tank -fullscreen
-OnlyShowIn=X-MeeGo;
-X-MeeGo-Logical-Id=qtn_comm_appname_tank
diff --git a/examples/qt3d/tank/tank.h b/examples/qt3d/tank/tank.h
deleted file mode 100644
index 89449640..00000000
--- a/examples/qt3d/tank/tank.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef TANK_H
-#define TANK_H
-
-#include "qglscenenode.h"
-
-class Tank : public QGLSceneNode
-{
- Q_OBJECT
-public:
- explicit Tank(QObject *parent = 0);
-
-signals:
-
-public slots:
-private:
- static QGLSceneNode *tankObject();
-};
-
-#endif // TANK_H
diff --git a/examples/qt3d/tank/tank.pro b/examples/qt3d/tank/tank.pro
deleted file mode 100644
index fa622cdf..00000000
--- a/examples/qt3d/tank/tank.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-TARGET = tank
-TEMPLATE = app
-CONFIG += qt warn_on
-
-CONFIG += qt3d_deploy_pkg
-include(../../../pkg.pri)
-
-SOURCES += main.cpp\
- tankview.cpp \
- tank.cpp \
- quadplane.cpp
-
-HEADERS += tankview.h \
- tank.h \
- quadplane.h
-
-OTHER_FILES += \
- tank.rc \
- tank.desktop
-
-RC_FILE = tank.rc
diff --git a/examples/qt3d/tank/tank.rc b/examples/qt3d/tank/tank.rc
deleted file mode 100644
index b40ecdc1..00000000
--- a/examples/qt3d/tank/tank.rc
+++ /dev/null
@@ -1 +0,0 @@
-IDI_ICON1 ICON DISCARDABLE "qt3d.ico"
diff --git a/examples/qt3d/tank/tankview.cpp b/examples/qt3d/tank/tankview.cpp
deleted file mode 100644
index 1c2e706d..00000000
--- a/examples/qt3d/tank/tankview.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#include "tankview.h"
-#include "tank.h"
-#include "quadplane.h"
-
-#include "qglscenenode.h"
-#include "qray3d.h"
-#include "qplane3d.h"
-
-#include <QMouseEvent>
-
-TankView::TankView(QWidget *parent)
- : QGLView(parent)
- , m_tankScene(new QGLSceneNode)
- , m_count(0)
-{
- m_tankScene->setParent(this);
- m_tankScene->setPalette(new QGLMaterialCollection(this));
- m_tankScene->setEffect(QGL::LitDecalTexture2D);
- m_tankScene->addNode(new QuadPlane(0, QSizeF(25, 25)));
- Tank *tank = addTank();
- connect(tank, SIGNAL(updated()), this, SLOT(update()));
-
- setToolTip(tr("Double-click to add more tanks"));
- setWindowTitle(tr("Double-click Me!"));
-}
-
-TankView::~TankView()
-{
-}
-
-Tank *TankView::addTank()
-{
- Tank *tank = new Tank(m_tankScene);
- tank->setObjectName(QString(QLatin1String("Tank %1")).arg(m_count));
- ++m_count;
- connect(tank, SIGNAL(updated()), this, SLOT(update()));
- return tank;
-}
-
-void TankView::paintGL(QGLPainter *painter)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- m_tankScene->draw(painter);
-}
-
-void TankView::initializeGL(QGLPainter *painter)
-{
- painter->setClearColor(Qt::gray);
- camera()->setEye(camera()->eye() + QVector3D(0.0f, 4.0f, 0.0f));
- glEnable(GL_BLEND);
-}
-
-void TankView::mouseDoubleClickEvent(QMouseEvent *e)
-{
- Tank *t = addTank();
- QVector3D pick = mapPoint(e->pos());
-
- // find the origin of the near plane
- QRay3D eyeline(camera()->eye(), (camera()->center() - camera()->eye()).normalized());
- QVector3D nearPlaneOrigin = eyeline.point(camera()->nearPlane());
-
- // from the near plane origin move up and across by the pick's XY to find the point
- // on the near plane
- QRay3D up(nearPlaneOrigin, camera()->upVector());
- QVector3D sideDir = QVector3D::crossProduct(camera()->upVector(), -eyeline.direction());
- QRay3D side(up.point(pick.y()), sideDir.normalized());
- QVector3D v = side.point(pick.x());
-
- // intersect the ray thru the picked point on the near plane with the floor
- QRay3D ray(camera()->eye(), v - camera()->eye());
- QPlane3D floorPlane(QVector3D(), QVector3D(0, 1, 0));
- QVector3D pointOnFloor = ray.point(floorPlane.intersection(ray));
- t->setPosition(pointOnFloor);
-}
diff --git a/examples/qt3d/tank/tankview.h b/examples/qt3d/tank/tankview.h
deleted file mode 100644
index 74f26438..00000000
--- a/examples/qt3d/tank/tankview.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef TANKVIEW_H
-#define TANKVIEW_H
-
-#include "qglview.h"
-
-QT_BEGIN_NAMESPACE
-class QGLSceneNode;
-QT_END_NAMESPACE
-
-class Tank;
-
-class TankView : public QGLView
-{
-public:
- TankView(QWidget *parent = 0);
- ~TankView();
-protected:
- void initializeGL(QGLPainter *painter);
- void paintGL(QGLPainter *painter);
- void mouseDoubleClickEvent(QMouseEvent *e);
-private:
- Tank *addTank();
-
- QGLSceneNode *m_tankScene;
- int m_count;
-};
-
-
-
-#endif // TANKVIEW_H