summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/nesting
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/nesting')
-rw-r--r--examples/qt3d/nesting/cubeview.cpp209
-rw-r--r--examples/qt3d/nesting/cubeview.h92
-rw-r--r--examples/qt3d/nesting/main.cpp64
-rw-r--r--examples/qt3d/nesting/nesting.desktop7
-rw-r--r--examples/qt3d/nesting/nesting.pro17
-rw-r--r--examples/qt3d/nesting/nesting.qrc5
-rw-r--r--examples/qt3d/nesting/nesting.rc1
-rw-r--r--examples/qt3d/nesting/qt3d.icobin67646 -> 0 bytes
-rw-r--r--examples/qt3d/nesting/qt3d.pngbin3677 -> 0 bytes
-rw-r--r--examples/qt3d/nesting/qtlogo.pngbin13923 -> 0 bytes
10 files changed, 0 insertions, 395 deletions
diff --git a/examples/qt3d/nesting/cubeview.cpp b/examples/qt3d/nesting/cubeview.cpp
deleted file mode 100644
index d14b5048..00000000
--- a/examples/qt3d/nesting/cubeview.cpp
+++ /dev/null
@@ -1,209 +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 "cubeview.h"
-#include "qglcube.h"
-#include "qglteapot.h"
-#include <QtOpenGL/qglframebufferobject.h>
-#include <QtCore/qpropertyanimation.h>
-
-//! [1]
-CubeView::CubeView(QWidget *parent)
- : QGLView(parent)
- , fbo(0)
- , tangle(0.0f)
- , cangle(0.0f)
- , oangle(0.0f)
-{
- QGLBuilder builder;
- builder.newSection(QGL::Faceted);
- builder << QGLCube(1.5f);
- cube = builder.currentNode();
- cube->setObjectName(QLatin1String("Cube"));
-
- builder.newSection();
- builder << QGLTeapot();
- teapot = builder.currentNode();
- teapot->setObjectName(QLatin1String("Teapot"));
-
- scene = builder.finalizedSceneNode();
- scene->setParent(this);
-//! [1]
-
-//! [2]
- QPropertyAnimation *animation;
-
- animation = new QPropertyAnimation(this, "teapotAngle", this);
- animation->setStartValue(0.0f);
- animation->setEndValue(360.0f);
- animation->setDuration(1000);
- animation->setLoopCount(-1);
- animation->start();
-
- animation = new QPropertyAnimation(this, "cubeAngle", this);
- animation->setStartValue(0.0f);
- animation->setEndValue(360.0f);
- animation->setDuration(5000);
- animation->setLoopCount(-1);
- animation->start();
-
- animation = new QPropertyAnimation(this, "orbitAngle", this);
- animation->setStartValue(0.0f);
- animation->setEndValue(360.0f);
- animation->setDuration(5000);
- animation->setLoopCount(-1);
- animation->start();
-//! [2]
-
-//! [3]
- innerCamera = new QGLCamera(this);
-}
-//! [3]
-
-CubeView::~CubeView()
-{
- delete fbo;
-}
-
-//! [4]
-void CubeView::initializeGL(QGLPainter *)
-{
- fbo = new QGLFramebufferObject(512, 512, QGLFramebufferObject::Depth);
- fboSurface.setFramebufferObject(fbo);
-//! [4]
-
-//! [5]
- QImage textureImage(QLatin1String(":/qtlogo.png"));
- qtlogo.setImage(textureImage);
-
- glEnable(GL_BLEND);
-}
-//! [5]
-
-//! [6]
-void CubeView::paintGL(QGLPainter *painter)
-{
- painter->modelViewMatrix().push();
- painter->projectionMatrix().push();
- painter->pushSurface(&fboSurface);
-//! [6]
-
-//! [7]
- painter->setCamera(innerCamera);
- painter->modelViewMatrix().rotate(tangle, 0.0f, 1.0f, 0.0f);
-
- painter->setFaceColor(QGL::AllFaces, QColor(170, 202, 0));
- painter->setStandardEffect(QGL::LitMaterial);
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- teapot->draw(painter);
-//! [7]
-
-//! [8]
- painter->popSurface();
- painter->projectionMatrix().pop();
- painter->modelViewMatrix().pop();
-//! [8]
-
-//! [9]
- painter->modelViewMatrix().rotate(oangle, 0.0f, 1.0f, 0.0f);
- QMatrix4x4 m = painter->modelViewMatrix();
- QVector3D cube1pos(-1.5f, 0.0f, 0.0f);
- QVector3D cube2pos(1.5f, 0.0f, 0.0f);
-
- if (m.map(cube1pos).z() < m.map(cube2pos).z()) {
- drawCube1(painter, cube1pos);
- drawCube2(painter, cube2pos);
- } else {
- drawCube2(painter, cube2pos);
- drawCube1(painter, cube1pos);
- }
-}
-//! [9]
-
-//! [10]
-void CubeView::drawCube1(QGLPainter *painter, const QVector3D &posn)
-{
- painter->modelViewMatrix().push();
-
- qtlogo.bind();
- painter->setFaceColor(QGL::AllFaces, QColor(202, 100, 0, 150));
- painter->setStandardEffect(QGL::LitDecalTexture2D);
-
- painter->modelViewMatrix().translate(posn);
- painter->modelViewMatrix().rotate(cangle, 1.0f, -1.0f, 1.0f);
-
- glCullFace(GL_FRONT);
- glEnable(GL_CULL_FACE);
- cube->draw(painter);
- glCullFace(GL_BACK);
- cube->draw(painter);
- glDisable(GL_CULL_FACE);
-
- painter->modelViewMatrix().pop();
-}
-//! [10]
-
-//! [11]
-void CubeView::drawCube2(QGLPainter *painter, const QVector3D &posn)
-{
- painter->modelViewMatrix().push();
-
- painter->setFaceColor(QGL::AllFaces, QColor(0, 160, 202, 125));
- painter->setStandardEffect(QGL::LitDecalTexture2D);
- glBindTexture(GL_TEXTURE_2D, fbo->texture());
- glEnable(GL_TEXTURE_2D);
-
- painter->modelViewMatrix().translate(posn);
- painter->modelViewMatrix().rotate(cangle, 1.0f, 1.0f, 1.0f);
-
- glCullFace(GL_FRONT);
- glEnable(GL_CULL_FACE);
- cube->draw(painter);
- glCullFace(GL_BACK);
- cube->draw(painter);
- glDisable(GL_CULL_FACE);
-
- glBindTexture(GL_TEXTURE_2D, 0);
- glDisable(GL_TEXTURE_2D);
-
- painter->modelViewMatrix().pop();
-}
-//! [11]
diff --git a/examples/qt3d/nesting/cubeview.h b/examples/qt3d/nesting/cubeview.h
deleted file mode 100644
index 5bcce12a..00000000
--- a/examples/qt3d/nesting/cubeview.h
+++ /dev/null
@@ -1,92 +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 CUBEVIEW_H
-#define CUBEVIEW_H
-
-#include "qglview.h"
-#include "qglbuilder.h"
-#include "qglframebufferobjectsurface.h"
-
-QT_BEGIN_NAMESPACE
-class QGLFramebufferObject;
-class QGLCamera;
-QT_END_NAMESPACE
-
-class CubeView : public QGLView
-{
- Q_OBJECT
- Q_PROPERTY(qreal teapotAngle READ teapotAngle WRITE setTeapotAngle)
- Q_PROPERTY(qreal cubeAngle READ cubeAngle WRITE setCubeAngle)
- Q_PROPERTY(qreal orbitAngle READ orbitAngle WRITE setOrbitAngle)
-public:
- CubeView(QWidget *parent = 0);
- ~CubeView();
-
- qreal teapotAngle() const { return tangle; }
- void setTeapotAngle(qreal angle) { tangle = angle; update(); }
-
- qreal cubeAngle() const { return cangle; }
- void setCubeAngle(qreal angle) { cangle = angle; update(); }
-
- qreal orbitAngle() const { return oangle; }
- void setOrbitAngle(qreal angle) { oangle = angle; update(); }
-
-protected:
- void initializeGL(QGLPainter *painter);
- void paintGL(QGLPainter *painter);
-
-private:
- QGLSceneNode *scene;
- QGLSceneNode *cube;
- QGLSceneNode *teapot;
- QGLTexture2D qtlogo;
- QGLFramebufferObject *fbo;
- QGLFramebufferObjectSurface fboSurface;
- QGLCamera *innerCamera;
- qreal tangle;
- qreal cangle;
- qreal oangle;
-
- void drawCube1(QGLPainter *painter, const QVector3D &posn);
- void drawCube2(QGLPainter *painter, const QVector3D &posn);
-};
-
-#endif
diff --git a/examples/qt3d/nesting/main.cpp b/examples/qt3d/nesting/main.cpp
deleted file mode 100644
index f0c849d2..00000000
--- a/examples/qt3d/nesting/main.cpp
+++ /dev/null
@@ -1,64 +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 <QApplication>
-#include "cubeview.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- CubeView 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 app.exec();
-}
diff --git a/examples/qt3d/nesting/nesting.desktop b/examples/qt3d/nesting/nesting.desktop
deleted file mode 100644
index 85668cc3..00000000
--- a/examples/qt3d/nesting/nesting.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Nesting
-Icon=/usr/share/icons/hicolor/80x80/apps/qt3d.png
-Exec=/usr/bin/invoker --type=e -s /usr/bin/nesting -fullscreen
-OnlyShowIn=X-MeeGo;
-X-MeeGo-Logical-Id=qtn_comm_appname_nesting
diff --git a/examples/qt3d/nesting/nesting.pro b/examples/qt3d/nesting/nesting.pro
deleted file mode 100644
index 7725c2f3..00000000
--- a/examples/qt3d/nesting/nesting.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = nesting
-CONFIG += qt warn_on
-
-CONFIG += qt3d_deploy_pkg
-include(../../../pkg.pri)
-
-SOURCES = cubeview.cpp main.cpp
-HEADERS = cubeview.h
-RESOURCES = nesting.qrc
-
-OTHER_FILES += \
- nesting.rc \
- nesting.desktop
-
-RC_FILE = nesting.rc
-
diff --git a/examples/qt3d/nesting/nesting.qrc b/examples/qt3d/nesting/nesting.qrc
deleted file mode 100644
index 70f5024d..00000000
--- a/examples/qt3d/nesting/nesting.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>qtlogo.png</file>
-</qresource>
-</RCC>
diff --git a/examples/qt3d/nesting/nesting.rc b/examples/qt3d/nesting/nesting.rc
deleted file mode 100644
index b40ecdc1..00000000
--- a/examples/qt3d/nesting/nesting.rc
+++ /dev/null
@@ -1 +0,0 @@
-IDI_ICON1 ICON DISCARDABLE "qt3d.ico"
diff --git a/examples/qt3d/nesting/qt3d.ico b/examples/qt3d/nesting/qt3d.ico
deleted file mode 100644
index e6442baf..00000000
--- a/examples/qt3d/nesting/qt3d.ico
+++ /dev/null
Binary files differ
diff --git a/examples/qt3d/nesting/qt3d.png b/examples/qt3d/nesting/qt3d.png
deleted file mode 100644
index 21ec0176..00000000
--- a/examples/qt3d/nesting/qt3d.png
+++ /dev/null
Binary files differ
diff --git a/examples/qt3d/nesting/qtlogo.png b/examples/qt3d/nesting/qtlogo.png
deleted file mode 100644
index 7d3e97eb..00000000
--- a/examples/qt3d/nesting/qtlogo.png
+++ /dev/null
Binary files differ