summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/builder
diff options
context:
space:
mode:
authordpope <[email protected]>2012-02-03 15:45:25 +1000
committerRohan McGovern <[email protected]>2012-02-10 07:24:48 +0100
commitbc66ec0bc5f548a72d21557d529f2d03c7417f09 (patch)
tree53aa0444fc698cde712fb8e0486e3da1a56f853d /examples/qt3d/builder
parent98451b5e136af38b00b008ae58ec8243c981eee4 (diff)
Deprecation of the qt/quick3d repository.HEADmaster
Change-Id: I271146636615ab16f79ad3e66985076e2bd7a95c Reviewed-by: Sarah Jane Smith <[email protected]>
Diffstat (limited to 'examples/qt3d/builder')
-rw-r--r--examples/qt3d/builder/builder.cpp192
-rw-r--r--examples/qt3d/builder/builder.desktop7
-rw-r--r--examples/qt3d/builder/builder.h68
-rw-r--r--examples/qt3d/builder/builder.pro17
-rw-r--r--examples/qt3d/builder/builder.qrc5
-rw-r--r--examples/qt3d/builder/builder.rc1
-rw-r--r--examples/qt3d/builder/main.cpp63
-rw-r--r--examples/qt3d/builder/qt-soup.pngbin91448 -> 0 bytes
-rw-r--r--examples/qt3d/builder/qt3d.icobin67646 -> 0 bytes
-rw-r--r--examples/qt3d/builder/qt3d.pngbin3677 -> 0 bytes
10 files changed, 0 insertions, 353 deletions
diff --git a/examples/qt3d/builder/builder.cpp b/examples/qt3d/builder/builder.cpp
deleted file mode 100644
index 3628b4d4..00000000
--- a/examples/qt3d/builder/builder.cpp
+++ /dev/null
@@ -1,192 +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 "builder.h"
-#include "qglbuilder.h"
-#include "qglmaterialcollection.h"
-#include "qgltexture2d.h"
-#include "qglmaterial.h"
-#include "qglscenenode.h"
-#include "qgllightmodel.h"
-
-#include <QtGui/qmatrix4x4.h>
-
-#include <QtCore/qmath.h>
-
-BuilderView::BuilderView(QWidget *parent)
- : QGLView(parent)
- , canScene(new QGLSceneNode(this))
-{
- //! [0]
- QGLSceneNode *can = buildGeometry();
- canScene->addNode(can);
- {
- // rotate the can around so its label shows; and down
- // so the base is facing down
- QMatrix4x4 mat;
- QQuaternion q1 = QQuaternion::fromAxisAndAngle(1.0f, 0.0f, 0.0f, 270.0f);
- QQuaternion q2 = QQuaternion::fromAxisAndAngle(0.0f, 1.0f, 0.0f, 100.0f);
- mat.rotate(q2 * q1);
- can->setLocalTransform(mat);
- }
-
- // display a copy of the can to the left
- QGLSceneNode *node = new QGLSceneNode(canScene);
- node->addNode(can);
- {
- QMatrix4x4 mat;
- mat.translate(-2.0f, 0.0f, -2.0f);
- node->setLocalTransform(mat);
- }
-
- // display a copy of the can to the right
- node = new QGLSceneNode(canScene);
- node->addNode(can);
- {
- QMatrix4x4 mat;
- mat.translate(2.0f, 0.0f, -2.0f);
- node->setLocalTransform(mat);
- }
- //! [0]
-
- // rotate the whole scene about x-axis so that
- // can tops are visible when scene is first displayed
- {
- QMatrix4x4 mat;
- mat.rotate(1.0f, 0.0f, 0.0f, -30.0f);
- canScene->setLocalTransform(mat);
- }
-}
-
-BuilderView::~BuilderView()
-{
- delete canScene;
-}
-
-void BuilderView::initializeGL(QGLPainter *painter)
-{
- QGLLightParameters *light0 = new QGLLightParameters(this);
- light0->setAmbientColor(Qt::white);
- light0->setDiffuseColor(Qt::white);
- light0->setDirection(QVector3D(0.0f, 0.2f, 2.0f));
- painter->setMainLight(light0);
- QGLLightModel *model = new QGLLightModel(this);
- model->setAmbientSceneColor(Qt::white);
- painter->setLightModel(model);
-}
-
-//! [1]
-void BuilderView::paintGL(QGLPainter *painter)
-{
- canScene->draw(painter);
-}
-//! [1]
-
-QGLSceneNode *BuilderView::buildGeometry()
-{
- //! [2]
- QGLBuilder builder;
- QGLSceneNode *root = builder.sceneNode();
-
- QGLMaterial *mat = new QGLMaterial;
- mat->setAmbientColor(Qt::lightGray);
- mat->setDiffuseColor(Qt::lightGray);
- QUrl url;
- url.setPath(QLatin1String(":/images/qt-soup.png"));
- url.setScheme(QLatin1String("file"));
- mat->setTextureUrl(url);
- int canMat = root->palette()->addMaterial(mat);
- root->setMaterialIndex(canMat);
- root->setEffect(QGL::LitMaterial);
- //! [2]
-
- // size data for can
- const qreal canRadius = 1.0f;
- const qreal canHeight = 2.5f;
- const int numSlices = 32;
-
- QGeometryData canRim;
- QVector3D canExtrudeVec(0.0f, 0.0f, -canHeight);
-
- // do the math for the defining points
- for (int i = 0; i < numSlices; ++i)
- {
- qreal angle = (qreal(i) * 2.0 * M_PI) / numSlices;
- canRim.appendVertex(QVector3D(canRadius * qCos(angle),
- canRadius * qSin(angle),
- canHeight / 2.0f));
- }
-
- //! [3]
- // create the flat top lid of the can
- builder.newSection();
- builder.currentNode()->setObjectName(QLatin1String("CanTop"));
- QGeometryData top;
- top.appendVertex(canRim.center());
- top.appendVertexArray(canRim.vertices());
- builder.addTriangulatedFace(top);
-
- // create the sides of the can
- builder.newSection();
- builder.currentNode()->setObjectName(QLatin1String("CanSides"));
- builder.currentNode()->setMaterialIndex(canMat);
- builder.currentNode()->setEffect(QGL::LitModulateTexture2D);
- QGeometryData canTop = canRim;
- canTop.detach();
- canTop.appendVertex(canTop.vertex(0)); // doubled vert for texture seam
- canTop.generateTextureCoordinates(); // generate x texture coords
- QGeometryData canBase = canTop.translated(canExtrudeVec); // base has tex.y == 0
- for (int i = 0; i < canTop.count(); ++i)
- canTop.texCoord(i).setY(1.0); // top has tex.y == 1
- builder.addQuadsInterleaved(canTop, canBase);
-
- // create the flat bottom lid of the can
- builder.newSection();
- builder.currentNode()->setObjectName(QLatin1String("CanBottom"));
- builder.currentNode()->setEffect(QGL::LitMaterial);
- QGeometryData rimReversed = canRim.translated(canExtrudeVec).reversed();
- QGeometryData canBottom;
- canBottom.appendVertex(rimReversed.center());
- canBottom.appendVertexArray(rimReversed.vertices());
- builder.addTriangulatedFace(canBottom);
-
- return builder.finalizedSceneNode();
- //! [3]
-}
diff --git a/examples/qt3d/builder/builder.desktop b/examples/qt3d/builder/builder.desktop
deleted file mode 100644
index da231ad1..00000000
--- a/examples/qt3d/builder/builder.desktop
+++ /dev/null
@@ -1,7 +0,0 @@
-[Desktop Entry]
-Type=Application
-Name=Builder
-Icon=/usr/share/icons/hicolor/80x80/apps/qt3d.png
-Exec=/usr/bin/invoker --type=e -s /usr/bin/builder -fullscreen
-OnlyShowIn=X-MeeGo;
-X-MeeGo-Logical-Id=qtn_comm_appname_builder
diff --git a/examples/qt3d/builder/builder.h b/examples/qt3d/builder/builder.h
deleted file mode 100644
index 01df7d87..00000000
--- a/examples/qt3d/builder/builder.h
+++ /dev/null
@@ -1,68 +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 BUILDER_H
-#define BUILDER_H
-
-#include "qglview.h"
-
-QT_BEGIN_NAMESPACE
-class QGLSceneNode;
-class QGLBuilder;
-QT_END_NAMESPACE
-
-class BuilderView : public QGLView
-{
- Q_OBJECT
-public:
- BuilderView(QWidget *parent = 0);
- ~BuilderView();
-
-protected:
- void initializeGL(QGLPainter *painter);
- void paintGL(QGLPainter *painter);
-
-private:
- QGLSceneNode *buildGeometry();
-
- QGLSceneNode *canScene;
-};
-
-#endif
diff --git a/examples/qt3d/builder/builder.pro b/examples/qt3d/builder/builder.pro
deleted file mode 100644
index aaa1e5d8..00000000
--- a/examples/qt3d/builder/builder.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = builder
-CONFIG += qt warn_on
-
-CONFIG += qt3d_deploy_pkg
-include(../../../pkg.pri)
-
-SOURCES = builder.cpp \
- main.cpp
-HEADERS = builder.h
-RESOURCES += builder.qrc
-
-OTHER_FILES += \
- builder.rc \
- builder.desktop
-
-RC_FILE = builder.rc
diff --git a/examples/qt3d/builder/builder.qrc b/examples/qt3d/builder/builder.qrc
deleted file mode 100644
index 8eefbaf1..00000000
--- a/examples/qt3d/builder/builder.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/images" >
- <file>qt-soup.png</file>
- </qresource>
-</RCC>
diff --git a/examples/qt3d/builder/builder.rc b/examples/qt3d/builder/builder.rc
deleted file mode 100644
index b40ecdc1..00000000
--- a/examples/qt3d/builder/builder.rc
+++ /dev/null
@@ -1 +0,0 @@
-IDI_ICON1 ICON DISCARDABLE "qt3d.ico"
diff --git a/examples/qt3d/builder/main.cpp b/examples/qt3d/builder/main.cpp
deleted file mode 100644
index 29e9f1e6..00000000
--- a/examples/qt3d/builder/main.cpp
+++ /dev/null
@@ -1,63 +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 "builder.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- BuilderView 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/builder/qt-soup.png b/examples/qt3d/builder/qt-soup.png
deleted file mode 100644
index 5b264fff..00000000
--- a/examples/qt3d/builder/qt-soup.png
+++ /dev/null
Binary files differ
diff --git a/examples/qt3d/builder/qt3d.ico b/examples/qt3d/builder/qt3d.ico
deleted file mode 100644
index e6442baf..00000000
--- a/examples/qt3d/builder/qt3d.ico
+++ /dev/null
Binary files differ
diff --git a/examples/qt3d/builder/qt3d.png b/examples/qt3d/builder/qt3d.png
deleted file mode 100644
index 21ec0176..00000000
--- a/examples/qt3d/builder/qt3d.png
+++ /dev/null
Binary files differ