diff options
Diffstat (limited to 'demos/qt3d')
120 files changed, 0 insertions, 9807 deletions
diff --git a/demos/qt3d/README b/demos/qt3d/README deleted file mode 100644 index 9188d92d..00000000 --- a/demos/qt3d/README +++ /dev/null @@ -1,14 +0,0 @@ -This directory contains demos for the Qt3D C++ API. - -Qt3D can be used to extend Qt Quick3D with custom 3D items. Qt3D is also -a general 3D toolkit, featuring a scenegraph API, support for OpenGL VBO's -and other utilities for general 3D programming. - -Research work on Qt3D also continues in the labs repository: - - http://qt.gitorious.org/qt-labs/qt3d - -...and is from time to time ported into Qt Quick3D. - -Check the labs version of Qt3D for additional cutting edge features such as -support for stereoscopic hardware. diff --git a/demos/qt3d/cubehouse/cube.qrc b/demos/qt3d/cubehouse/cube.qrc deleted file mode 100644 index 9de1d255..00000000 --- a/demos/qt3d/cubehouse/cube.qrc +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>qtlogo.png</file> - <file>shaders/objectlineartexgen.frag</file> - <file>shaders/objectlineartexgen.vert</file> -</qresource> -</RCC> diff --git a/demos/qt3d/cubehouse/cubehouse.desktop b/demos/qt3d/cubehouse/cubehouse.desktop deleted file mode 100644 index 1a530fa2..00000000 --- a/demos/qt3d/cubehouse/cubehouse.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=CubeHouse -Icon=icon-l-qt3d -Exec=/usr/bin/cubehouse -fullscreen -OnlyShowIn=X-MeeGo; -X-MeeGo-Logical-Id=qtn_comm_appname_cubehouse -X-MeeGo-Translation-Catalog=essentials diff --git a/demos/qt3d/cubehouse/cubehouse.pro b/demos/qt3d/cubehouse/cubehouse.pro deleted file mode 100644 index 46eda3d2..00000000 --- a/demos/qt3d/cubehouse/cubehouse.pro +++ /dev/null @@ -1,21 +0,0 @@ -TEMPLATE = app -TARGET = cubehouse -CONFIG += qt warn_on -QT += widgets qt3d - -CONFIG += qt3d_deploy_pkg -include(../../../pkg.pri) - -SOURCES = cubeview.cpp main.cpp projectivetextureeffect.cpp -HEADERS = cubeview.h projectivetextureeffect.h -win32:DEFINES+=_CRT_SECURE_NO_WARNINGS -RESOURCES = cube.qrc - -OTHER_FILES += \ - shaders/objectlineartexgen.frag \ - shaders/objectlineartexgen.vert - -OTHER_FILES += \ - cubehouse.rc - -RC_FILE = cubehouse.rc diff --git a/demos/qt3d/cubehouse/cubehouse.rc b/demos/qt3d/cubehouse/cubehouse.rc deleted file mode 100644 index b40ecdc1..00000000 --- a/demos/qt3d/cubehouse/cubehouse.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "qt3d.ico" diff --git a/demos/qt3d/cubehouse/cubeview.cpp b/demos/qt3d/cubehouse/cubeview.cpp deleted file mode 100644 index 492ceae8..00000000 --- a/demos/qt3d/cubehouse/cubeview.cpp +++ /dev/null @@ -1,463 +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 "cubeview.h" -#include "qglcube.h" -#include "qglteapot.h" -#include <QtCore/qdebug.h> -#include <QtCore/qtimer.h> -#include <QtCore/qpropertyanimation.h> -#include <stdio.h> -#include <qmath.h> -#include "projectivetextureeffect.h" - -//#define PROJECTOR_CAMERA_DEBUG_MARKERS - - -CubeView::CubeView(QWindow *parent) - : QGLView(parent), scene(0), cube(0), teapot(0), room(0), - sensitivity(0.1f), - lightParameters(0), - showFrameRate(false), - stereo(false), - useProjectiveTextureEffect(false), - cangle(0.0f), - prevX(0), - prevY(0), - prevZ(0), - havePrev(false), - projectiveTextureEffect(0) -{ - setOption(CameraNavigation, false); - - roomCamera = new QGLCamera(this); - roomCamera->setAdjustForAspectRatio(false); - - QPropertyAnimation *animation; - - animation = new QPropertyAnimation(this, "cubeAngle", this); - animation->setStartValue(0.0f); - animation->setEndValue(360.0f); - animation->setDuration(5000); - animation->setLoopCount(-1); - animation->start(); - - time.start(); -} - -void CubeView::initializeGL(QGLPainter *painter) -{ - QGLBuilder builder; - builder << QGL::Faceted << QGLCube(1.0f); - cube = builder.currentNode(); - builder << QGL::Faceted; - room = builder.currentNode(); - builder.pushNode(); - QGLSceneNode *back = builder.newNode(); - { - QGeometryData quad; - quad.appendVertex(QVector3D(-3.0f, -3.0f, -15.0f)); - quad.appendVertex(QVector3D( 3.0f, -3.0f, -15.0f)); - quad.appendVertex(QVector3D( 3.0f, 3.0f, -15.0f)); - quad.appendVertex(QVector3D(-3.0f, 3.0f, -15.0f)); - builder.addQuads(quad); - } - QGLSceneNode *left = builder.newNode(); - { - QGeometryData quad; - quad.appendVertex(QVector3D(-3.0f, -3.0f, -15.0f)); - quad.appendVertex(QVector3D(-3.0f, 3.0f, -15.0f)); - quad.appendVertex(QVector3D(-3.0f, 3.0f, 0.0f)); - quad.appendVertex(QVector3D(-3.0f, -3.0f, 0.0f)); - builder.addQuads(quad); - } - QGLSceneNode *right = builder.newNode(); - { - QGeometryData quad; - quad.appendVertex(QVector3D(3.0f, 3.0f, -15.0f)); - quad.appendVertex(QVector3D(3.0f, -3.0f, -15.0f)); - quad.appendVertex(QVector3D(3.0f, -3.0f, 0.0f)); - quad.appendVertex(QVector3D(3.0f, 3.0f, 0.0f)); - builder.addQuads(quad); - } - QGLSceneNode *top = builder.newNode(); - { - QGeometryData quad; - quad.appendVertex(QVector3D(-3.0f, 3.0f, -15.0f)); - quad.appendVertex(QVector3D( 3.0f, 3.0f, -15.0f)); - quad.appendVertex(QVector3D( 3.0f, 3.0f, 0.0f)); - quad.appendVertex(QVector3D(-3.0f, 3.0f, 0.0f)); - builder.addQuads(quad); - } - QGLSceneNode *bottom = builder.newNode(); - { - QGeometryData quad; - quad.appendVertex(QVector3D(-3.0f, -3.0f, -15.0f)); - quad.appendVertex(QVector3D(-3.0f, -3.0f, 0.0f)); - quad.appendVertex(QVector3D( 3.0f, -3.0f, 0.0f)); - quad.appendVertex(QVector3D( 3.0f, -3.0f, -15.0f)); - builder.addQuads(quad); - } - builder.popNode(); - - int index; - QGLMaterialCollection *palette = builder.sceneNode()->palette(); - - QGLMaterial *mat1 = new QGLMaterial(); - mat1->setDiffuseColor(QColor(128, 100, 0)); - index = palette->addMaterial(mat1); - back->setMaterialIndex(index); - - QGLMaterial *mat2 = new QGLMaterial(); - mat2->setDiffuseColor(Qt::cyan); - index = palette->addMaterial(mat2); - left->setMaterialIndex(index); - right->setMaterialIndex(index); - - QGLMaterial *mat3 = new QGLMaterial(); - mat3->setDiffuseColor(Qt::yellow); - index = palette->addMaterial(mat3); - top->setMaterialIndex(index); - bottom->setMaterialIndex(index); - - //qDumpScene(room); - - builder.newSection(); - builder << QGLTeapot(); - teapot = builder.currentNode(); - QGLMaterial *china = new QGLMaterial(); - china->setAmbientColor(QColor(192, 150, 128)); - china->setSpecularColor(QColor(60, 60, 60)); - china->setShininess(128); - teapot->setMaterial(china); - - scene = builder.finalizedSceneNode(); - scene->setParent(this); - - roomModel = new QGLLightModel(this); - roomModel->setAmbientSceneColor(Qt::white); - roomModel->setViewerPosition(QGLLightModel::LocalViewer); - - normalModel = new QGLLightModel(this); - - lightParameters = new QGLLightParameters(this); - lightParameters->setPosition(QVector3D(0.0f, 0.0f, 3.0f)); - painter->setMainLight(lightParameters); - - QImage textureImage(QLatin1String(":/qtlogo.png")); - texture.setImage(textureImage); - - if (stereo) { - camera()->setEyeSeparation(0.4f); - roomCamera->setEyeSeparation(0.1f); - } - - if (useProjectiveTextureEffect) - { - // initialize the projector camera - projectorCamera = new QGLCamera(this); - projectiveTextureEffect = new ProjectiveTextureEffect; - connect(projectorCamera, SIGNAL(viewChanged()), - this, SLOT(updateProjectorViewMatrix())); - connect(projectorCamera, SIGNAL(projectionChanged()), - this, SLOT(updateProjectorProjectionMatrix())); - } -} - -void CubeView::paintGL(QGLPainter *painter) -{ - if (showFrameRate) - qWarning("time since last frame: %d ms", time.restart()); - - glDisable(GL_BLEND); - - // Animate the projector position so the effect can be seen - if (useProjectiveTextureEffect) - { - projectorCamera->tiltPanRollCenter - (-0.1f, -0.3f, 0.0f, QGLCamera::PanTiltRoll); - } - - painter->modelViewMatrix().push(); - painter->projectionMatrix().push(); - - painter->setStandardEffect(QGL::LitMaterial); - painter->setCamera(roomCamera); - painter->setLightModel(roomModel); - room->draw(painter); - - painter->modelViewMatrix().pop(); - painter->projectionMatrix().pop(); - - painter->modelViewMatrix().push(); - // These are the model transformations - painter->modelViewMatrix().translate(-0.8f, -1.5f, -3.0f); - painter->setLightModel(normalModel); - if (useProjectiveTextureEffect) - { - modelMatrix.push(); - // For an effect that looks like we have only one projector - // Over the whole screen, we duplicate transformations into the - // projector's model matrix. For now, we don't apply the transform - // to center the effect on each object and see it more clearly. - // modelMatrix.translate(-0.8f, -1.5f, -3.0f); - - updateProjectiveTextureEffect(); - - painter->setUserEffect(projectiveTextureEffect); - texture.bind(); - } - else - { - painter->setStandardEffect(QGL::LitMaterial); - } - teapot->draw(painter); - - if (useProjectiveTextureEffect) - modelMatrix.pop(); - painter->modelViewMatrix().pop(); - - - // These are the model transformations - painter->modelViewMatrix().push(); - painter->modelViewMatrix().translate(1.0f, -0.5f, 0.0f); - painter->modelViewMatrix().rotate(cangle, 1.0f, 1.0f, 1.0f); - - texture.bind(); - if (useProjectiveTextureEffect) - { - modelMatrix.push(); - // For an effect that looks like we have only one projector - // Over the whole screen, we duplicate transformations into the - // projector's model matrix. For now, we don't apply the transform - // to center the effect on each object and see it more clearly. -// modelMatrix.translate(1.0f, -0.5f, 0.0f); - modelMatrix.rotate(cangle, 1.0f, 1.0f, 1.0f); - updateProjectiveTextureEffect(); - painter->setUserEffect(projectiveTextureEffect); -// painter->setStandardEffect(QGL::FlatDecalTexture2D); - cube->draw(painter); - modelMatrix.pop(); - } - else - { - glEnable(GL_BLEND); - painter->setStandardEffect(QGL::LitDecalTexture2D); - painter->setFaceColor(QGL::AllFaces, QColor(170, 202, 0, 120)); - glDisable(GL_DEPTH_TEST); - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - cube->draw(painter); - glCullFace(GL_BACK); - cube->draw(painter); - glDisable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - glBindTexture(GL_TEXTURE_2D, 0); - } - - painter->modelViewMatrix().pop(); -#ifdef PROJECTOR_CAMERA_DEBUG_MARKERS - if (useProjectiveTextureEffect) - { - - painter->modelViewMatrix().push(); - modelMatrix.push(); - painter->modelViewMatrix().translate(projectorCamera->eye()); - painter->modelViewMatrix().scale(0.2); - painter->setStandardEffect(QGL::LitMaterial); - modelMatrix.translate(projectorCamera->eye()); - cube->draw(painter); - - modelMatrix.pop(); - painter->modelViewMatrix().pop(); - - painter->modelViewMatrix().push(); - modelMatrix.push(); - painter->modelViewMatrix().translate(projectorCamera->center()); - painter->modelViewMatrix().scale(0.1); - painter->setStandardEffect(QGL::LitMaterial); - cube->draw(painter); - modelMatrix.pop(); - painter->modelViewMatrix().pop(); - - QVector3DArray verts; - - QVector3D origin = projectorCamera->eye(); - - QVector3D target = projectorCamera->center(); - QVector3D direction = projectorCamera->center() - projectorCamera->eye(); - - QVector3D normal = projectorCamera->upVector().normalized(); - qreal nearPlane = projectorCamera->nearPlane(); - qreal farPlane = projectorCamera->farPlane(); - qreal fieldOfView = projectorCamera->fieldOfView(); - - QVector3D nearTopLeft; - QVector3D nearTopRight; - QVector3D nearBottomLeft; - QVector3D nearBottomRight; - QVector3D farTopLeft; - QVector3D farTopRight; - QVector3D farBottomLeft; - QVector3D farBottomRight; - - QSizeF viewSize = projectorCamera->viewSize(); - - qreal fieldDepthRatio = farPlane / nearPlane; - - QVector3D rightVector = QVector3D::crossProduct(direction, normal).normalized() * viewSize.width() / 2.0; - QVector3D topVector = normal * viewSize.height() / 2.0; - - QVector3D topLeftVector = direction + topVector - rightVector; - QVector3D topRightVector = direction + topVector + rightVector; - QVector3D bottomLeftVector = direction - topVector - rightVector; - QVector3D bottomRightVector = direction - topVector + rightVector; - - verts.append(origin, origin + (direction * (farPlane / direction.length()))); - - verts.append(origin, origin + (topLeftVector * fieldDepthRatio)); - verts.append(origin, origin + (topRightVector * fieldDepthRatio)); - verts.append(origin, origin + (bottomLeftVector * fieldDepthRatio)); - verts.append(origin, origin + (bottomRightVector * fieldDepthRatio)); - - verts.append(origin + topLeftVector, origin + topRightVector); - verts.append(origin + topRightVector, origin + bottomRightVector); - verts.append(origin + bottomRightVector, origin + bottomLeftVector); - verts.append(origin + bottomLeftVector, origin + topLeftVector); - - verts.append(origin + (topLeftVector * fieldDepthRatio), - (origin + topRightVector * fieldDepthRatio)); - verts.append(origin + (topRightVector * fieldDepthRatio), - (origin + bottomRightVector * fieldDepthRatio)); - verts.append(origin + (bottomRightVector * fieldDepthRatio), - (origin + bottomLeftVector * fieldDepthRatio)); - verts.append(origin + (bottomLeftVector * fieldDepthRatio), - (origin + topLeftVector * fieldDepthRatio)); - - verts.append(origin, origin + normal); - - painter->modelViewMatrix().push(); - painter->setStandardEffect(QGL::FlatColor); - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, QGLAttributeValue(verts)); - glLineWidth(1.0f); - - painter->setColor(QColor(255,255,255,255)); - painter->draw(QGL::Lines, verts.size()); - painter->modelViewMatrix().pop(); - } -#endif -} - -//inline void CubeView::setProjectiveTextureEffect(bool value) -//{ -// useProjectiveTextureEffect = value; -//} - -void CubeView::setCubeAngle(qreal angle) -{ - cangle = angle; - accelerometerTimeout(); - update(); -} - -void CubeView::accelerometerTimeout() -{ - QVector3D g = gravity(); - camera()->setMotionAdjustment(g); - roomCamera->setMotionAdjustment(g); -} - -QVector3D CubeView::gravity() const -{ - // Access the raw accelerometer data on the N900. - FILE *file = fopen("/sys/class/i2c-adapter/i2c-3/3-001d/coord", "r"); - if (!file) - return QVector3D(0, 0, -1); - float x = 0; - float y = 0; - float z = 0; - int numValues = fscanf(file, "%f %f %f", &x, &y, &z); - fclose(file); - - if (numValues!=3) - qWarning("i2c adaptor returned less then 3 values on fscanf."); - - // Smooth out the reported values. Large changes are applied as-is, - // and small jitters smooth to the rest position. - if (havePrev) { - qreal xdiff = x - prevX; - qreal ydiff = y - prevY; - qreal zdiff = z - prevZ; - if (qAbs(xdiff) < 20.0f && qAbs(ydiff) < 20.0f && qAbs(zdiff) < 20.0f) { - x = prevX + xdiff * 0.1f; - y = prevY + ydiff * 0.1f; - z = prevZ + zdiff * 0.1f; - } - } - prevX = x; - prevY = y; - prevZ = z; - havePrev = true; - - return QVector3D((x / 1000.0f) * sensitivity, - (-y / 1000.0f) * sensitivity, -z / 1000.0f); -} - -void CubeView::updateProjectorViewMatrix() -{ - Q_ASSERT_X(projectorCamera != 0, Q_FUNC_INFO, "Null projector camera in updateProjectorViewMatrix()"); - projectiveTextureEffect->setProjectorViewMatrix(projectorCamera->modelViewMatrix()); - updateProjectiveTextureEffect(); -} - -void CubeView::updateProjectorProjectionMatrix() -{ - qreal projectorAspectRatio = 1.0; - projectiveTextureEffect->setProjectorProjectionMatrix(projectorCamera->projectionMatrix(projectorAspectRatio)); - updateProjectiveTextureEffect(); -} - -void CubeView::updateProjectiveTextureEffect() -{ - projectiveTextureEffect->setProjectorDirection(projectorCamera->center() - projectorCamera->eye()); - projectiveTextureEffect->setModelMatrix(modelMatrix); -} diff --git a/demos/qt3d/cubehouse/cubeview.h b/demos/qt3d/cubehouse/cubeview.h deleted file mode 100644 index d6f5fb1f..00000000 --- a/demos/qt3d/cubehouse/cubeview.h +++ /dev/null @@ -1,108 +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 CUBEVIEW_H -#define CUBEVIEW_H - -#include "qglview.h" -#include "qglbuilder.h" -#include "qgltexture2d.h" -#include <QtCore/qdatetime.h> - -class ProjectiveTextureEffect; - -class CubeView : public QGLView -{ - Q_OBJECT - Q_PROPERTY(qreal cubeAngle READ cubeAngle WRITE setCubeAngle) -public: - CubeView(QWindow *parent = 0); - ~CubeView() {} - - void setShowFrameRate(bool value) { showFrameRate = value; } - void setStereo(bool value) { stereo = value; } - void setProjectiveTextureEffect(bool value) -{ - useProjectiveTextureEffect = value; -} - - qreal cubeAngle() const { return cangle; } - void setCubeAngle(qreal angle); - -protected: - void initializeGL(QGLPainter *painter); - void paintGL(QGLPainter *painter); - -private slots: - void accelerometerTimeout(); - void updateProjectorViewMatrix(); - void updateProjectorProjectionMatrix(); - void updateProjectiveTextureEffect(); - -private: - QGLTexture2D texture; - QGLSceneNode *scene; - QGLSceneNode *cube; - QGLSceneNode *teapot; - QGLSceneNode *room; - QGLCamera *roomCamera; - QGLCamera *projectorCamera; - qreal sensitivity; - QGLLightModel *roomModel; - QGLLightModel *normalModel; - QGLLightParameters *lightParameters; - bool showFrameRate; - bool stereo; - bool useProjectiveTextureEffect; - QTime time; - qreal cangle; - mutable qreal prevX, prevY, prevZ; - mutable bool havePrev; - - QVector3D gravity() const; - - ProjectiveTextureEffect* projectiveTextureEffect; - QMatrix4x4 biasMatrix; - QMatrix4x4Stack modelMatrix; - QMatrix4x4 objectLinearTexgenMatrix; -}; - -#endif diff --git a/demos/qt3d/cubehouse/icon-l-qt3d.png b/demos/qt3d/cubehouse/icon-l-qt3d.png Binary files differdeleted file mode 100644 index 07cc4092..00000000 --- a/demos/qt3d/cubehouse/icon-l-qt3d.png +++ /dev/null diff --git a/demos/qt3d/cubehouse/m5-cubehouse.desktop b/demos/qt3d/cubehouse/m5-cubehouse.desktop deleted file mode 100644 index 9b1bd54a..00000000 --- a/demos/qt3d/cubehouse/m5-cubehouse.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Name=CubeHouse -Comment=Qt3D example application -Exec=/usr/bin/cubehouse -fullscreen -Icon=icon-l-qt3d -Terminal=false -Type=Application -Categories=Development; -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable -X-Text-Domain=qt3d - diff --git a/demos/qt3d/cubehouse/main.cpp b/demos/qt3d/cubehouse/main.cpp deleted file mode 100644 index 6cf02e22..00000000 --- a/demos/qt3d/cubehouse/main.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QApplication> -#include "cubeview.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - CubeView view; - - QStringList args = QCoreApplication::arguments(); - if (args.contains(QLatin1String("-framerate"))) - view.setShowFrameRate(true); - if (args.contains(QLatin1String("-projectivetexture"))) - view.setProjectiveTextureEffect(true); - if (args.contains(QLatin1String("-stereo"))) - view.setStereo(true); - else if (view.stereoType() != QGLView::RedCyanAnaglyph) - view.setStereo(true); - - int w_pos = args.indexOf(QLatin1String("-width")); - int h_pos = args.indexOf(QLatin1String("-height")); - if (w_pos >= 0 && h_pos >= 0) - { - bool ok = true; - int w = args.at(w_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse width argument:" << args; - return 1; - } - int h = args.at(h_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse height argument:" << args; - return 1; - } - view.resize(w, h); - } - else - { - view.resize(800, 600); - } - view.show(); - return app.exec(); -} diff --git a/demos/qt3d/cubehouse/projectivetextureeffect.cpp b/demos/qt3d/cubehouse/projectivetextureeffect.cpp deleted file mode 100644 index 4a88dd37..00000000 --- a/demos/qt3d/cubehouse/projectivetextureeffect.cpp +++ /dev/null @@ -1,148 +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 <QFile> -#include "projectivetextureeffect.h" -#include <QtOpenGL/qglshaderprogram.h> - -static const QMatrix4x4 biasMatrix = QMatrix4x4(0.5, 0.0, 0.0, 0.5, - 0.0, 0.5, 0.0, 0.5, - 0.0, 0.0, 0.5, 0.5, - 0.0, 0.0, 0.0, 1.0); - -/*! - The ProjectiveTextureEffect mimics the effect of shining a projector onto - a scene from a specific direction. Vertex coordinates in object space are - transformed into eye-space coordinates relative to the light direction, - using the objectLinearTexgenMatrix. -*/ -ProjectiveTextureEffect::ProjectiveTextureEffect() : - matrixDirty(true) -{ - setupShaders(); -} - -void ProjectiveTextureEffect::setActive(QGLPainter *painter, bool flag) -{ - QGLShaderProgramEffect::setActive(painter, flag); -} - -void ProjectiveTextureEffect::update(QGLPainter *painter, QGLPainter::Updates updates) -{ - QGLShaderProgramEffect::update(painter, updates); - - if (matrixDirty) - { - recalulateObjectLinearTexgenMatrix(); - matrixDirty = false; - } - - program()->setUniformValue("objectLinearTexgenMatrix", - objectLinearTexgenMatrix); - program()->setUniformValue("projectorDirection", - projectorDirection); -} - -void ProjectiveTextureEffect::setProjectorDirection(const QVector4D &direction) -{ - this->projectorDirection = direction; - matrixDirty = true; -} - -void ProjectiveTextureEffect::setCameraModelViewMatrix(const QMatrix4x4 &newCameraModelViewMatrix) -{ - cameraModelViewMatrix = newCameraModelViewMatrix; - bool invertible; - inverseCameraModelViewMatrix = - newCameraModelViewMatrix.inverted(&invertible); - Q_ASSERT(invertible); - if (!invertible) - qWarning() << "camera Model view matrix not invertible in ProjectiveDepthTestEffect::setCameraModelViewMatrix()"; - matrixDirty = true; -} - -void ProjectiveTextureEffect::setProjectorProjectionMatrix(const QMatrix4x4 &newMatrix) -{ - projectorProjectionMatrix = newMatrix; - matrixDirty = true; -} - -void ProjectiveTextureEffect::setProjectorViewMatrix(const QMatrix4x4 &newMatrix) -{ - projectorViewMatrix = newMatrix; - matrixDirty = true; -} - -void ProjectiveTextureEffect::setModelMatrix(const QMatrix4x4 &newMatrix) -{ - modelMatrix = newMatrix; - matrixDirty = true; -} - -void ProjectiveTextureEffect::recalulateObjectLinearTexgenMatrix() -{ - objectLinearTexgenMatrix = biasMatrix * - projectorProjectionMatrix * - projectorViewMatrix * - modelMatrix; -} - -void ProjectiveTextureEffect::setupShaders() -{ - QString vertexShaderFileName = QLatin1String(":/shaders/objectlineartexgen.vert"); - QFile vertexShaderFile(vertexShaderFileName); - if (vertexShaderFile.open(QIODevice::ReadOnly | QIODevice::Text)) - { - setVertexShader(vertexShaderFile.readAll()); - } else { - qWarning() << "Could not open file "<<vertexShaderFileName<<", failed to load vertex shader"; - } - - QString fragmentShaderFileName = QLatin1String(":/shaders/objectlineartexgen.frag"); - QFile fragmentShaderFile(fragmentShaderFileName); - if (fragmentShaderFile.open(QIODevice::ReadOnly | QIODevice::Text)) - { - setFragmentShader(fragmentShaderFile.readAll()); - } else { - qWarning() << "Could not open file "<<fragmentShaderFileName<<", failed to load fragment shader"; - } - -} diff --git a/demos/qt3d/cubehouse/projectivetextureeffect.h b/demos/qt3d/cubehouse/projectivetextureeffect.h deleted file mode 100644 index 8730710a..00000000 --- a/demos/qt3d/cubehouse/projectivetextureeffect.h +++ /dev/null @@ -1,79 +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 PROJECTIVEDTEXTUREEFFECT_H -#define PROJECTIVEDTEXTUREEFFECT_H - -#include "qglshaderprogrameffect.h" -//#include "deptheffect.h" -#include "qmatrix4x4.h" - -class ProjectiveTextureEffect : public QGLShaderProgramEffect -{ -public: - explicit ProjectiveTextureEffect(); - virtual void setActive(QGLPainter *painter, bool flag); - virtual void update(QGLPainter *painter, QGLPainter::Updates updates); - virtual void setProjectorDirection(const QVector4D &direction); - - void setCameraModelViewMatrix(const QMatrix4x4 &newCameraModelViewMatrix); - void setProjectorProjectionMatrix(const QMatrix4x4 &newMatrix); - void setProjectorViewMatrix(const QMatrix4x4 &newMatrix); - void setModelMatrix(const QMatrix4x4 &newMatrix); - -// TODO: -// QMatrix4x4 eyeLinearTexgenMatrix; - -protected: - virtual void setupShaders(); -private: - virtual void recalulateObjectLinearTexgenMatrix(); - bool matrixDirty; - QMatrix4x4 modelMatrix; - QMatrix4x4 objectLinearTexgenMatrix; - QMatrix4x4 cameraModelViewMatrix; - QMatrix4x4 inverseCameraModelViewMatrix; - QMatrix4x4 projectorProjectionMatrix; - QMatrix4x4 projectorViewMatrix; - QVector4D projectorDirection; -}; - -#endif // PROJECTIVEDTEXTUREEFFECT_H diff --git a/demos/qt3d/cubehouse/qt3d.ico b/demos/qt3d/cubehouse/qt3d.ico Binary files differdeleted file mode 100644 index 1d07c43d..00000000 --- a/demos/qt3d/cubehouse/qt3d.ico +++ /dev/null diff --git a/demos/qt3d/cubehouse/qtlogo.png b/demos/qt3d/cubehouse/qtlogo.png Binary files differdeleted file mode 100644 index 7d3e97eb..00000000 --- a/demos/qt3d/cubehouse/qtlogo.png +++ /dev/null diff --git a/demos/qt3d/cubehouse/shaders/depth.frag b/demos/qt3d/cubehouse/shaders/depth.frag deleted file mode 100644 index 0dc15c96..00000000 --- a/demos/qt3d/cubehouse/shaders/depth.frag +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -varying float depth; - -void main(void) -{ - float stupidMathsDepth = depth; - stupidMathsDepth = (stupidMathsDepth + 10.0) / 20.0; -// gl_FragColor = vec4(vec3(stupidMathsDepth), 1.0); - gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0); -}; diff --git a/demos/qt3d/cubehouse/shaders/depth.vert b/demos/qt3d/cubehouse/shaders/depth.vert deleted file mode 100644 index e356dfa0..00000000 --- a/demos/qt3d/cubehouse/shaders/depth.vert +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -attribute highp vec4 vertex; -varying float depth; -uniform highp mat4 qt_ModelViewMatrix; -uniform highp mat4 qt_ProjectionMatrix; - -attribute highp vec4 texCoords; - -uniform highp mat4 cameraCombinedMatrix; -uniform highp mat4 cameraModelViewMatrix; -uniform highp mat4 cameraProjectionMatrix; - -uniform highp mat4 lightCombinedMatrix; - -varying highp vec4 qt_TexCoord0; -varying highp vec4 onScreenPosition; -varying highp vec4 lightScreenPosition; -varying highp vec4 worldSpaceVertex; - -void main(void) -{ - qt_TexCoord0 = texCoords; - - // qt_ProjectionMatrix == cameraProjectionMatrix -// onScreenPosition = qt_ProjectionMatrix * qt_ModelViewMatrix * vertex; -//onScreenPosition = cameraProjectionMatrix * qt_ModelViewMatrix * vertex; - - onScreenPosition = cameraProjectionMatrix - * cameraModelViewMatrix -// * qt_ModelViewMatrix - * vertex; - depth = onScreenPosition.z; - - gl_Position = onScreenPosition; -}; diff --git a/demos/qt3d/cubehouse/shaders/depthTestShader.frag b/demos/qt3d/cubehouse/shaders/depthTestShader.frag deleted file mode 100644 index 375a16df..00000000 --- a/demos/qt3d/cubehouse/shaders/depthTestShader.frag +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -// This is equivilent to GL_REPLACE -varying highp vec4 qt_TexCoord0; - -uniform mediump sampler2D texture; -uniform mediump mat4 textureMatrix; -varying highp vec4 onScreenPosition; -varying highp vec4 lightScreenPosition; -varying highp vec4 worldSpaceVertex; -varying float lightDepth; -varying float actualDepth; - -void main(void) -{ - - // I should be able to build a matrix to do this: -// vec4 normalizedOnScreenPosition = (onScreenPosition + 5.0) / 10.0; -vec4 normalizedLightScreenPosition = (((lightScreenPosition -//+ lightScreenPosition.w -) / lightScreenPosition.w ) + 1.0) / 2.0; - -// float lightMapDepth = texture2D(texture, normalizedLightScreenPosition.st).z; - float lightMapDepth = texture2D(texture, normalizedLightScreenPosition.st ).z; -// gl_FragColor = vec4(lightMapDepth, lightMapDepth, lightMapDepth, 1.0); - -// gl_FragColor = vec4(normalizedLightScreenPosition.st,0.0,1.0); - -// float lightActualDepth = normalizedLightScreenPosition.z; - float lightActualDepth = lightDepth; -// gl_FragColor = vec4(lightActualDepth, lightActualDepth, lightActualDepth, 1.0); - float lightActualDepthWithStupidMaths = (lightActualDepth + 10.0) / 20.0; - float lightDepthWithStupidMaths = (lightDepth + 10.0) / 20.0; -// gl_FragColor = vec4(vec3(lightActualDepthWithStupidMaths), 1.0); - - -// if (lightActualDepthWithStupidMaths > lightMapDepth ) -// gl_FragColor = vec4(0.2, 0.2, 0.2, 1.0); -// else - gl_FragColor = vec4(1.0, 1.0, 0.5, 1.0); - - -// gl_FragColor = vec4(lightDepthWithStupidMaths, lightDepthWithStupidMaths, lightDepthWithStupidMaths, 1.0); - - -//float stupidMathslightDepth = (lightDepth + 10.0) / 20; -//gl_FragColor = vec4(stupidMathslightDepth, stupidMathslightDepth, stupidMathslightDepth, 1.0); - -//float stupidMathsActualDepth = (actualDepth + 10.0) / 20.0; -//gl_FragColor = vec4(stupidMathsActualDepth, stupidMathsActualDepth, stupidMathsActualDepth, 1.0); - -}; diff --git a/demos/qt3d/cubehouse/shaders/depthTestShader.vert b/demos/qt3d/cubehouse/shaders/depthTestShader.vert deleted file mode 100644 index a993b240..00000000 --- a/demos/qt3d/cubehouse/shaders/depthTestShader.vert +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -attribute highp vec4 vertex; -attribute highp vec4 texCoords; - -uniform highp mat4 matrix; -uniform highp mat4 qt_ProjectionMatrix; -uniform highp mat4 qt_ModelViewMatrix; - -uniform highp mat4 cameraCombinedMatrix; -uniform highp mat4 lightCombinedMatrix; - -uniform highp mat4 cameraModelViewMatrix; -uniform highp mat4 inverseCameraModelViewMatrix; -uniform highp mat4 lightModelViewMatrix; - -uniform highp mat4 cameraProjectionMatrix; -uniform highp mat4 lightProjectionMatrix; - -varying highp vec4 qt_TexCoord0; -varying highp vec4 onScreenPosition; -varying highp vec4 lightScreenPosition; -varying highp vec4 worldSpaceVertex; -varying float lightDepth; -varying float actualDepth; - -void main(void) -{ - qt_TexCoord0 = texCoords; -// onScreenPosition = matrix * vertex; -//onScreenPosition = cameraCombinedMatrix * vertex; // works - onScreenPosition = qt_ProjectionMatrix * - qt_ModelViewMatrix - * vertex; - - highp vec4 worldPosition = inverseCameraModelViewMatrix * - qt_ModelViewMatrix * vertex; - -// lightScreenPosition = lightCombinedMatrix * vertex; -// lightScreenPosition = lightCombinedMatrix * worldPosition; - lightScreenPosition = lightProjectionMatrix * lightModelViewMatrix * vertex; - lightDepth = lightScreenPosition.z; - - actualDepth = onScreenPosition.z; - - worldSpaceVertex = vertex; - -// gl_Position = qt_ProjectionMatrix * worldPosition; -//gl_Position = onScreenPosition; -gl_Position = onScreenPosition; -// gl_Position = lightScreenPosition; -}; diff --git a/demos/qt3d/cubehouse/shaders/objectlineartexgen.frag b/demos/qt3d/cubehouse/shaders/objectlineartexgen.frag deleted file mode 100644 index 0f7bb92e..00000000 --- a/demos/qt3d/cubehouse/shaders/objectlineartexgen.frag +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -uniform sampler2D texture; -varying highp vec4 texCoord; -varying float facingProjector; - -void main(void) -{ - vec2 clampedCoords = texCoord.st; - clampedCoords = clamp(texCoord.st, vec2(0.0), vec2(1.0)); - vec4 textureColor = texture2D(texture, clampedCoords); - gl_FragColor = vec4(textureColor.rgb * facingProjector, 1.0); -}; diff --git a/demos/qt3d/cubehouse/shaders/objectlineartexgen.vert b/demos/qt3d/cubehouse/shaders/objectlineartexgen.vert deleted file mode 100644 index 61ffe7ce..00000000 --- a/demos/qt3d/cubehouse/shaders/objectlineartexgen.vert +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -attribute highp vec4 qt_Vertex; -attribute highp vec4 qt_Normal; -uniform highp mat3 qt_NormalMatrix; -uniform highp mat4 qt_ModelViewProjectionMatrix; - -uniform highp mat4 objectLinearTexgenMatrix; -uniform highp vec4 projectorDirection; - -varying highp vec4 texCoord; -varying float facingProjector; - -void main(void) -{ - texCoord = objectLinearTexgenMatrix * qt_Vertex; - vec4 normal = normalize(vec4(qt_NormalMatrix * vec3(qt_Vertex), qt_Vertex.w)); - // We're facing the projector if the normal and projector direction - // are pointing in opposite directions, i.e. if their dot product - // is negative. - facingProjector = -dot(normalize(normal), normalize(projectorDirection)); - facingProjector = clamp(facingProjector, 0.0, 1.0); - gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; -}; diff --git a/demos/qt3d/icon.png b/demos/qt3d/icon.png Binary files differdeleted file mode 100644 index 07cc4092..00000000 --- a/demos/qt3d/icon.png +++ /dev/null diff --git a/demos/qt3d/pageflip/gradient.png b/demos/qt3d/pageflip/gradient.png Binary files differdeleted file mode 100644 index ddadf69d..00000000 --- a/demos/qt3d/pageflip/gradient.png +++ /dev/null diff --git a/demos/qt3d/pageflip/icon-l-qt3d.png b/demos/qt3d/pageflip/icon-l-qt3d.png Binary files differdeleted file mode 100644 index 07cc4092..00000000 --- a/demos/qt3d/pageflip/icon-l-qt3d.png +++ /dev/null diff --git a/demos/qt3d/pageflip/m5-pageflip.desktop b/demos/qt3d/pageflip/m5-pageflip.desktop deleted file mode 100644 index 772a3f62..00000000 --- a/demos/qt3d/pageflip/m5-pageflip.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Name=Pageflip -Comment=Qt3D example application -Exec=/usr/bin/pageflip -fullscreen -Icon=icon-l-qt3d -Terminal=false -Type=Application -Categories=Development; -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable -X-Text-Domain=qt3d - diff --git a/demos/qt3d/pageflip/pageflip.cpp b/demos/qt3d/pageflip/pageflip.cpp deleted file mode 100644 index 39f42aed..00000000 --- a/demos/qt3d/pageflip/pageflip.cpp +++ /dev/null @@ -1,475 +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 <QApplication> -#include <QTimer> -#include <QMouseEvent> -#include <QWindow> -#include "qglpainter.h" -#include "qglabstracteffect.h" -#include "qgltexture2d.h" -#include "qglshaderprogrameffect.h" -#include <QtGui/QOpenGLContext> -#include <QtOpenGL/qglshaderprogram.h> -#include "pageflipmath_p.h" - -class PageFlipGradientEffect; - -class PageFlipView : public QWindow -{ - Q_OBJECT -public: - PageFlipView(QWindow *parent = 0); - ~PageFlipView(); - - void setBlend(bool value) { blend = value; } - void setVertical(bool value) { vertical = value; } - -public Q_SLOTS: - void update(); - -protected: - void resizeGL(int width, int height); - void initializeGL(); - void paintGL(); - - void exposeEvent(QExposeEvent *e); - void mousePressEvent(QMouseEvent *e); - -private slots: - void animate(); - -private: - void ensureContext(); - void setAlphaValue(QGLPainter *painter, GLfloat value); - - bool blend; - bool vertical; - - qreal posn; // Position within the animation - 0...1 - QSize pageSize; // Size of a page within the window. - - QRect pageRect1; - QRect pageRect2; - - QColor colors[4]; - int colorIndex; - - QGLTexture2D textures[4]; - - QGLTexture2D gradientTexture; - - PageFlipMath pageFlipMath; - - PageFlipGradientEffect *effect; - - QOpenGLContext *context; - bool initialised; - QSurfaceFormat format; - bool updateQueued; -}; - -class PageFlipGradientEffect : public QGLShaderProgramEffect -{ -public: - PageFlipGradientEffect(); - ~PageFlipGradientEffect(); - - void setAlphaValue(GLfloat value); -}; - -PageFlipView::PageFlipView(QWindow *parent) - : QWindow(parent) - , context(0) - , initialised(false) - , updateQueued(false) -{ - format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); - format.setDepthBufferSize(24); - setSurfaceType(QWindow::OpenGLSurface); - setFormat(format); - - posn = 0.0f; - blend = false; - vertical = false; - - colors[0] = QColor(0, 192, 192, 255); - colors[1] = QColor(192, 0, 0, 255); - colors[2] = QColor(192, 192, 0, 255); - colors[3] = QColor(128, 128, 0, 255); - colorIndex = 0; - - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(animate())); - timer->start(40); - - effect = new PageFlipGradientEffect(); -} - -PageFlipView::~PageFlipView() -{ - delete effect; -} - -void PageFlipView::exposeEvent(QExposeEvent *e) -{ - Q_UNUSED(e); - - updateQueued = false; - ensureContext(); - - QRect rect = geometry(); - resizeGL(rect.width(), rect.height()); - - if (!initialised) - initializeGL(); - - paintGL(); - - if (format.swapBehavior() == QSurfaceFormat::DoubleBuffer) - context->swapBuffers(this); -} - -void PageFlipView::resizeGL(int width, int height) -{ - glViewport(0, 0, width, height); -} - -void PageFlipView::initializeGL() -{ - QGLPainter painter(this); - - //QSize size = rect().size(); - //int width = size.width() / 3; - //int height = (int)(width * 1.414f); - int width = 227; - int height = 320; - pageSize = QSize(width, height); - - textures[0].setImage(QImage(QLatin1String(":/qqpage1.png"))); - textures[1].setImage(QImage(QLatin1String(":/qqpage2.png"))); - textures[2].setImage(QImage(QLatin1String(":/qqpage3.png"))); - textures[3].setImage(QImage(QLatin1String(":/qqpage4.png"))); - - gradientTexture.setImage(QImage(QLatin1String(":/gradient.png"))); - - 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); - - glEnable(GL_BLEND); - - if (vertical) - pageFlipMath.setStartCorner(PageFlipMath::VerticalBottomRight); - else - pageFlipMath.setStartCorner(PageFlipMath::BottomRight); - - initialised = true; -} - -void PageFlipView::paintGL() -{ - QGLPainter painter(this); - - QRect rect = this->geometry(); - int midx = rect.width() / 2; - int topy = (rect.height() - pageSize.height()) / 2; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - QMatrix4x4 projm; - projm.ortho(rect); - painter.projectionMatrix() = projm; - painter.modelViewMatrix().setToIdentity(); - - if (vertical) { - pageRect2 = QRect(QPoint(midx - pageSize.width() / 2, topy), pageSize); - pageRect1 = QRect(QPoint(pageRect2.x() - pageSize.width(), topy), pageSize); - } else { - pageRect1 = QRect(QPoint(midx - pageSize.width(), topy), pageSize); - pageRect2 = QRect(QPoint(midx, topy), pageSize); - } - pageFlipMath.setPageRect(pageRect2); - pageFlipMath.setShowPageReverse(false); - pageFlipMath.compute(posn); - - QGLAttributeValue positions - (2, GL_FLOAT, pageFlipMath.stride(), pageFlipMath.vertexArray()); - QGLAttributeValue texCoords - (2, GL_FLOAT, pageFlipMath.stride(), pageFlipMath.vertexArray() + 2); - QGLAttributeValue gradientCoords - (1, GL_FLOAT, pageFlipMath.stride(), pageFlipMath.vertexArray() + 4); - - if (painter.isFixedFunction()) - painter.setStandardEffect(QGL::FlatReplaceTexture2D); - else - painter.setUserEffect(effect); - painter.setColor(colors[colorIndex]); - painter.glActiveTexture(GL_TEXTURE0); - textures[colorIndex].bind(); - if (!painter.isFixedFunction()) { - painter.glActiveTexture(GL_TEXTURE1); - gradientTexture.bind(); - } - painter.clearAttributes(); - painter.setVertexAttribute(QGL::Position, positions); - painter.setVertexAttribute(QGL::TextureCoord0, texCoords); - painter.setVertexAttribute(QGL::CustomVertex0, gradientCoords); - setAlphaValue(&painter, 1.0f); - painter.update(); - pageFlipMath.drawPage(0); - - painter.setColor(colors[(colorIndex + 1) % 4]); - painter.glActiveTexture(GL_TEXTURE0); - textures[(colorIndex + 1) % 4].bind(); - setAlphaValue(&painter, 1.0f); - painter.update(); - pageFlipMath.drawPage(1); - - painter.setColor(colors[(colorIndex + 2) % 4]); - if (!pageFlipMath.showPageReverse()) - textures[(colorIndex + 2) % 4].bind(); - if (blend) - setAlphaValue(&painter, 0.75f); - else - setAlphaValue(&painter, 1.0f); - painter.update(); - pageFlipMath.drawPage(2); - - painter.setColor(colors[(colorIndex + 3) % 4]); - textures[(colorIndex + 3) % 4].bind(); - setAlphaValue(&painter, 1.0f); - painter.update(); - pageFlipMath.drawPage(3); - - glBindTexture(GL_TEXTURE_2D, 0); - painter.glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, 0); - - painter.setStandardEffect(QGL::FlatColor); - painter.clearAttributes(); - painter.setVertexAttribute(QGL::Position, positions); - painter.setVertexAttribute(QGL::TextureCoord0, texCoords); - painter.setVertexAttribute(QGL::CustomVertex0, gradientCoords); - painter.setColor(QColor(0, 0, 0, 255)); - painter.update(); - pageFlipMath.drawOutline(2); -} - -void PageFlipView::mousePressEvent(QMouseEvent *e) -{ - int x = e->x(); - int y = e->y(); - bool changed = true; - if (vertical) { - if (x >= pageRect2.x() && x < (pageRect2.x() + 20) && - y >= pageRect2.y() && y < (pageRect2.y() + 20)) - pageFlipMath.setStartCorner(PageFlipMath::VerticalTopLeft); - else if (x >= pageRect2.x() && x < (pageRect2.x() + 20) && - y >= (pageRect2.bottom() - 20) && y <= pageRect2.bottom()) - pageFlipMath.setStartCorner(PageFlipMath::VerticalBottomLeft); - else if (x >= (pageRect2.right() - 20) && x <= pageRect2.right() && - y >= pageRect2.y() && y < (pageRect2.y() + 20)) - pageFlipMath.setStartCorner(PageFlipMath::VerticalTopRight); - else if (x >= (pageRect2.right() - 20) && x <= pageRect2.right() && - y >= (pageRect2.bottom() - 20) && y <= pageRect2.bottom()) - pageFlipMath.setStartCorner(PageFlipMath::VerticalBottomRight); - else - changed = false; - } else { - if (x >= pageRect1.x() && x < (pageRect1.x() + 20) && - y >= pageRect1.y() && y < (pageRect1.y() + 20)) - pageFlipMath.setStartCorner(PageFlipMath::TopLeft); - else if (x >= pageRect1.x() && x < (pageRect1.x() + 20) && - y >= (pageRect1.bottom() - 20) && y <= pageRect1.bottom()) - pageFlipMath.setStartCorner(PageFlipMath::BottomLeft); - else if (x >= pageRect2.x() && x < (pageRect2.x() + 20) && - y >= pageRect2.y() && y < (pageRect2.y() + 20)) - pageFlipMath.setStartCorner(PageFlipMath::TopLeftOnePage); - else if (x >= pageRect2.x() && x < (pageRect2.x() + 20) && - y >= (pageRect2.bottom() - 20) && y <= pageRect2.bottom()) - pageFlipMath.setStartCorner(PageFlipMath::BottomLeftOnePage); - else if (x >= (pageRect2.right() - 20) && x <= pageRect2.right() && - y >= pageRect2.y() && y < (pageRect2.y() + 20)) - pageFlipMath.setStartCorner(PageFlipMath::TopRight); - else if (x >= (pageRect2.right() - 20) && x <= pageRect2.right() && - y >= (pageRect2.bottom() - 20) && y <= pageRect2.bottom()) - pageFlipMath.setStartCorner(PageFlipMath::BottomRight); - else - changed = false; - } - if (changed) - posn = 0.0f; - QWindow::mousePressEvent(e); -} - -void PageFlipView::animate() -{ - posn += 0.04f; - if (posn >= 1.0f) { - posn = 0.0f; - colorIndex = (colorIndex + 2) % 4; - } - update(); -} - -void PageFlipView::update() -{ - if (!updateQueued) - { - updateQueued = true; - QApplication::postEvent(this, new QExposeEvent(geometry())); - } -} - -void PageFlipView::setAlphaValue(QGLPainter *painter, GLfloat value) -{ - if (!painter->isFixedFunction()) - effect->setAlphaValue(value); -} - -static char const gradientVertexShader[] = - "attribute highp vec4 qt_Vertex;\n" - "attribute highp vec4 qt_MultiTexCoord0;\n" - "attribute highp float qt_Custom0;\n" - "uniform mediump mat4 qt_ModelViewProjectionMatrix;\n" - "varying highp vec4 qt_TexCoord0;\n" - "varying highp float qGradCtrl;\n" - "void main(void)\n" - "{\n" - " gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;\n" - " qt_TexCoord0 = qt_MultiTexCoord0;\n" - " qGradCtrl = qt_Custom0;\n" - "}\n"; - -static char const gradientFragmentShader[] = - "uniform sampler2D qt_Texture0;\n" - "uniform sampler2D qt_Texture1;\n" - "uniform mediump float alphaValue;\n" - "varying highp vec4 qt_TexCoord0;\n" - "varying highp float qGradCtrl;\n" - "void main(void)\n" - "{\n" - " mediump vec4 col = texture2D(qt_Texture0, qt_TexCoord0.st);\n" - " mediump vec4 gradcol = texture2D(qt_Texture1, vec2(qGradCtrl, qt_TexCoord0.t));\n" - " gl_FragColor = vec4((col * gradcol).xyz, alphaValue);\n" - "}\n"; - -PageFlipGradientEffect::PageFlipGradientEffect() -{ - setVertexShader(gradientVertexShader); - setFragmentShader(gradientFragmentShader); -} - -PageFlipGradientEffect::~PageFlipGradientEffect() -{ -} - -void PageFlipGradientEffect::setAlphaValue(GLfloat value) -{ - program()->setUniformValue("alphaValue", value); -} - -inline void PageFlipView::ensureContext() -{ - if (!context) - { - context = new QOpenGLContext(); - context->setFormat(format); -#ifndef QT_NO_DEBUG_STREAM - QSurfaceFormat oldFormat = format; -#endif - context->create(); - // TODO: is it possible that the platform will downgrade the actual - // format, or will it just fail if it can't deliver the actual format - format = context->format(); -#ifndef QT_NO_DEBUG_STREAM - if (oldFormat != format) - qWarning() << "Could not create context requested:\n" - << oldFormat << "\nactual format:\n" << format; -#endif - } - context->makeCurrent(this); -} - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - PageFlipView view; - - QStringList args = QCoreApplication::arguments(); - if (args.contains(QLatin1String("-blend"))) - view.setBlend(true); - if (args.contains(QLatin1String("-vertical"))) - view.setVertical(true); - - int w_pos = args.indexOf("-width"); - int h_pos = args.indexOf("-height"); - if (w_pos >= 0 && h_pos >= 0) - { - bool ok = true; - int w = args.at(w_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse width argument:" << args; - return 1; - } - int h = args.at(h_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse height argument:" << args; - return 1; - } - view.resize(w, h); - } - else - { - view.resize(800, 600); - } - view.show(); - - return app.exec(); -} - -#include "pageflip.moc" diff --git a/demos/qt3d/pageflip/pageflip.desktop b/demos/qt3d/pageflip/pageflip.desktop deleted file mode 100644 index 5b75c596..00000000 --- a/demos/qt3d/pageflip/pageflip.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Pageflip -Icon=icon-l-qt3d -Exec=/usr/bin/pageflip -fullscreen -OnlyShowIn=X-MeeGo; -X-MeeGo-Logical-Id=qtn_comm_appname_pageflip -X-MeeGo-Translation-Catalog=essentials diff --git a/demos/qt3d/pageflip/pageflip.pro b/demos/qt3d/pageflip/pageflip.pro deleted file mode 100644 index 9a49941d..00000000 --- a/demos/qt3d/pageflip/pageflip.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app -TARGET = pageflip -CONFIG += qt warn_on -QT += widgets qt3d - -SOURCES = pageflip.cpp pageflipmath.cpp -HEADERS = pageflipmath_p.h -RESOURCES = pageflip.qrc - -CONFIG += qt3d_deploy_pkg -include(../../../pkg.pri) - -OTHER_FILES += \ - pageflip.rc - -RC_FILE = pageflip.rc diff --git a/demos/qt3d/pageflip/pageflip.qrc b/demos/qt3d/pageflip/pageflip.qrc deleted file mode 100644 index 1584add5..00000000 --- a/demos/qt3d/pageflip/pageflip.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>qqpage1.png</file> - <file>qqpage2.png</file> - <file>qqpage3.png</file> - <file>qqpage4.png</file> - <file>gradient.png</file> -</qresource> -</RCC> diff --git a/demos/qt3d/pageflip/pageflip.rc b/demos/qt3d/pageflip/pageflip.rc deleted file mode 100644 index b40ecdc1..00000000 --- a/demos/qt3d/pageflip/pageflip.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "qt3d.ico" diff --git a/demos/qt3d/pageflip/pageflipmath.cpp b/demos/qt3d/pageflip/pageflipmath.cpp deleted file mode 100644 index afb66dbc..00000000 --- a/demos/qt3d/pageflip/pageflipmath.cpp +++ /dev/null @@ -1,592 +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 "pageflipmath_p.h" -#include <QtCore/qmath.h> - -QT_BEGIN_NAMESPACE - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -PageFlipMath::PageFlipMath() -{ - m_showPageReverse = false; - m_startCorner = BottomRight; - - qMemSet(vertices, 0, sizeof(vertices)); - qMemSet(pageCount, 0, sizeof(pageCount)); -} - -PageFlipMath::~PageFlipMath() -{ -} - -void PageFlipMath::drawPage(int page) const -{ - if (page < 0 || page >= 4 || pageCount[page] == 0) - return; - glDrawArrays(GL_TRIANGLE_FAN, page * 5, pageCount[page]); -} - -void PageFlipMath::drawOutline(int page) const -{ - if (page < 0 || page >= 4 || pageCount[page] == 0) - return; - glDrawArrays(GL_LINE_LOOP, page * 5, pageCount[page]); -} - -void PageFlipMath::compute(qreal t) -{ - int page, vertex; - - // Compute the relative vertices for position t. - if (m_startCorner < VerticalBottomRight) - flip(m_pageRect.width() - 1, m_pageRect.height() - 1, t); - else - flip(m_pageRect.height() - 1, m_pageRect.width() - 1, t); - - // Deal with starting corner issues by swapping co-ordinates. - switch (m_startCorner) { - - case BottomRight: break; - - case TopRight: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - vertices[page][vertex][1] - = m_pageRect.height() - 1 - vertices[page][vertex][1]; - vertices[page][vertex][3] - = 1.0f - vertices[page][vertex][3]; - } - } - break; - - case BottomLeft: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - vertices[page][vertex][0] - = m_pageRect.width() - 1 - vertices[page][vertex][0]; - vertices[page][vertex][0] -= m_pageRect.width(); - vertices[page][vertex][2] - = 1.0f - vertices[page][vertex][2]; - } - } - break; - - case TopLeft: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - vertices[page][vertex][0] - = m_pageRect.width() - 1 - vertices[page][vertex][0]; - vertices[page][vertex][0] -= m_pageRect.width(); - vertices[page][vertex][1] - = m_pageRect.height() - 1 - vertices[page][vertex][1]; - vertices[page][vertex][2] - = 1.0f - vertices[page][vertex][2]; - vertices[page][vertex][3] - = 1.0f - vertices[page][vertex][3]; - } - } - break; - - case BottomLeftOnePage: - for (page = 1; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - vertices[page][vertex][0] - = m_pageRect.width() - 1 - vertices[page][vertex][0]; - vertices[page][vertex][2] - = 1.0f - vertices[page][vertex][2]; - } - } - break; - - case TopLeftOnePage: - for (page = 1; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - vertices[page][vertex][0] - = m_pageRect.width() - 1 - vertices[page][vertex][0]; - vertices[page][vertex][1] - = m_pageRect.height() - 1 - vertices[page][vertex][1]; - vertices[page][vertex][2] - = 1.0f - vertices[page][vertex][2]; - vertices[page][vertex][3] - = 1.0f - vertices[page][vertex][3]; - } - } - break; - - case VerticalBottomRight: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - qSwap(vertices[page][vertex][0], vertices[page][vertex][1]); - vertices[page][vertex][0] - = m_pageRect.width() - 1 - vertices[page][vertex][0]; - vertices[page][vertex][1] - = m_pageRect.height() - 1 - vertices[page][vertex][1]; - qSwap(vertices[page][vertex][2], vertices[page][vertex][3]); - vertices[page][vertex][2] - = 1.0f - vertices[page][vertex][2]; - vertices[page][vertex][3] - = 1.0f - vertices[page][vertex][3]; - } - } - break; - - case VerticalTopRight: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - qSwap(vertices[page][vertex][0], vertices[page][vertex][1]); - vertices[page][vertex][0] - = m_pageRect.width() - 1 - vertices[page][vertex][0]; - qSwap(vertices[page][vertex][2], vertices[page][vertex][3]); - vertices[page][vertex][2] - = 1.0f - vertices[page][vertex][2]; - } - } - break; - - case VerticalBottomLeft: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - qSwap(vertices[page][vertex][0], vertices[page][vertex][1]); - vertices[page][vertex][1] - = m_pageRect.height() - 1 - vertices[page][vertex][1]; - qSwap(vertices[page][vertex][2], vertices[page][vertex][3]); - vertices[page][vertex][3] - = 1.0f - vertices[page][vertex][3]; - } - } - break; - - case VerticalTopLeft: - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - qSwap(vertices[page][vertex][0], vertices[page][vertex][1]); - qSwap(vertices[page][vertex][2], vertices[page][vertex][3]); - } - } - break; - } - - // Adjust the vertices for the final rectangle position. - for (page = 0; page < 4; ++page) { - for (vertex = 0; vertex < pageCount[page]; ++vertex) { - vertices[page][vertex][0] += m_pageRect.x(); - vertices[page][vertex][1] - = m_pageRect.y() + - (m_pageRect.height() - 1 - vertices[page][vertex][1]); - } - } - - // Flip the x texture co-ordinates for page 2 if showing the page reverse. - if (m_showPageReverse) { - if (m_startCorner < VerticalBottomRight) { - for (int vertex = 0; vertex < pageCount[2]; ++vertex) - vertices[2][vertex][2] = 1.0f - vertices[2][vertex][2]; - } else { - for (int vertex = 0; vertex < pageCount[2]; ++vertex) - vertices[2][vertex][3] = 1.0f - vertices[2][vertex][3]; - } - } -} - -// Page 1 is the reference page and extends from the bottom-left -// corner at (0, 0) to the top-right corner at (pageWidth, pageHeight). -// The flip starts at the bottom-right corner and proceeds leftwards -// across the page. All other flip directions and starting corners -// can be derived from this basic reference flip animation. -void PageFlipMath::flip(qreal pageWidth, qreal pageHeight, qreal t) -{ - // Handle the simple start and end position cases first. - if (t <= 0.0f) { - // Starting position: pages 0 and 1 in their rest states - // and pages 2 and 3 not visible. - pageCount[0] = 4; - pageCount[1] = 4; - pageCount[2] = 0; - pageCount[3] = 0; - - vertices[0][0][0] = -pageWidth; // corner 0 at (-pageWidth, 0) - vertices[0][0][1] = 0.0f; - vertices[0][0][2] = 0.0f; // texture co-ordinate - vertices[0][0][3] = 0.0f; - vertices[0][0][4] = 0.0f; // gradient control - - vertices[0][1][0] = 0.0f; // corner 1 at (0, 0) - vertices[0][1][1] = 0.0f; - vertices[0][1][2] = 1.0f; - vertices[0][1][3] = 0.0f; - vertices[0][1][4] = 1.0f; // gradient along fold on the right - - vertices[0][2][0] = 0.0f; // corner 2 at (0, pageHeight) - vertices[0][2][1] = pageHeight; - vertices[0][2][2] = 1.0f; - vertices[0][2][3] = 1.0f; - vertices[0][2][4] = 1.0f; - - vertices[0][3][0] = -pageWidth; // corner 3 at (-pageWidth, pageHeight) - vertices[0][3][1] = pageHeight; - vertices[0][3][2] = 0.0f; - vertices[0][3][3] = 1.0f; - vertices[0][3][4] = 0.0f; - - vertices[1][0][0] = 0.0f; // corner 0 at (0, 0) - vertices[1][0][1] = 0.0f; - vertices[1][0][2] = 0.0f; // texture co-ordinate - vertices[1][0][3] = 0.0f; - vertices[1][0][4] = 1.0f; // gradient along fold on the left - - vertices[1][1][0] = pageWidth; // corner 1 at (pageWidth, 0) - vertices[1][1][1] = 0.0f; - vertices[1][1][2] = 1.0f; - vertices[1][1][3] = 0.0f; - vertices[1][1][4] = 0.0f; - - vertices[1][2][0] = pageWidth; // corner 2 at (pageWidth, pageHeight) - vertices[1][2][1] = pageHeight; - vertices[1][2][2] = 1.0f; - vertices[1][2][3] = 1.0f; - vertices[1][2][4] = 0.0f; - - vertices[1][3][0] = 0.0f; // corner 3 at (0, pageHeight) - vertices[1][3][1] = pageHeight; - vertices[1][3][2] = 0.0f; - vertices[1][3][3] = 1.0f; - vertices[1][3][4] = 1.0f; - return; - } else if (t >= 1.0f) { - // Ending position: pages 0 and 1 are not visible, but - // pages 2 and 3 are visible in the rest states. - pageCount[0] = 0; - pageCount[1] = 0; - pageCount[2] = 4; - pageCount[3] = 4; - - vertices[2][0][0] = -pageWidth; // corner 0 at (-pageWidth, 0) - vertices[2][0][1] = 0.0f; - vertices[2][0][2] = 0.0f; // texture co-ordinate - vertices[2][0][3] = 0.0f; - vertices[2][0][4] = 0.0f; // gradient control - - vertices[2][1][0] = 0.0f; // corner 1 at (0, 0) - vertices[2][1][1] = 0.0f; - vertices[2][1][2] = 1.0f; - vertices[2][1][3] = 0.0f; - vertices[2][1][4] = 1.0f; // gradient along fold on the right - - vertices[2][2][0] = 0.0f; // corner 2 at (0, pageHeight) - vertices[2][2][1] = pageHeight; - vertices[2][2][2] = 1.0f; - vertices[2][2][3] = 1.0f; - vertices[2][2][4] = 1.0f; - - vertices[2][3][0] = -pageWidth; // corner 3 at (-pageWidth, pageHeight) - vertices[2][3][1] = pageHeight; - vertices[2][3][2] = 0.0f; - vertices[2][3][3] = 1.0f; - vertices[2][3][4] = 0.0f; - - vertices[3][0][0] = 0.0f; // corner 0 at (0, 0) - vertices[3][0][1] = 0.0f; - vertices[3][0][2] = 0.0f; // texture co-ordinate - vertices[3][0][3] = 0.0f; - vertices[3][0][4] = 1.0f; // gradient along fold on the left - - vertices[3][1][0] = pageWidth; // corner 1 at (pageWidth, 0) - vertices[3][1][1] = 0.0f; - vertices[3][1][2] = 1.0f; - vertices[3][1][3] = 0.0f; - vertices[3][1][4] = 0.0f; - - vertices[3][2][0] = pageWidth; // corner 2 at (pageWidth, pageHeight) - vertices[3][2][1] = pageHeight; - vertices[3][2][2] = 1.0f; - vertices[3][2][3] = 1.0f; - vertices[3][2][4] = 0.0f; - - vertices[3][3][0] = 0.0f; // corner 3 at (0, pageHeight) - vertices[3][3][1] = pageHeight; - vertices[3][3][2] = 0.0f; - vertices[3][3][3] = 1.0f; - vertices[3][3][4] = 1.0f; - return; - } - - // Page 0 is the same for all other animation positions. - pageCount[0] = 4; - - vertices[0][0][0] = -pageWidth; // corner 0 at (-pageWidth, 0) - vertices[0][0][1] = 0.0f; - vertices[0][0][2] = 0.0f; // texture co-ordinate - vertices[0][0][3] = 0.0f; - vertices[0][0][4] = 0.0f; // gradient control - - vertices[0][1][0] = 0.0f; // corner 1 at (0, 0) - vertices[0][1][1] = 0.0f; - vertices[0][1][2] = 1.0f; - vertices[0][1][3] = 0.0f; - vertices[0][1][4] = 1.0f; // gradient along fold on the right - - vertices[0][2][0] = 0.0f; // corner 2 at (0, pageHeight) - vertices[0][2][1] = pageHeight; - vertices[0][2][2] = 1.0f; - vertices[0][2][3] = 1.0f; - vertices[0][2][4] = 1.0f; - - vertices[0][3][0] = -pageWidth; // corner 3 at (-pageWidth, pageHeight) - vertices[0][3][1] = pageHeight; - vertices[0][3][2] = 0.0f; - vertices[0][3][3] = 1.0f; - vertices[0][3][4] = 0.0f; - - // Get the angle of the "curling" dividing line to the bottom of the page. - // Basically: 45deg + (45deg * t) = 45deg * (1 + t), where t is between - // 0 and 1 but is neither 0 nor 1. - qreal angle = (M_PI / 4.0f) * (1.0f + t); - - // We need the cos and sin of both the angle and angle * 2. - qreal cosAngle = qCos(angle); - qreal sinAngle = qSin(angle); - qreal cosAngle2 = qCos(angle * 2.0f); - qreal sinAngle2 = qSin(angle * 2.0f); - - // Find the reference point. This is the point along the bottom of - // the page where the dividing line intersects the page bottom. - qreal refx = pageWidth * (1.0f - t); - qreal refy = 0.0f; - - // Distance from the reference point to the right side of the page. - qreal d = pageWidth - refx; - - // Determine the intersection of the dividing line with the - // top of the page. If the intersection is not on the page (k >= d), - // then we need to generate similar triangles. If the intersection is - // on the page (k < d), then we need to generate similar trapezoids. - qreal k = (pageHeight * cosAngle) / sinAngle; - if (k >= d) { - // Generate similar triangles. Find the intersection with - // the right-hand side of the page at x == pageWidth. - qreal intx = pageWidth; - qreal inty = refy + (d * sinAngle) / cosAngle; - - // Find the opposite triangle corner on the back page. - qreal oppx = refx + d * cosAngle2; - qreal oppy = refy + d * sinAngle2; - - // Generate vertices and texture co-ordinates for the back page. - qreal texa = 1.0f - (d * sinAngle) / (pageHeight * cosAngle); - qreal texb = d / pageWidth; - vertices[2][0][0] = intx; - vertices[2][0][1] = inty; - vertices[2][0][2] = 0.0f; - vertices[2][0][3] = 1.0f - texa; - vertices[2][0][4] = 1.0f; - - vertices[2][1][0] = oppx; - vertices[2][1][1] = oppy; - vertices[2][1][2] = 0.0f; - vertices[2][1][3] = 0.0f; - vertices[2][1][4] = 1.0f - texb; - - vertices[2][2][0] = refx; - vertices[2][2][1] = refy; - vertices[2][2][2] = texb; - vertices[2][2][3] = 0.0f; - vertices[2][2][4] = 1.0f; - - pageCount[2] = 3; - - // Generate vertices and texture co-ordinates for the next page. - vertices[3][0][0] = intx; - vertices[3][0][1] = inty; - vertices[3][0][2] = 1.0f; - vertices[3][0][3] = 1.0f - texa; - vertices[3][0][4] = 1.0f; - - vertices[3][1][0] = refx; - vertices[3][1][1] = refy; - vertices[3][1][2] = 1.0f - texb; - vertices[3][1][3] = 0.0f; - vertices[3][1][4] = 1.0f; - - vertices[3][2][0] = pageWidth; - vertices[3][2][1] = 0.0f; - vertices[3][2][2] = 1.0f; - vertices[3][2][3] = 0.0f; - vertices[3][2][4] = 1.0f - texb; - - pageCount[3] = 3; - - // Set page 1's vertices to clip off pixels we don't need to draw. - vertices[1][0][0] = 0.0f; - vertices[1][0][1] = 0.0f; - vertices[1][0][2] = 0.0f; - vertices[1][0][3] = 0.0f; - vertices[1][0][4] = 1.0f; - - vertices[1][1][0] = pageWidth - d; - vertices[1][1][1] = 0.0f; - vertices[1][1][2] = 1.0f - texb; - vertices[1][1][3] = 0.0f; - vertices[1][1][4] = texb; - - vertices[1][2][0] = intx; - vertices[1][2][1] = inty; - vertices[1][2][2] = 1.0f; - vertices[1][2][3] = 1.0f - texa; - vertices[1][2][4] = 0.0f; - - vertices[1][3][0] = pageWidth; - vertices[1][3][1] = pageHeight; - vertices[1][3][2] = 1.0f; - vertices[1][3][3] = 1.0f; - vertices[1][3][4] = 0.0f; - - vertices[1][4][0] = 0.0f; - vertices[1][4][1] = pageHeight; - vertices[1][4][2] = 0.0f; - vertices[1][4][3] = 1.0f; - vertices[1][4][4] = 1.0f; - - pageCount[1] = 5; - } else { - // Generate similar trapezoids. Find the intersection with - // the top of the page at y == pageHeight. - qreal intx = refx + (pageHeight * cosAngle) / sinAngle; - qreal inty = pageHeight; - - // Get the distance between the intersection and the right of the page. - qreal e = pageWidth - intx; - - // Find the opposite trapezoid corners to "ref" and "int". - qreal opprefx = refx + d * cosAngle2; - qreal opprefy = refy + d * sinAngle2; - qreal oppintx = intx + e * cosAngle2; - qreal oppinty = inty + e * sinAngle2; - - // Generate vertices and texture co-ordinates for the back page. - qreal texa = e / pageWidth; - qreal texb = d / pageWidth; - vertices[2][0][0] = intx; - vertices[2][0][1] = inty; - vertices[2][0][2] = texa; - vertices[2][0][3] = 1.0f; - vertices[2][0][4] = 1.0f; - - vertices[2][1][0] = oppintx; - vertices[2][1][1] = oppinty; - vertices[2][1][2] = 0.0f; - vertices[2][1][3] = 1.0f; - vertices[2][1][4] = 1.0f - texa; - - vertices[2][2][0] = opprefx; - vertices[2][2][1] = opprefy; - vertices[2][2][2] = 0.0f; - vertices[2][2][3] = 0.0f; - vertices[2][2][4] = 1.0f - texb; - - vertices[2][3][0] = refx; - vertices[2][3][1] = refy; - vertices[2][3][2] = texb; - vertices[2][3][3] = 0.0f; - vertices[2][3][4] = 1.0f; - - pageCount[2] = 4; - - // Generate vertices and texture co-ordinates for the next page. - vertices[3][0][0] = intx; - vertices[3][0][1] = inty; - vertices[3][0][2] = 1.0f - texa; - vertices[3][0][3] = 1.0f; - vertices[3][0][4] = 1.0f; - - vertices[3][1][0] = refx; - vertices[3][1][1] = refy; - vertices[3][1][2] = 1.0f - texb; - vertices[3][1][3] = 0.0f; - vertices[3][1][4] = 1.0f; - - vertices[3][2][0] = pageWidth; - vertices[3][2][1] = 0.0f; - vertices[3][2][2] = 1.0f; - vertices[3][2][3] = 0.0f; - vertices[3][2][4] = 1.0f - texb; - - vertices[3][3][0] = pageWidth; - vertices[3][3][1] = pageHeight; - vertices[3][3][2] = 1.0f; - vertices[3][3][3] = 1.0f; - vertices[3][3][4] = 1.0f - texa; - - pageCount[3] = 4; - - // Set page 1's vertices to clip off pixels we don't need to draw. - vertices[1][0][0] = 0.0f; - vertices[1][0][1] = 0.0f; - vertices[1][0][2] = 0.0f; - vertices[1][0][3] = 0.0f; - vertices[1][0][4] = 1.0f; - - vertices[1][1][0] = pageWidth - d; - vertices[1][1][1] = 0.0f; - vertices[1][1][2] = 1.0f - texb; - vertices[1][1][3] = 0.0f; - vertices[1][1][4] = texb; - - vertices[1][2][0] = pageWidth - e; - vertices[1][2][1] = pageHeight; - vertices[1][2][2] = 1.0f - texa; - vertices[1][2][3] = 1.0f; - vertices[1][2][4] = texa; - - vertices[1][3][0] = 0.0f; - vertices[1][3][1] = pageHeight; - vertices[1][3][2] = 0.0f; - vertices[1][3][3] = 1.0f; - vertices[1][3][4] = 1.0f; - - pageCount[1] = 4; - } -} - -QT_END_NAMESPACE diff --git a/demos/qt3d/pageflip/pageflipmath_p.h b/demos/qt3d/pageflip/pageflipmath_p.h deleted file mode 100644 index 21280b05..00000000 --- a/demos/qt3d/pageflip/pageflipmath_p.h +++ /dev/null @@ -1,120 +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 PAGEFLIPMATH_P_H -#define PAGEFLIPMATH_P_H - -#include <QtOpenGL/qgl.h> - -QT_BEGIN_NAMESPACE - -class PageFlipMath -{ -public: - PageFlipMath(); - ~PageFlipMath(); - - enum StartCorner - { - BottomRight, - TopRight, - BottomLeft, - TopLeft, - BottomLeftOnePage, - TopLeftOnePage, - VerticalBottomRight, - VerticalTopRight, - VerticalBottomLeft, - VerticalTopLeft - }; - - // Corner to start flipping from. - StartCorner startCorner() const { return m_startCorner; } - void setStartCorner(StartCorner value) { m_startCorner = value; } - - // Rectangle to display the main page (usually the one on the right). - QRect pageRect() const { return m_pageRect; } - void setPageRect(const QRect& rect) { m_pageRect = rect; } - - // Show the reverse of the right-hand page on the back when - // flipping pages. That is, the user will essentially see - // the texture on the front of the page "through" it in reverse - // while it is being flipped. - bool showPageReverse() const { return m_showPageReverse; } - void setShowPageReverse(bool value) { m_showPageReverse = value; } - - // Get the vertex array pointer. - const GLfloat *vertexArray() const { return vertices[0][0]; } - - // Get the vertex array stride in bytes. - int stride() const { return 5 * sizeof(GLfloat); } - - // Draw a specific page. - void drawPage(int page) const; - - // Draw the outline of a page as a set of lines. - void drawOutline(int page) const; - - // Compute the frame at position t (0...1) in the animation. - void compute(qreal t); - -private: - StartCorner m_startCorner; - QRect m_pageRect; - bool m_showPageReverse; - - // Vertex array: up to 4 pages, with up to 5 vertices per page, - // and 5 components (2D position, 2D texcoord, 1D gradient control) - // per vertex. The gradient control value is interpolated between - // 0 and 1 - it is 1 at the fold point and 0 on the side of the page - // opposite the fold point. Shaders can use this to extract a color - // value from a gradient texture to blend with the page texture. - GLfloat vertices[4][5][5]; - - // Number of vertices for drawing the triangle fan for each page. - int pageCount[4]; - - void flip(qreal pageWidth, qreal pageHeight, qreal t); -}; - -QT_END_NAMESPACE - -#endif diff --git a/demos/qt3d/pageflip/qqpage1.png b/demos/qt3d/pageflip/qqpage1.png Binary files differdeleted file mode 100644 index 8abf37d9..00000000 --- a/demos/qt3d/pageflip/qqpage1.png +++ /dev/null diff --git a/demos/qt3d/pageflip/qqpage2.png b/demos/qt3d/pageflip/qqpage2.png Binary files differdeleted file mode 100644 index afd1b047..00000000 --- a/demos/qt3d/pageflip/qqpage2.png +++ /dev/null diff --git a/demos/qt3d/pageflip/qqpage3.png b/demos/qt3d/pageflip/qqpage3.png Binary files differdeleted file mode 100644 index fa2a85a0..00000000 --- a/demos/qt3d/pageflip/qqpage3.png +++ /dev/null diff --git a/demos/qt3d/pageflip/qqpage4.png b/demos/qt3d/pageflip/qqpage4.png Binary files differdeleted file mode 100644 index 0a6ba7b0..00000000 --- a/demos/qt3d/pageflip/qqpage4.png +++ /dev/null diff --git a/demos/qt3d/pageflip/qt3d.ico b/demos/qt3d/pageflip/qt3d.ico Binary files differdeleted file mode 100644 index 1d07c43d..00000000 --- a/demos/qt3d/pageflip/qt3d.ico +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/buttons.cpp b/demos/qt3d/photobrowser3d/buttons.cpp deleted file mode 100644 index 16373e65..00000000 --- a/demos/qt3d/photobrowser3d/buttons.cpp +++ /dev/null @@ -1,134 +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 "buttons.h" -#include "qglpainter.h" - -Buttons::Buttons(QObject *parent, QGLMaterialCollection *palette) - : QGLSceneNode(parent) -{ - setObjectName("Buttons"); - setPalette(palette); - setOption(QGLSceneNode::CullBoundingBox, false); - - m_left = new QGLSceneNode(this); - m_left->setObjectName("Left Button"); - m_right = new QGLSceneNode(this); - m_right->setObjectName("Right Button"); - - QGLMaterial *mat = new QGLMaterial; - QImage im(":/controls/arrows-left.png"); - m_size = im.size(); - QGLTexture2D *tex = new QGLTexture2D(mat); - tex->setImage(im); - mat->setTexture(tex); - - setMaterial(mat); - setEffect(QGL::FlatReplaceTexture2D); - - QGeometryData data; - QSize f = im.size() / 2; - QVector2D a(-f.width(), -f.height()); - QVector2D b(f.width(), -f.height()); - QVector2D c(f.width(), f.height()); - QVector2D d(-f.width(), f.height()); - QVector2D ta(0, 1); - QVector2D tb(1, 1); - QVector2D tc(1, 0); - QVector2D td(0, 0); - data.appendVertex(a, b, c, d); - data.appendTexCoord(ta, tb, tc, td); - data.appendIndices(0, 1, 2); - data.appendIndices(0, 2, 3); - - // the right hand arrow geometry is same as above, flipped X <-> -X - data.appendGeometry(data); - data.texCoord(4).setX(1); - data.texCoord(5).setX(0); - data.texCoord(6).setX(0); - data.texCoord(7).setX(1); - data.appendIndices(4, 5, 6); - data.appendIndices(4, 6, 7); - - m_left->setGeometry(data); - m_left->setCount(6); - m_left->setOption(QGLSceneNode::CullBoundingBox, false); - - m_right->setGeometry(data); - m_right->setStart(6); - m_right->setCount(6); - m_left->setOption(QGLSceneNode::CullBoundingBox, false); -} - -void Buttons::draw(QGLPainter *painter) -{ - painter->projectionMatrix().push(); - painter->modelViewMatrix().push(); - - QRect rect = painter->currentSurface()->viewportRect(); - QMatrix4x4 projm; - projm.ortho(rect); - painter->projectionMatrix() = projm; - painter->modelViewMatrix().setToIdentity(); - - if (m_left->position().isNull()) - { - QVector2D pos(m_size.width() / 2, rect.height() - m_size.height() / 2); - m_left->setPosition(pos); - pos.setX(rect.width() - (m_size.width() / 2)); - m_right->setPosition(pos); - } - - glDisable(GL_DEPTH_TEST); - - QGLSceneNode::draw(painter); - - glEnable(GL_DEPTH_TEST); - - painter->projectionMatrix().pop(); - painter->modelViewMatrix().pop(); -} - -void Buttons::clearPositions() -{ - m_left->setPosition(QVector3D()); - m_right->setPosition(QVector3D()); -} diff --git a/demos/qt3d/photobrowser3d/buttons.h b/demos/qt3d/photobrowser3d/buttons.h deleted file mode 100644 index 1d0155c2..00000000 --- a/demos/qt3d/photobrowser3d/buttons.h +++ /dev/null @@ -1,62 +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 BUTTONS_H -#define BUTTONS_H - -#include "qglscenenode.h" - -#include <Qt> - -class Buttons : public QGLSceneNode -{ - Q_OBJECT -public: - explicit Buttons(QObject *parent, QGLMaterialCollection *palette); - void draw(QGLPainter *painter); - void clearPositions(); -private: - QGLSceneNode *m_left; - QGLSceneNode *m_right; - QSize m_size; -}; - -#endif // BUTTONS_H diff --git a/demos/qt3d/photobrowser3d/bytereader.cpp b/demos/qt3d/photobrowser3d/bytereader.cpp deleted file mode 100644 index 13511868..00000000 --- a/demos/qt3d/photobrowser3d/bytereader.cpp +++ /dev/null @@ -1,156 +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 "bytereader.h" -#include "thumbnailableimage.h" - -#include <QByteArray> -#include <QThread> -#include <QImage> -#include <QImageReader> -#include <QUrl> -#include <QFile> -#include <QCoreApplication> - -ByteReader::ByteReader() - : m_stop(0), m_loading(0) -{ } - -void ByteReader::loadFile(const ThumbnailableImage &image) -{ - if (!m_stop.load()) - { - m_loading.ref(); - - // FIXME: actually handle remote files - QUrl url = image.url(); - QString fn = url.toLocalFile(); - int pos = fn.lastIndexOf('.'); - QString ext; - if (pos != -1) - ext = fn.mid(pos).toUpper(); - if (ext.isEmpty() || - !QImageReader::supportedImageFormats().contains(ext.toLocal8Bit())) - ext = QString(); - QImage im; - QFile f(fn); - QString errorMessage; - if (f.open(QIODevice::ReadOnly)) - { - QByteArray bytes; - while (!f.atEnd() & !m_stop.load()) - { - bytes.append(f.read(1024)); - QCoreApplication::processEvents(); - } - im = ext.isEmpty() ? QImage::fromData(bytes) - : QImage::fromData(bytes, qPrintable(ext)); - } - else - { - errorMessage = tr("Could not read: %1").arg(url.toString()); - } - - QCoreApplication::processEvents(); - if (!m_stop.load()) - { - if (im.isNull()) - { - im = QImage(QSize(128, 128), QImage::Format_ARGB32); - im.fill(qRgba(0, 30, 50, 64)); - QPainter ptr; - ptr.begin(&im); - ptr.setBackgroundMode(Qt::TransparentMode); - if (errorMessage.isEmpty()) - errorMessage = tr("Could not load: %1").arg(url.toString()); - ptr.setPen(QColor("orange")); - ptr.drawText(im.rect(), Qt::AlignCenter, errorMessage); - ptr.end(); - } - else - { - // TODO: Fix size limit - // This arbitrary size limit is really a debugging/development thing - // In a real program once you had loaded the full image, the photo- - // viewer would allow zooming and panning all around in the image - // so loading a 2896 pixel × 1944 pixel photo would make sense even - // on a small screen. For now work with fairly cruddy image quality. - // Probably the fix is to have a separate load call that re-fetches - // the full image on a zoom - QSize workSize(1024, 768); - Qt::TransformationMode mode = Qt::SmoothTransformation; - if (QThread::idealThreadCount() < 2) - { - workSize = workSize / 2; - mode = Qt::FastTransformation; - } - if (im.size().width() > workSize.width() || im.size().height() > workSize.height()) - im = im.scaled(workSize, Qt::KeepAspectRatio, mode); - } - - Q_ASSERT(!im.isNull()); - ThumbnailableImage result(image); - result.setData(im); - - // it would be nice to incur the cost of setThumbnailed() on the image - // at this point - in the background thread. Trouble is the atlas is - // constantly being accessed by the draw loop and to do anything about - // that would mean locking the GUI thread... - - Q_ASSERT(!result.isNull()); - - emit imageLoaded(result); - } - - m_loading.deref(); - } - - if (m_stop.load()) - emit stopped(); - -} - -void ByteReader::stop() -{ - m_stop.ref(); - if (!m_loading.load()) - emit stopped(); -} diff --git a/demos/qt3d/photobrowser3d/bytereader.h b/demos/qt3d/photobrowser3d/bytereader.h deleted file mode 100644 index c790b823..00000000 --- a/demos/qt3d/photobrowser3d/bytereader.h +++ /dev/null @@ -1,69 +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 BYTEREADER_H -#define BYTEREADER_H - -#include <QObject> - -QT_BEGIN_NAMESPACE -class QUrl; -QT_END_NAMESPACE - -class ThumbnailableImage; - -class ByteReader : public QObject -{ - Q_OBJECT -public: - ByteReader(); -signals: - void imageLoaded(const ThumbnailableImage &image); - void stopped(); -public slots: - void loadFile(const ThumbnailableImage &url); - void stop(); -private: - QAtomicInt m_stop; - QAtomicInt m_loading; -}; - -#endif // BYTEREADER_H diff --git a/demos/qt3d/photobrowser3d/filescanner.cpp b/demos/qt3d/photobrowser3d/filescanner.cpp deleted file mode 100644 index 86785dc9..00000000 --- a/demos/qt3d/photobrowser3d/filescanner.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "filescanner.h" - -#include <QTime> -#include <QFileInfo> -#include <QStringList> -#include <QSet> -#include <QDir> -#include <QCoreApplication> -#include <QImageReader> -#include <QDebug> - -FileScanner::FileScanner(QObject *parent) - : QThread(parent), m_stop(0) -{ } - -FileScanner::~FileScanner() -{ - // nothing to do here -} - -void FileScanner::stop() -{ - m_stop.ref(); -} - -void FileScanner::run() -{ - scan(); -} - -void FileScanner::scan() -{ - QStringList queue; - queue.append(m_url.path()); - QSet<QString> loopProtect; - int count = 0; - while (queue.size() > 0 && !m_stop.load() && count < 300) - { - QString path = queue.takeFirst(); - QFileInfo u(path); - if (u.isSymLink()) - { - path = u.symLinkTarget(); - u = QFileInfo(path); - } - if (u.isDir()) - { - if (!loopProtect.contains(path)) - { - loopProtect.insert(path); - QDir dir(path); - QStringList entries = dir.entryList(); - QStringList::const_iterator it = entries.constBegin(); - for ( ; it != entries.constEnd(); ++it) - { - // ignore hidden files, system directories - if ((*it).startsWith(".")) - continue; - queue.append(dir.absoluteFilePath(*it)); - } - } - } - else - { - if (u.isFile() && u.isReadable()) - { - // small optimization: if the file has a suffix, check if that - // is known as an image format before sending to loader - QString ext = u.suffix().toLower(); - if (ext.isEmpty() || - QImageReader::supportedImageFormats().contains(ext.toLocal8Bit())) - { - QUrl url2; - url2.setScheme("file"); - url2.setPath(u.absoluteFilePath()); - emit imageUrl(url2); - ++count; - } - } - } - QCoreApplication::processEvents(); - QThread::yieldCurrentThread(); - } -} diff --git a/demos/qt3d/photobrowser3d/filescanner.h b/demos/qt3d/photobrowser3d/filescanner.h deleted file mode 100644 index 0431b54b..00000000 --- a/demos/qt3d/photobrowser3d/filescanner.h +++ /dev/null @@ -1,79 +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 FILESCANNER_H -#define FILESCANNER_H - -#include <QThread> -#include <QUrl> -#include <QDebug> - -class FileScanner : public QThread -{ - Q_OBJECT -public: - explicit FileScanner(QObject *parent = 0); - ~FileScanner(); - - // INVARIANT: never get called when the thread is running - void setBaseUrl(const QUrl &url) - { - Q_ASSERT(!isRunning()); - m_url = url; - } - -signals: - void imageUrl(const QUrl &url); - -public slots: - void stop(); - void scan(); - -protected: - void run(); - - QUrl m_url; - QAtomicInt m_stop; -private: - -}; - -#endif // FILESCANNER_H diff --git a/demos/qt3d/photobrowser3d/icon-l-qt3d.png b/demos/qt3d/photobrowser3d/icon-l-qt3d.png Binary files differdeleted file mode 100644 index 07cc4092..00000000 --- a/demos/qt3d/photobrowser3d/icon-l-qt3d.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/imagedisplay.cpp b/demos/qt3d/photobrowser3d/imagedisplay.cpp deleted file mode 100644 index a39cfa02..00000000 --- a/demos/qt3d/photobrowser3d/imagedisplay.cpp +++ /dev/null @@ -1,224 +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 "imagedisplay.h" -#include "thumbnailableimage.h" -#include "thumbnailnode.h" -#include "thumbnaileffect.h" -#include "qglbuilder.h" -#include "qglcube.h" -#include "imagemanager.h" -#include "qatlas.h" -#include "qglshaderprogrameffect.h" -#include "qphotobrowser3dscene.h" -#include "photobrowser3dview.h" - -#include <QApplication> -#include <QChildEvent> -#include <QUrl> -#include <QImage> - -static inline QImage qMakeFrameImage() -{ - QImage frm(QSize(128, 128), QImage::Format_ARGB32); - frm.fill(qRgba(8, 8, 8, 255)); // dark grey frame - QPainter ptr; - ptr.begin(&frm); - QRect r(8, 8, 112, 112); - ptr.setBackgroundMode(Qt::TransparentMode); - ptr.fillRect(r, QColor(0, 30, 50, 64)); - ptr.setPen(QColor("orange")); - ptr.drawText(frm.rect(), Qt::AlignCenter, "Loading..."); - ptr.end(); - return frm; -} - -static inline void qAddPane(QSizeF size, QGeometryData *data) -{ - Q_ASSERT(data); - QSizeF f = size / 2.0f; - QVector2D a(-f.width(), -f.height()); - QVector2D b(f.width(), -f.height()); - QVector2D c(f.width(), f.height()); - QVector2D d(-f.width(), f.height()); - QVector2D ta(0.0f, 0.0f); - QVector2D tb(1.0f, 0.0f); - QVector2D tc(1.0f, 1.0f); - QVector2D td(0.0f, 1.0f); - int k = data->count(); - data->appendVertex(a, b, c, d); - data->appendTexCoord(ta, tb, tc, td); - data->appendIndices(k, k+1, k+2); - data->appendIndices(k, k+2, k+3); -} - -ImageDisplay::ImageDisplay(QObject *parent, QGLMaterialCollection *materials, qreal wallSize) - : QGLSceneNode(parent) - , m_wall(0) - , m_frames(0) - , m_currentWall(0) - , m_currentFrame(0) - , m_imageSetToDefault(false) - , m_count(0) - , m_size(wallSize) - , m_frameSize((m_size * 3.0f) / 4.0f) - , m_maxImages(500) - , m_frameLoadingMaterial(-1) -{ - // the real values will get poked in here by the atlas - m_atlasPlaceHolder.append(QVector2D(), QVector2D(), QVector2D(), QVector2D()); - - setObjectName("ImageDisplay"); - setPalette(materials); - - // the frames lie in Z = 0, the wall is set back and lies in - // the plane Z = (m_size / -4.0) - - // build the wall - qAddPane(QSize(m_size, m_size), &m_wallGeometry); - m_wall = new QGLSceneNode(this); - m_wall->setObjectName("Wall"); - m_wall->setPalette(materials); - m_currentWall = new QGLSceneNode(m_wall); - m_currentWall->setObjectName("wall 0"); - m_currentWall->setGeometry(m_wallGeometry); - m_currentWall->setCount(m_wallGeometry.indexCount()); - m_wall->setPosition(QVector3D(0.0f, 0.0f, m_size / -4.0)); - - // paint the wall - m_wall->setEffect(QGL::FlatReplaceTexture2D); - QGLMaterial *mat = new QGLMaterial(); - QGLTexture2D *tex = new QGLTexture2D(mat); - tex->setImage(QImage(":/res/images/girder.png")); - mat->setTexture(tex); - mat->setObjectName("girder material"); - m_wall->setMaterial(mat); - - // build the frames - qAddPane(QSize(m_frameSize, m_frameSize), &m_frameGeometry); - m_frameGeometry.appendTexCoordArray(m_atlasPlaceHolder, QGL::TextureCoord1); - m_frames = new QGLSceneNode(this); - m_frames->setObjectName("Frames"); - m_currentFrame = new ThumbnailNode(m_frames); - m_currentFrame->setObjectName("frame 0"); - m_currentFrame->setGeometry(m_frameGeometry); - m_currentFrame->setCount(m_frameGeometry.indexCount()); - - // use the frames geometry to put the atlas data into - QAtlas *atlas = QAtlas::instance(); - atlas->setGeometry(m_frameGeometry); - - // generally the frames use the thumbnail material & effect - m_effect = new ThumbnailEffect; - m_frames->setUserEffect(m_effect); - m_frames->setEffectEnabled(true); - m_frames->setMaterial(atlas->material()); - - // unless they're loading, in which case use the "loading" image - m_frameImage = qMakeFrameImage(); - mat = new QGLMaterial(); - tex = new QGLTexture2D(mat); - tex->setHorizontalWrap(QGL::Clamp); - tex->setImage(m_frameImage); - mat->setTexture(tex); - mat->setObjectName("loading image material - default"); - m_frameLoadingMaterial = materials->addMaterial(mat); - m_currentFrame->setMaterialIndex(m_frameLoadingMaterial); - - // make the frames pickable - PhotoBrowser3DView *view = qobject_cast<PhotoBrowser3DView*>(parent); - view->scene()->mainNode()->addNode(m_frames); - - m_imageSetToDefault = true; -} - -ImageDisplay::~ImageDisplay() -{ - delete m_effect; -} - -void ImageDisplay::addThumbnailNode(const QUrl &image) -{ - Q_ASSERT(QThread::currentThread() == thread()); - ImageManager *manager = qobject_cast<ImageManager*>(sender()); - if (!m_imageSetToDefault) - { - QVector3D p = m_currentFrame->position(); - p.setX(p.x() - m_size); - int start = m_frameGeometry.indexCount(); - qAddPane(QSize(m_frameSize, m_frameSize), &m_frameGeometry); - int count = m_frameGeometry.indexCount() - start; - m_frameGeometry.appendTexCoordArray(m_atlasPlaceHolder, QGL::TextureCoord1); - m_currentFrame = new ThumbnailNode(m_frames); - QString name = QLatin1String("frame %1"); - name.arg(m_count); - m_currentFrame->setObjectName(name); - m_currentFrame->setPosition(p); - m_currentFrame->setStart(start); - m_currentFrame->setCount(count); - m_currentFrame->setGeometry(m_frameGeometry); - m_currentFrame->setMaterialIndex(m_frameLoadingMaterial); - - QGLSceneNode *s = m_currentWall->clone(m_wall); - name = QLatin1String("wall %1"); - name.arg(m_count); - s->setObjectName(name); - p = s->position(); - p.setX(p.x() - m_size); - s->setPosition(p); - m_currentWall = s; - } - m_currentFrame->setUrl(image); - if (manager) - { - connect(m_currentFrame, SIGNAL(imageRequired(ThumbnailableImage)), - manager, SIGNAL(deployLoader(ThumbnailableImage))); - connect(manager, SIGNAL(imageReady(ThumbnailableImage)), - m_currentFrame, SLOT(setImage(ThumbnailableImage))); - } - PhotoBrowser3DView *view = qobject_cast<PhotoBrowser3DView*>(parent()); - Q_ASSERT(view); - connect(m_currentFrame, SIGNAL(nodeChanged()), view, SLOT(update())); - - m_imageSetToDefault = false; - emit framesChanged(); - ++m_count; -} diff --git a/demos/qt3d/photobrowser3d/imagedisplay.h b/demos/qt3d/photobrowser3d/imagedisplay.h deleted file mode 100644 index b0d7a56d..00000000 --- a/demos/qt3d/photobrowser3d/imagedisplay.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 IMAGEDISPLAY_H -#define IMAGEDISPLAY_H - -#include "qglscenenode.h" -#include "qglmaterialcollection.h" - -#include <QString> - -QT_BEGIN_NAMESPACE -class QGLBuilder; -class QGLTexture2D; -class QGLPainter; -QT_END_NAMESPACE - -class ThumbnailNode; - -class ImageDisplay : public QGLSceneNode -{ - Q_OBJECT -public: - ImageDisplay(QObject *parent, QGLMaterialCollection *materials, qreal wallSize = 4.0); - ~ImageDisplay(); - int maxImages() const { return m_maxImages; } - void setMaxImages(int max) { m_maxImages = max; } -signals: - void framesChanged(); -public slots: - void addThumbnailNode(const QUrl &url); -private: - QGLSceneNode *m_wall; - QGLSceneNode *m_frames; - QGLSceneNode *m_currentWall; - ThumbnailNode *m_currentFrame; - QGLAbstractEffect *m_effect; - bool m_imageSetToDefault; - int m_count; - qreal m_size; - qreal m_frameSize; - int m_maxImages; - QImage m_frameImage; - int m_frameLoadingMaterial; - QGeometryData m_frameGeometry; - QGeometryData m_wallGeometry; - QVector2DArray m_atlasPlaceHolder; -}; - -#endif // IMAGEDISPLAY_H diff --git a/demos/qt3d/photobrowser3d/imageloader.cpp b/demos/qt3d/photobrowser3d/imageloader.cpp deleted file mode 100644 index b2e0b4b2..00000000 --- a/demos/qt3d/photobrowser3d/imageloader.cpp +++ /dev/null @@ -1,113 +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 "imageloader.h" -#include "imagemanager.h" -#include "bytereader.h" - -#include <QFileInfo> -#include <QTime> -#include <QDir> -#include <QStringList> -#include <QPixmap> -#include <QPainter> -#include <QBuffer> -#include <QImageReader> -#include <QMutex> -#include <QMutexLocker> -#include <QTimer> - -ImageLoader::ImageLoader() - : m_stop(0) -{ } -ImageLoader::~ImageLoader() -{ - // nothing to do here -} - -ThumbnailableImage ImageLoader::image() const -{ - return m_image; -} - -void ImageLoader::setImage(const ThumbnailableImage &image) -{ - m_image = image; - if (!m_stop.load() && isRunning()) - emit readRequired(image); -} - -void ImageLoader::stop() -{ - m_stop.ref(); - emit stopLoading(); -} - -void ImageLoader::queueInitialImage() -{ - emit readRequired(m_image); -} - -void ImageLoader::unusedTimeout() -{ - emit unused(); -} - -void ImageLoader::run() -{ - ByteReader reader; - connect(this, SIGNAL(readRequired(ThumbnailableImage)), - &reader, SLOT(loadFile(ThumbnailableImage))); - connect(&reader, SIGNAL(imageLoaded(ThumbnailableImage)), - this, SIGNAL(imageLoaded(ThumbnailableImage))); - - connect(this, SIGNAL(stopLoading()), &reader, SLOT(stop())); - connect(&reader, SIGNAL(stopped()), this, SLOT(quit())); - - QTimer timer; - connect(&timer, SIGNAL(timeout()), this, SLOT(unusedTimeout())); - timer.start(2 * 60 * 1000); - - if (!m_image.isNull()) - QTimer::singleShot(0, this, SLOT(queueInitialImage())); - - exec(); -} diff --git a/demos/qt3d/photobrowser3d/imageloader.h b/demos/qt3d/photobrowser3d/imageloader.h deleted file mode 100644 index f8f23ac4..00000000 --- a/demos/qt3d/photobrowser3d/imageloader.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAGELOADER_H -#define IMAGELOADER_H - -#include <QThread> -#include <QUrl> -#include <QMutex> -#include <QAtomicInt> - -#include "thumbnailableimage.h" - -class ImageManager; -class ByteReader; - -class ImageLoader : public QThread -{ - Q_OBJECT -public: - ImageLoader(); - ~ImageLoader(); - ThumbnailableImage image() const; - void setImage(const ThumbnailableImage &image); -signals: - void imageLoaded(const ThumbnailableImage &image); - void stopLoading(); - void readRequired(const ThumbnailableImage &image); - void thumbnailRequired(const ThumbnailableImage &image); - void thumbnailDone(const ThumbnailableImage &image); - void unused(); -public slots: - void stop(); -protected: - void run(); -private slots: - void queueInitialImage(); - void unusedTimeout(); -private: - ThumbnailableImage m_image; - QAtomicInt m_stop; - ByteReader *m_reader; -}; - -#endif // IMAGELOADER_H diff --git a/demos/qt3d/photobrowser3d/imagemanager.cpp b/demos/qt3d/photobrowser3d/imagemanager.cpp deleted file mode 100644 index 6f2ec5bc..00000000 --- a/demos/qt3d/photobrowser3d/imagemanager.cpp +++ /dev/null @@ -1,133 +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 "imagemanager.h" -#include "qatlas.h" -#include "filescanner.h" -#include "threadpool.h" - -#include <QTime> -#include <QTimer> -#include <QDir> - -ImageManager::ImageManager() -{ -} - -ImageManager::~ImageManager() -{ -} - -// INVARIANT: only ever called before the run() function is started -// therefore no need for synchronized url -void ImageManager::setImageBaseUrl(const QUrl &url) -{ - Q_ASSERT(!isRunning()); - m_url = url; -} - -/*! - Stop the running threads if any, then sit waiting in the event loop - for a quit call. -*/ -void ImageManager::stop() -{ - emit stopAll(); -} - -void ImageManager::scanForFiles() -{ - // TODO: In a real app there would be a way to detect new files arriving - // and trigger a rescan to pick these new files up. Here we just scan - // once and then destroy the scanner, to save on resources. - -#ifndef QT_USE_TEST_IMAGES - // TODO: If the amount of files is large and the app is quit early the - // scanner could still be going when the threadpool quits. For now - // assume its ok... - FileScanner *scanner = new FileScanner; - scanner->setBaseUrl(m_url); - connect(scanner, SIGNAL(imageUrl(QUrl)), this, SIGNAL(imageUrl(QUrl))); - connect(scanner, SIGNAL(finished()), scanner, SLOT(deleteLater())); - connect(this, SIGNAL(stopAll()), scanner, SLOT(stop())); - scanner->start(); -#else - QDir testImages(":/pictures"); - QStringList pics = testImages.entryList(); - for (int i = 0; i < pics.size(); ++i) - { - QUrl url; - url.setScheme("file"); - url.setPath(testImages.filePath(pics.at(i))); - emit imageUrl(url); - } - qDebug() << "== test images loaded =="; -#endif -} - -void ImageManager::quit() -{ - QThread::quit(); -} - -void ImageManager::run() -{ - if (m_url.scheme() != "file") - { - qWarning("URL scheme %s not yet supported", qPrintable(m_url.scheme())); - return; - } - - // execute once in the event loop below - QTimer::singleShot(0, this, SLOT(scanForFiles())); - -#ifndef QT_NO_THREADED_FILE_LOAD - ThreadPool pool; - - connect(this, SIGNAL(deployLoader(ThumbnailableImage)), - &pool, SLOT(deployLoader(ThumbnailableImage))); - - connect(this, SIGNAL(stopAll()), &pool, SLOT(stop())); - connect(&pool, SIGNAL(stopped()), this, SLOT(quit())); -#endif - - exec(); -} diff --git a/demos/qt3d/photobrowser3d/imagemanager.h b/demos/qt3d/photobrowser3d/imagemanager.h deleted file mode 100644 index 412f590a..00000000 --- a/demos/qt3d/photobrowser3d/imagemanager.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAGEMANAGER_H -#define IMAGEMANAGER_H - -#include <QThread> -#include <QUrl> -#include <QImage> -#include <QMutex> - -#include "thumbnailableimage.h" - -class Launcher; - -class ImageManager : public QThread -{ - Q_OBJECT -public: - ImageManager(); - ~ImageManager(); - QUrl imageBaseUrl() const { return m_url; } - void setImageBaseUrl(const QUrl &url); -public slots: - void stop(); - void quit(); -signals: - void imageUrl(const QUrl &); - void imageReady(const ThumbnailableImage &); - void deployLoader(const ThumbnailableImage &); - void stopAll(); -protected: - void run(); -private slots: - void scanForFiles(); -private: - QUrl m_url; -}; - -#endif // IMAGEMANAGER_H diff --git a/demos/qt3d/photobrowser3d/images/P1000223.JPG b/demos/qt3d/photobrowser3d/images/P1000223.JPG Binary files differdeleted file mode 100644 index 48edfbc2..00000000 --- a/demos/qt3d/photobrowser3d/images/P1000223.JPG +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/P1000228.JPG b/demos/qt3d/photobrowser3d/images/P1000228.JPG Binary files differdeleted file mode 100644 index 2797b6df..00000000 --- a/demos/qt3d/photobrowser3d/images/P1000228.JPG +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/P1000472.JPG b/demos/qt3d/photobrowser3d/images/P1000472.JPG Binary files differdeleted file mode 100644 index 067afdd4..00000000 --- a/demos/qt3d/photobrowser3d/images/P1000472.JPG +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/arrows-left.png b/demos/qt3d/photobrowser3d/images/arrows-left.png Binary files differdeleted file mode 100644 index 791f2c6b..00000000 --- a/demos/qt3d/photobrowser3d/images/arrows-left.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/arrows.xcf b/demos/qt3d/photobrowser3d/images/arrows.xcf Binary files differdeleted file mode 100644 index 302bcd6e..00000000 --- a/demos/qt3d/photobrowser3d/images/arrows.xcf +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_base.xcf b/demos/qt3d/photobrowser3d/images/default_sky_base.xcf Binary files differdeleted file mode 100644 index 050812f7..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_base.xcf +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_down.png b/demos/qt3d/photobrowser3d/images/default_sky_down.png Binary files differdeleted file mode 100644 index 685c28c4..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_down.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_east.png b/demos/qt3d/photobrowser3d/images/default_sky_east.png Binary files differdeleted file mode 100644 index f6463abf..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_east.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_north.png b/demos/qt3d/photobrowser3d/images/default_sky_north.png Binary files differdeleted file mode 100644 index 153b833c..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_north.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_south.png b/demos/qt3d/photobrowser3d/images/default_sky_south.png Binary files differdeleted file mode 100644 index b3b01321..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_south.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_up.png b/demos/qt3d/photobrowser3d/images/default_sky_up.png Binary files differdeleted file mode 100644 index 3d4d6233..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_up.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/default_sky_west.png b/demos/qt3d/photobrowser3d/images/default_sky_west.png Binary files differdeleted file mode 100644 index 14325371..00000000 --- a/demos/qt3d/photobrowser3d/images/default_sky_west.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/images/girder.png b/demos/qt3d/photobrowser3d/images/girder.png Binary files differdeleted file mode 100644 index f9b6c4dc..00000000 --- a/demos/qt3d/photobrowser3d/images/girder.png +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/launcher.cpp b/demos/qt3d/photobrowser3d/launcher.cpp deleted file mode 100644 index 6d90636b..00000000 --- a/demos/qt3d/photobrowser3d/launcher.cpp +++ /dev/null @@ -1,115 +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 "launcher.h" -#include "imageloader.h" -#include "imagemanager.h" - -#include <QSemaphore> -#include <QTime> -#include <QFileInfo> -#include <QDir> -#include <QStringList> -#include <QSet> -#include <QDebug> - -Launcher::Launcher(ImageManager *manager) - : m_manager(manager) - , m_stop(false) -{ - Q_ASSERT(m_manager); -} - -void Launcher::run() -{ - if (m_url.isEmpty()) - { - qWarning("Launcher::run - empty URL!"); - return; - } - if (m_url.scheme() != QLatin1String("file")) - { - qWarning("URL scheme %s not yet supported", qPrintable(m_url.scheme())); - return; - } - QStringList queue; - queue.append(m_url.path()); - QSet<QString> loopProtect; - while (queue.size() > 0 && !m_stop) - { - QString path = queue.takeFirst(); - QFileInfo u(path); - if (u.isSymLink()) - path = u.symLinkTarget(); - if (u.isDir()) - { - if (!loopProtect.contains(path)) - { - loopProtect.insert(path); - QDir dir(path); - QStringList entries = dir.entryList(); - QStringList::const_iterator it = entries.constBegin(); - for ( ; it != entries.constEnd(); ++it) - { - // ignore hidden files, system directories - if ((*it).startsWith(QLatin1Char('.'))) - continue; - queue.append(dir.absoluteFilePath(*it)); - } - } - } - else - { - if (u.isFile() && u.isReadable()) - { - // do no checking here for file extensions etc - just - // forward any readable file found under the pictures - // directory to the QImage loader, and let it sort out - // if the thing can be loaded as an image. - QUrl url2; - url2.setScheme(QLatin1String("file")); - url2.setPath(u.absoluteFilePath()); - m_manager->acquire(); - emit imageUrl(url2); - } - } - } -} diff --git a/demos/qt3d/photobrowser3d/m5-photobrowser3d.desktop b/demos/qt3d/photobrowser3d/m5-photobrowser3d.desktop deleted file mode 100644 index 54efc5f8..00000000 --- a/demos/qt3d/photobrowser3d/m5-photobrowser3d.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Name=Photobrowser -Comment=Qt3D example application -Exec=/usr/bin/photobrowser3d -fullscreen -Icon=icon-l-qt3d -Terminal=false -Type=Application -Categories=Development; -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable -X-Text-Domain=qt3d - diff --git a/demos/qt3d/photobrowser3d/main.cpp b/demos/qt3d/photobrowser3d/main.cpp deleted file mode 100644 index 9e0edd87..00000000 --- a/demos/qt3d/photobrowser3d/main.cpp +++ /dev/null @@ -1,93 +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 <QtWidgets/QApplication> -#include <QtCore/QThread> - -#include "photobrowser3dview.h" - -int main(int argc, char *argv[]) -{ - Q_INIT_RESOURCE(photobrowser3d); - - QApplication app(argc, argv); - - // for QSettings - QCoreApplication::setOrganizationName("Nokia"); - QCoreApplication::setOrganizationDomain("nokia.com"); - QCoreApplication::setApplicationName("photobrowser3d"); - - int result = 0; - { - PhotoBrowser3DView view; - - if (view.stereoType() != QGLView::RedCyanAnaglyph) - view.camera()->setEyeSeparation(0.3f); - QStringList args = QCoreApplication::arguments(); - int w_pos = args.indexOf("-width"); - int h_pos = args.indexOf("-height"); - if (w_pos >= 0 && h_pos >= 0) - { - bool ok = true; - int w = args.at(w_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse width argument:" << args; - return 1; - } - int h = args.at(h_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse height argument:" << args; - return 1; - } - view.resize(w, h); - } - else - { - view.resize(800, 600); - } - view.show(); - - result = app.exec(); - } - return result; -} diff --git a/demos/qt3d/photobrowser3d/pancontroller.cpp b/demos/qt3d/photobrowser3d/pancontroller.cpp deleted file mode 100644 index 1ed5639b..00000000 --- a/demos/qt3d/photobrowser3d/pancontroller.cpp +++ /dev/null @@ -1,244 +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 "pancontroller.h" -#include "qglview.h" -#include "qglcamera.h" -#include "photobrowser3dview.h" - -#include <qmath.h> - -#include <QtGlobal> -#include <QTime> - -class PanControllerPrivate -{ -public: - PanControllerPrivate() - : speed(0.0f) - , angle(0.0f) - , arrowDirection(Qt::NoArrow) - , view(0) - , maxSpeed(4.0f) - , defaultDistance(0.0f) - , panDistance(0.0f) - , panViewAngle(M_PI / 4.0f) // 45 degrees in radians - , animating(false) - , elapsed(0.0f) - { - panTime.start(); - } - - void calculateValues(); - - qreal speed; - qreal angle; - Qt::ArrowType arrowDirection; - QGLView *view; - QTime panTime; - qreal maxSpeed; - qreal defaultDistance; - qreal panDistance; - qreal panViewAngle; - bool animating; - qreal elapsed; -}; - -PanController::PanController(QObject *parent) - : QObject(parent) - , d(new PanControllerPrivate) -{ - QGLView *v = qobject_cast<QGLView*>(parent); - if (v) - d->view = v; -} - -PanController::~PanController() -{ - delete d; -} - -qreal PanController::defaultDistance() const -{ - return d->defaultDistance; -} - -void PanController::setDefaultDistance(qreal dist) -{ - d->defaultDistance = dist; -} - -qreal PanController::panDistance() const -{ - return d->panDistance; -} - -void PanController::setPanDistance(qreal dist) -{ - d->panDistance = dist; -} - -qreal PanController::panViewAngle() const -{ - return d->panViewAngle; -} - -void PanController::setPanViewAngle(qreal angle) -{ - d->panViewAngle = angle; -} - -void PanController::setMaxSpeed(qreal maxSpeed) -{ - d->maxSpeed = maxSpeed; -} - -qreal PanController::maxSpeed() const -{ - return d->maxSpeed; -} - -void PanController::setSpeed(qreal speed) -{ - qreal t = d->panTime.restart(); - if (d->speed != speed) - { - d->speed = speed; - d->angle = speed * d->panViewAngle; - if (!qIsNull(d->speed)) - d->animating = true; - d->elapsed += t; - d->calculateValues(); - emit speedChanged(); - } -} - -qreal PanController::speed() const -{ - return d->speed; -} - -void PanController::pan() -{ - if (d->animating) - { - qreal t = d->panTime.restart(); - d->elapsed += t; - // dont recalculate every single time - // 30ms frame time == 33fps - more than enough - if (d->elapsed > 30) - d->calculateValues(); - - PhotoBrowser3DView *view = qobject_cast<PhotoBrowser3DView*>(parent()); - Q_ASSERT(view); - view->update(); - } -} - -void PanControllerPrivate::calculateValues() -{ - if (view && animating) - { - QGLCamera *cam = view->camera(); - Q_ASSERT(cam); - - QVector3D c = cam->center(); - QVector3D e = cam->eye(); - - if (qFuzzyIsNull(speed)) - { - c.setX(e.x()); - e.setZ(defaultDistance); - } - else - { - // as speed goes from 0 -> 1, eye moves closer to z=0 plane - e.setZ(defaultDistance - (speed * (defaultDistance - panDistance))); - - // the view angle is a direct function of the speed see setSpeed() above - // and as view angle increases we look further along the x-axis - qreal opp = (e.z() - c.z()) * qTan(angle); - - // velocity along the x axis is controlled by speed (a value from 0 -> 1 - // which is a modifier for the maxSpeed, a constant). the velocity gives - // us the incremental change in x for this unit time - qreal dx = (speed * maxSpeed * elapsed); - - if (arrowDirection == Qt::LeftArrow) - { - e.setX(e.x() - dx); - c.setX(e.x() - opp); - } - else if (arrowDirection == Qt::RightArrow) - { - e.setX(e.x() + dx); - c.setX(e.x() + opp); - } - } - cam->setEye(e); - cam->setCenter(c); - } - elapsed = 0; - if (qIsNull(speed)) - animating = false; -} - -Qt::ArrowType PanController::direction() const -{ - return d->arrowDirection; -} - -void PanController::setDirection(Qt::ArrowType arrow) -{ - Q_ASSERT(arrow == Qt::LeftArrow || arrow == Qt::RightArrow); - d->arrowDirection = arrow; -} - -QGLView *PanController::view() const -{ - return d->view; -} - -void PanController::setView(QGLView *view) -{ - d->view = view; -} - diff --git a/demos/qt3d/photobrowser3d/pancontroller.h b/demos/qt3d/photobrowser3d/pancontroller.h deleted file mode 100644 index b6e938ab..00000000 --- a/demos/qt3d/photobrowser3d/pancontroller.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PANCONTROLLER_H -#define PANCONTROLLER_H - -#include <QObject> -#include <Qt> - -QT_BEGIN_NAMESPACE -class QGLView; -QT_END_NAMESPACE - -class PanControllerPrivate; - -class PanController : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal speed READ speed WRITE setSpeed NOTIFY speedChanged) -public: - explicit PanController(QObject *parent = 0); - ~PanController(); - - qreal defaultDistance() const; - void setDefaultDistance(qreal d); - - qreal panDistance() const; - void setPanDistance(qreal d); - - qreal panViewAngle() const; - void setPanViewAngle(qreal angle); - - qreal maxSpeed() const; - void setMaxSpeed(qreal maxSpeed); - - qreal speed() const; - void setSpeed(qreal speed); - - Qt::ArrowType direction() const; - void setDirection(Qt::ArrowType arrow); - - QGLView *view() const; - void setView(QGLView *view); - - void pan(); - -signals: - void speedChanged(); - -private: - PanControllerPrivate *d; -}; - -#endif // PANCONTROLLER_H diff --git a/demos/qt3d/photobrowser3d/photobrowser.rc b/demos/qt3d/photobrowser3d/photobrowser.rc deleted file mode 100644 index b40ecdc1..00000000 --- a/demos/qt3d/photobrowser3d/photobrowser.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "qt3d.ico" diff --git a/demos/qt3d/photobrowser3d/photobrowser3d.desktop b/demos/qt3d/photobrowser3d/photobrowser3d.desktop deleted file mode 100644 index 747c8097..00000000 --- a/demos/qt3d/photobrowser3d/photobrowser3d.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Photobrowser 3D -Icon=icon-l-qt3d -Exec=/usr/bin/photobrowser3d -fullscreen -OnlyShowIn=X-MeeGo; -X-MeeGo-Logical-Id=qtn_comm_appname_photobrowser3d -X-MeeGo-Translation-Catalog=essentials diff --git a/demos/qt3d/photobrowser3d/photobrowser3d.pro b/demos/qt3d/photobrowser3d/photobrowser3d.pro deleted file mode 100644 index 37c7275f..00000000 --- a/demos/qt3d/photobrowser3d/photobrowser3d.pro +++ /dev/null @@ -1,65 +0,0 @@ -TEMPLATE = app -TARGET = photobrowser3d -CONFIG += qt warn_on -QT += widgets - -include(../../../pkg.pri) -QT += qt3d opengl - -SOURCES += main.cpp\ - photobrowser3dview.cpp \ - imagedisplay.cpp \ - skybox.cpp \ - imagemanager.cpp \ - imageloader.cpp \ - qfocusadaptor.cpp \ - thumbnailableimage.cpp \ - qatlas.cpp \ - thumbnailnode.cpp \ - thumbnaileffect.cpp \ - filescanner.cpp \ - bytereader.cpp \ - threadpool.cpp \ - buttons.cpp \ - qphotobrowser3dscene.cpp \ - pancontroller.cpp - -HEADERS += photobrowser3dview.h \ - imagedisplay.h \ - skybox.h \ - imagemanager.h \ - imageloader.h \ - qfocusadaptor.h \ - thumbnailableimage.h \ - qatlas.h \ - thumbnailnode.h \ - thumbnaileffect.h \ - filescanner.h \ - bytereader.h \ - threadpool.h \ - buttons.h \ - qphotobrowser3dscene.h \ - pancontroller.h - -# Uncomment this line to force all file loading is done in the gui thread -# instead of a background thread - useful for debugging. -# DEFINES += QT_NO_THREADED_FILE_LOAD - -# Uncomment this to use test images instead of scanning the file-system for -# pictures. The test images are stored in in-memory resources "files". -# DEFINES += QT_USE_TEST_IMAGES - -RESOURCES += \ - photobrowser3d.qrc - -OTHER_FILES += \ - shaders/replace_texture.fsh \ - shaders/replace_texture.vsh - -CONFIG += qt3d_deploy_pkg -include(../../../pkg.pri) - -OTHER_FILES += \ - photobrowser.rc - -RC_FILE = photobrowser.rc diff --git a/demos/qt3d/photobrowser3d/photobrowser3d.qrc b/demos/qt3d/photobrowser3d/photobrowser3d.qrc deleted file mode 100644 index 4d310bd8..00000000 --- a/demos/qt3d/photobrowser3d/photobrowser3d.qrc +++ /dev/null @@ -1,23 +0,0 @@ -<RCC> - <qresource prefix="/res"> - <file alias="down.png">images/default_sky_down.png</file> - <file alias="west.png">images/default_sky_east.png</file> - <file alias="north.png">images/default_sky_north.png</file> - <file alias="south.png">images/default_sky_south.png</file> - <file alias="up.png">images/default_sky_up.png</file> - <file alias="east.png">images/default_sky_west.png</file> - <file>images/girder.png</file> - </qresource> - <qresource prefix="/shaders"> - <file alias="replace_texture.fsh">shaders/replace_texture.fsh</file> - <file alias="replace_texture.vsh">shaders/replace_texture.vsh</file> - </qresource> - <qresource prefix="/pictures"> - <file alias="im1.jpg">images/P1000223.JPG</file> - <file alias="im2.jpg">images/P1000228.JPG</file> - <file alias="im3.jpg">images/P1000472.JPG</file> - </qresource> - <qresource prefix="/controls"> - <file alias="arrows-left.png">images/arrows-left.png</file> - </qresource> -</RCC> diff --git a/demos/qt3d/photobrowser3d/photobrowser3dview.cpp b/demos/qt3d/photobrowser3d/photobrowser3dview.cpp deleted file mode 100644 index 4227832b..00000000 --- a/demos/qt3d/photobrowser3d/photobrowser3dview.cpp +++ /dev/null @@ -1,446 +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 "photobrowser3dview.h" -#include "imagemanager.h" -#include "imagedisplay.h" -#include "skybox.h" -#include "qglpicknode.h" -#include "qfocusadaptor.h" -#include "thumbnailableimage.h" -#include "qatlas.h" -#include "filescanner.h" -#include "buttons.h" -#include "qphotobrowser3dscene.h" -#include "pancontroller.h" -#include "thumbnailnode.h" - -#include <QApplication> -#include <QDesktopWidget> -#include <QWheelEvent> -#include <QDir> -#include <QTimer> -#include <QTime> -#include <QStateMachine> -#include <QState> -#include <QFinalState> -#include <QSignalTransition> -#include <QPropertyAnimation> - -PhotoBrowser3DView::PhotoBrowser3DView() - : QGLView() - , m_scene(0) - , m_display(0) - , m_images(0) - , m_buttons(0) - , m_skybox(0) - , m_palette(new QGLMaterialCollection(this)) - , m_state(0) - , m_app(0) - , m_zoomed(0) - , m_browse(0) - , m_pan(0) - , m_fa(0) - , m_pc(0) - , m_pickableDirty(true) - , m_done(false) - , m_closing(false) -{ - setOption(QGLView::ObjectPicking, true); - // setOption(QGLView::ShowPicking, true); - //setOption(QGLView::CameraNavigation, false); - - qRegisterMetaType<ThumbnailableImage>("ThumbnailableImage"); - - QString path = ":/res"; - int ix = qApp->arguments().indexOf("--skybox"); - if (ix != -1) - { - if (qApp->arguments().size() > ix+1) - path = qApp->arguments().at(ix+1); - else - qWarning("Expected path/to/skybox/files after \"--skybox\" switch\n"); - } - - m_displaySize = 4.0; - m_scene = new QPhotoBrowser3DScene(this); - m_buttons = new Buttons(this, m_palette); - m_scene->mainNode()->addNode(m_buttons); - m_scene->setPickable(true); - m_skybox = new SkyBox(this, path); - m_display = new ImageDisplay(this, m_palette, m_displaySize); - - setupStates(); - - // make sure this only gets created in the GUI thread - QAtlas::instance(); - - QTimer::singleShot(0, this, SLOT(initialise())); -} - -PhotoBrowser3DView::~PhotoBrowser3DView() -{ - // nothing to be done here -} - -void PhotoBrowser3DView::setupStates() -{ - m_state = new QStateMachine(this); - m_app = new QState; - m_zoomed = new QState(m_app); - m_browse = new QState(m_app); - m_pan = new QState(m_app); - m_app->setInitialState(m_browse); - m_state->addState(m_app); - QFinalState *end_state = new QFinalState; - m_app->addTransition(this, SIGNAL(done()), end_state); - m_state->addState(end_state); - connect(m_state, SIGNAL(finished()), this, SLOT(close())); - - m_fa = new QFocusAdaptor(this); - m_browse->assignProperty(m_fa, "progress", 0.0); - m_zoomed->assignProperty(m_fa, "progress", 1.0); - - m_pc = new PanController(this); - m_pc->setMaxSpeed(m_displaySize / 1000.0f); - m_browse->assignProperty(m_pc, "speed", 0.0); - m_pan->assignProperty(m_pc, "speed", 1.0); - - m_state->setObjectName("StateMachine"); - m_app->setObjectName("Application"); - m_zoomed->setObjectName("Zoomed"); - m_browse->setObjectName("Browse"); - m_pan->setObjectName("Pan"); - end_state->setObjectName("EndState"); - - QSignalTransition *transition = m_browse->addTransition(this, SIGNAL(zoom()), m_zoomed); - QPropertyAnimation *a = new QPropertyAnimation(m_fa, "progress"); - a->setDuration(500); - a->setEasingCurve(QEasingCurve::OutQuad); - transition->addAnimation(a); - - transition = m_zoomed->addTransition(this, SIGNAL(zoom()), m_browse); - a = new QPropertyAnimation(m_fa, "progress"); - a->setDuration(500); - a->setEasingCurve(QEasingCurve::InQuad); - transition->addAnimation(a); - - transition = m_browse->addTransition(this, SIGNAL(pan()), m_pan); - a = new QPropertyAnimation(m_pc, "speed"); - a->setDuration(500); - a->setEasingCurve(QEasingCurve::OutQuad); - transition->addAnimation(a); - - transition = m_pan->addTransition(this, SIGNAL(pan()), m_browse); - a = new QPropertyAnimation(m_pc, "speed"); - a->setDuration(500); - a->setEasingCurve(QEasingCurve::InQuad); - transition->addAnimation(a); - - m_state->setInitialState(m_app); - m_state->start(); -} - -void PhotoBrowser3DView::initialise() -{ - QString path = QDir::home().absoluteFilePath("Pictures"); - int ix = qApp->arguments().indexOf("--pictures"); - if (ix != -1) - { - if (qApp->arguments().size() > ix+1) - path = qApp->arguments().at(ix+1); - else - qWarning("Expected /path/to/image/files after \"--pictures\" switch\n"); - } - - QUrl url; - url.setScheme("file"); - url.setPath(path); - - bool atLeastOneImageFound = false; - QFileInfo fi(path); - if (fi.exists() && fi.isDir()) - { - QDir pics(path); - QStringList entries = pics.entryList(QDir::Files); - for (int i = 0; i < entries.size() && !atLeastOneImageFound; ++i) - { - QImage im(pics.filePath(entries.at(i))); - if (!im.isNull()) - atLeastOneImageFound = true; - } - } - if (!atLeastOneImageFound) - { - qWarning("No pictures directory found at %s\n" - "using test images", qPrintable(path)); - - url.setPath(":/pictures"); - } - -#ifdef QT_NO_THREADED_FILE_LOAD - nonThreadedFileLoad(url); -#else - initialiseImageManager(url); -#endif -} - -void PhotoBrowser3DView::initialiseImageManager(const QUrl &url) -{ - m_images = new ImageManager; - - connect(m_images, SIGNAL(imageUrl(QUrl)), m_display, SLOT(addThumbnailNode(QUrl))); - connect(m_images, SIGNAL(finished()), this, SLOT(waitForExit())); - - connect(m_display, SIGNAL(framesChanged()), this, SLOT(pickableDirty())); - connect(m_display, SIGNAL(framesChanged()), this, SLOT(update())); - - m_images->setImageBaseUrl(url); - QThread::Priority p = QThread::idealThreadCount() < 2 ? - QThread::IdlePriority : QThread::NormalPriority; - m_images->start(p); -} - -void PhotoBrowser3DView::nonThreadedFileLoad(const QUrl &url) -{ -#if defined(QT_USE_TEST_IMAGES) - Q_UNUSED(url); - QDir testImages(":/pictures"); - QStringList pics = testImages.entryList(); - for (int i = 0; i < pics.size(); ++i) - { - QUrl url; - url.setScheme("file"); - url.setPath(testImages.filePath(pics.at(i))); - m_display->addThumbnailNode(url); - } - pickableDirty(); -#else - FileScanner *scanner = new FileScanner(this); - scanner->setBaseUrl(url); - QTimer::singleShot(0, scanner, SLOT(scan())); - connect(scanner, SIGNAL(imageUrl(QUrl)), m_display, SLOT(addThumbnailNode(QUrl))); -#endif -} - -void PhotoBrowser3DView::wheelEvent(QWheelEvent *e) -{ - e->accept(); - QVector3D viewVec = camera()->eye() - camera()->center(); - qreal zoomMag = viewVec.length(); - qreal inc = float(e->delta()) / 50.0f; - if (!qFuzzyIsNull(inc)) - { - zoomMag += inc; - if (zoomMag < 2.0f) - zoomMag = 2.0f; - QRay3D viewLine(camera()->center(), viewVec.normalized()); - camera()->setEye(viewLine.point(zoomMag)); - update(); - } -} - -void PhotoBrowser3DView::keyPressEvent(QKeyEvent *e) -{ - if (e->key() == Qt::Key_Q) - { - m_done = true; - emit done(); - } - else if (e->key() == Qt::Key_Right) - { - m_pc->setDirection(Qt::RightArrow); - emit pan(); - } - else if (e->key() == Qt::Key_Left) - { - m_pc->setDirection(Qt::LeftArrow); - emit pan(); - } - else if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down) - { - QVector3D viewVec = camera()->eye() - camera()->center(); - qreal zoomMag = viewVec.length(); - zoomMag += (e->key() == Qt::Key_Up) ? -0.5f : 0.5f; - if (zoomMag < 5.0f) - zoomMag = 5.0f; - QRay3D viewLine(camera()->center(), viewVec.normalized()); - camera()->setEye(viewLine.point(zoomMag)); - update(); - } - else - { - QGLView::keyPressEvent(e); - } -} - -void PhotoBrowser3DView::waitForExit() -{ - QThread::yieldCurrentThread(); - m_images->wait(); - m_images->deleteLater(); - m_images = 0; - if (m_closing) - { - if (!m_done) - { - emit done(); - m_done = true; - } - } -} - -void PhotoBrowser3DView::closeEvent(QCloseEvent *e) -{ - if (m_images) - { - e->ignore(); - m_images->stop(); - - // this was a request to close the main window, so we are closing up shop - // set this flag to indicate that when the image manager stops done event - // should be signalled to the state machine, resulting in close - m_closing = true; - } - else - { - e->accept(); - } -} - -void PhotoBrowser3DView::mousePressEvent(QMouseEvent *e) -{ - Q_UNUSED(e); - registerPickableNodes(); - QGLView::mousePressEvent(e); -} - -void PhotoBrowser3DView::initializeGL(QGLPainter *painter) -{ - Q_UNUSED(painter); - QAtlas::instance()->initialize(painter); - camera()->setEye(QVector3D(0.0f, 0.0f, 4.0f * m_displaySize)); - registerPickableNodes(); - qreal q = camera()->eye().z(); - qreal r = qBound(camera()->nearPlane(), q / 2.0f, camera()->nearPlane() * 3.0f); - m_pc->setDefaultDistance(q); - m_pc->setPanDistance(r); -} - -void PhotoBrowser3DView::earlyPaintGL(QGLPainter *painter) -{ - Q_UNUSED(painter); - - if (!painter->isPicking()) - { - QAtlas::instance()->paint(painter); - } - - if (!m_done) - m_pc->pan(); - - painter->setClearColor(Qt::blue); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -} - -void PhotoBrowser3DView::paintGL(QGLPainter *painter) -{ - if (!m_done) - { - glEnable(GL_BLEND); - m_skybox->draw(painter); - m_display->draw(painter); - m_buttons->draw(painter); - } -} - -void PhotoBrowser3DView::resizeGL(int w, int h) -{ - Q_UNUSED(w); - Q_UNUSED(h); - m_buttons->clearPositions(); - m_updateRequired = true; -} - -void PhotoBrowser3DView::zoomImage() -{ - QGLPickNode *pn = qobject_cast<QGLPickNode*>(sender()); - Q_ASSERT(pn); - QGLSceneNode *n = pn->target(); - m_fa->setTarget(n); - emit zoom(); -} - -void PhotoBrowser3DView::goPan() -{ - QGLPickNode *pn = qobject_cast<QGLPickNode*>(sender()); - Q_ASSERT(pn); - QGLSceneNode *n = pn->target(); - m_pc->setDirection(n->objectName() == "Left Button" ? Qt::LeftArrow : Qt::RightArrow); - emit pan(); -} - -void PhotoBrowser3DView::pickableDirty() -{ - m_pickableDirty = true; -} - -void PhotoBrowser3DView::registerPickableNodes() -{ - if (m_pickableDirty) - { - m_scene->generatePickNodes(); - QList<QGLPickNode*> pickList = m_scene->pickNodes(); - QList<QGLPickNode*>::const_iterator it = pickList.constBegin(); - for ( ; it != pickList.constEnd(); ++it) - { - QGLPickNode *pn = *it; - pn->disconnect(this); - ThumbnailNode *node = qobject_cast<ThumbnailNode*>(pn->target()); - if (node) - QObject::connect(pn, SIGNAL(clicked()), this, SLOT(zoomImage())); - else - QObject::connect(pn, SIGNAL(clicked()), this, SLOT(goPan())); - registerObject(pn->id(), pn); - } - m_pickableDirty = false; - } -} diff --git a/demos/qt3d/photobrowser3d/photobrowser3dview.h b/demos/qt3d/photobrowser3d/photobrowser3dview.h deleted file mode 100644 index 50443c31..00000000 --- a/demos/qt3d/photobrowser3d/photobrowser3dview.h +++ /dev/null @@ -1,116 +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 PHOTOBROWSER3DVIEW_H -#define PHOTOBROWSER3DVIEW_H - -#include "qglview.h" - -QT_BEGIN_NAMESPACE -class QGLMaterialCollection; -class QGLSceneNode; -class QState; -class QStateMachine; -QT_END_NAMESPACE - - -class SkyBox; -class ImageDisplay; -class ImageManager; -class QAtlas; -class Buttons; -class QPhotoBrowser3DScene; -class PanController; -class QFocusAdaptor; - -class PhotoBrowser3DView : public QGLView -{ - Q_OBJECT -public: - PhotoBrowser3DView(); - ~PhotoBrowser3DView(); - void initializeGL(QGLPainter *); - QPhotoBrowser3DScene *scene() { return m_scene; } -signals: - void done(); - void zoom(); - void pan(); -protected: - void earlyPaintGL(QGLPainter *); - void paintGL(QGLPainter *); - void resizeGL(int w, int h); - void wheelEvent(QWheelEvent *e); - void keyPressEvent(QKeyEvent *e); - void closeEvent(QCloseEvent *e); - void mousePressEvent(QMouseEvent *e); -private slots: - void initialise(); - void zoomImage(); - void pickableDirty(); - void waitForExit(); - void goPan(); -private: - void registerPickableNodes(); - void setupStates(); - void nonThreadedFileLoad(const QUrl &url); - void initialiseImageManager(const QUrl &url); - - QPhotoBrowser3DScene *m_scene; - ImageDisplay *m_display; - ImageManager *m_images; - Buttons *m_buttons; - SkyBox *m_skybox; - QGLMaterialCollection *m_palette; - QStateMachine *m_state; - QState *m_app; - QState *m_zoomed; - QState *m_browse; - QState *m_pan; - QFocusAdaptor *m_fa; - PanController *m_pc; - bool m_pickableDirty; - qreal m_displaySize; - bool m_done; - bool m_closing; - bool m_updateRequired; -}; - -#endif // PHOTOBROWSER3DVIEW_H diff --git a/demos/qt3d/photobrowser3d/qatlas.cpp b/demos/qt3d/photobrowser3d/qatlas.cpp deleted file mode 100644 index d8522c99..00000000 --- a/demos/qt3d/photobrowser3d/qatlas.cpp +++ /dev/null @@ -1,188 +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 "qatlas.h" -#include "qareaallocator.h" -#include "qgltexture2d.h" -#include "qglpainter.h" -#include "qgeometrydata.h" -#include "qglmaterial.h" -#include "qglpainter.h" -#include "qglframebufferobjectsurface.h" -#include "qglbuilder.h" - -#include <QImage> -#include <QThread> -#include <QGLFramebufferObject> -#include <QGLFramebufferObjectFormat> -#include <QCoreApplication> - -#ifndef GL_MULTISAMPLE -#define GL_MULTISAMPLE 0x809D -#endif - -QAtlas::QAtlas() - : m_size(1024, 1024) - , m_data(0) - , m_renderTarget(0) - , m_allocator(new QSimpleAreaAllocator(m_size)) - , m_tex(0) - , m_material(new QGLMaterial) - , m_initialized(false) - , m_count(0) -{ -} - -QAtlas::~QAtlas() -{ - delete m_data; - delete m_renderTarget; - delete m_allocator; -} - -void QAtlas::initialize(QGLPainter *painter) -{ - Q_UNUSED(painter); - if (!m_initialized) - { - m_data = new QOpenGLFramebufferObject(m_size); - m_renderTarget = new QGLFramebufferObjectSurface(m_data); - m_tex = QGLTexture2D::fromTextureId(m_data->texture(), m_size); - m_material->setTexture(m_tex, 1); - m_material->setObjectName("Atlas material"); - m_initialized = true; - } -} - -void QAtlas::paint(QGLPainter *painter) -{ - Q_ASSERT(QThread::currentThread() == qApp->thread()); - - if (m_allocationQueue.isEmpty() || painter->isPicking()) - return; - - glDisable(GL_DEPTH_TEST); - - painter->pushSurface(m_renderTarget); - painter->setStandardEffect(QGL::FlatReplaceTexture2D); - painter->projectionMatrix().push(); - painter->modelViewMatrix().push(); - QRect rect = painter->currentSurface()->viewportRect(); - QMatrix4x4 proj; - proj.ortho(rect); - painter->projectionMatrix() = proj; - painter->modelViewMatrix().setToIdentity(); - - painter->update(); - - QAtlasEntry entry = m_allocationQueue.takeFirst(); - - QRect a = entry.rect; - QImage image = entry.image; - - if (a.left() == 0 && a.top() == 0) // first one - paint fill color - { - painter->setClearColor(Qt::red); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - } - - QGLTexture2D t; - t.setImage(image); - t.bind(); - QVector3D va(a.left(), a.bottom()+1, 0); - QVector3D vb(a.right()+1, a.bottom()+1, 0); - QVector3D vc(a.right()+1, a.top(), 0); - QVector3D vd(a.left(), a.top(), 0); - QVector2D ta(0.0f, 0.0f); - QVector2D tb(1.0f, 0.0f); - QVector2D tc(1.0f, 1.0f); - QVector2D td(0.0f, 1.0f); - QGeometryData quad; - quad.setBufferStrategy(QGeometryData::KeepClientData); - quad.appendVertex(va, vb, vc, vd); - quad.appendTexCoord(ta, tb, tc, td); - quad.appendIndices(0, 1, 2); - quad.appendIndices(0, 2, 3); - quad.draw(painter, 0, 6); - - painter->popSurface(); - - glEnable(GL_DEPTH_TEST); -} - -QRect QAtlas::allocate(const QSize &size, const QImage &image, const QGL::IndexArray &indices) -{ - Q_ASSERT(QThread::currentThread() == qApp->thread()); - - QRect a = m_allocator->allocate(size); - if (a.isEmpty()) - { - qWarning("QAtlas::allocate: overflowed"); - return a; - } - - m_allocationQueue.append(QAtlasEntry(image, a)); - ++m_count; - - QRectF af(a); - QSizeF szf(m_size); - float l = af.left() / szf.width(); - float r = af.right() / szf.width(); - float t = 1.0f - (af.top() / szf.height()); - float b = 1.0f - (af.bottom() / szf.height()); - m_geometry.texCoord(indices.at(0), QGL::TextureCoord1) = QVector2D(l, b); - m_geometry.texCoord(indices.at(1), QGL::TextureCoord1) = QVector2D(r, b); - m_geometry.texCoord(indices.at(2), QGL::TextureCoord1) = QVector2D(r, t); - m_geometry.texCoord(indices.at(5), QGL::TextureCoord1) = QVector2D(l, t); - return a; -} - -void QAtlas::release(QRect frame) -{ - m_allocator->release(frame); -} - -Q_GLOBAL_STATIC(QAtlas, atlasInstance); - -QAtlas *QAtlas::instance() -{ - return atlasInstance(); -} diff --git a/demos/qt3d/photobrowser3d/qatlas.h b/demos/qt3d/photobrowser3d/qatlas.h deleted file mode 100644 index 260b5149..00000000 --- a/demos/qt3d/photobrowser3d/qatlas.h +++ /dev/null @@ -1,105 +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 QATLAS_H -#define QATLAS_H - -#include <QSize> -#include <QtGui/QOpenGLFramebufferObject> - -#include "qarray.h" -#include "qgeometrydata.h" - -QT_BEGIN_NAMESPACE -class QAreaAllocator; -class QGLTexture2D; -class QGLMaterial; -class QGeometryData; -class QGLFramebufferObject; -class QGLFramebufferObjectSurface; -QT_END_NAMESPACE - -struct QAtlasEntry -{ - QAtlasEntry(QImage i, QRect r) : image(i), rect(r) {} - QImage image; - QRect rect; -}; - -class QAtlas -{ -public: - QAtlas(); - ~QAtlas(); - - QAreaAllocator *allocator() const { return m_allocator; } - void setAllocator(QAreaAllocator *allocator) { m_allocator = allocator; } - - QRect allocate(const QSize &size, const QImage &image, const QGL::IndexArray &indices); - - void initialize(QGLPainter *painter); - void paint(QGLPainter *painter); - - void release(QRect frame); - - void setGeometry(QGeometryData geometry) { m_geometry = geometry; } - QGeometryData geometry() { return m_geometry; } - - QGLMaterial *material() { return m_material; } - - QList<QAtlasEntry> allocationQueue() const { return m_allocationQueue; } - - static QAtlas *instance(); - -private: - QSize m_size; - QOpenGLFramebufferObject *m_data; - QGLFramebufferObjectSurface *m_renderTarget; - QAreaAllocator *m_allocator; - QGLTexture2D *m_tex; - QGLMaterial *m_material; - QGeometryData m_geometry; - bool m_initialized; - QList<QAtlasEntry> m_allocationQueue; - int m_count; -}; - -#endif // QATLAS_H diff --git a/demos/qt3d/photobrowser3d/qfocusadaptor.cpp b/demos/qt3d/photobrowser3d/qfocusadaptor.cpp deleted file mode 100644 index c45ab8f3..00000000 --- a/demos/qt3d/photobrowser3d/qfocusadaptor.cpp +++ /dev/null @@ -1,187 +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 "qfocusadaptor.h" -#include "qglscenenode.h" -#include "qglview.h" -#include "qglcamera.h" -#include "thumbnailnode.h" - -class QFocusAdaptorPrivate -{ -public: - QFocusAdaptorPrivate() - : progress(0.0) - , reset(true) - , target(0) - , view(0) - {} - qreal progress; - QVector3D targetEye; - QVector3D targetCenter; - QVector3D sourceEye; - QVector3D sourceCenter; - bool reset; - QGLSceneNode *target; - QGLView *view; -}; - -QFocusAdaptor::QFocusAdaptor(QObject *parent) - : QObject(parent) - , d(new QFocusAdaptorPrivate) -{ - QGLView *v = qobject_cast<QGLView*>(parent); - if (v) - d->view = v; -} - -QFocusAdaptor::~QFocusAdaptor() -{ - delete d; -} - -qreal QFocusAdaptor::progress() const -{ - return d->progress; -} - -void QFocusAdaptor::setProgress(qreal progress) -{ - if (d->progress != progress) - { - d->progress = progress; - calculateValues(); - emit progressChanged(); - } -} - -QGLView *QFocusAdaptor::view() const -{ - return d->view; -} - -void QFocusAdaptor::setView(QGLView *view) -{ - d->view = view; - d->reset = true; -} - -QGLSceneNode *QFocusAdaptor::target() const -{ - return d->target; -} - -void QFocusAdaptor::setTarget(QGLSceneNode *target) -{ - if (d->target != target) - { - d->target = target; - d->reset = true; - } -} - -void QFocusAdaptor::calculateValues() -{ - if (d->target && d->view) - { - QGLCamera *cam = d->view->camera(); - Q_ASSERT(cam); - if (d->reset) - { - QGeometryData data = d->target->geometry(); - if (data.count() == 0 || d->target->count() == 0) - { - qWarning("Could not setup focus animation"); - return; - } - // assume that the first triangle referenced by this node is the one - // you want to focus on - works for simple rects and like cases - QGL::IndexArray ixs = data.indices(); - QVector3D a = data.vertexAt(ixs.at(d->target->start())); - QVector3D b = data.vertexAt(ixs.at(d->target->start() + 1)); - QVector3D c = data.vertexAt(ixs.at(d->target->start() + 2)); - - // assumes that first triangle is facing the camera - QVector3D toCam = QVector3D::normal(a, b, c); - - // wont work very well if the target is not axis-aligned - // find the distance q for the eye to be away from this object - // in order that it is a tight fit in the viewport - QGeometryData g = d->target->geometry(); - QGL::IndexArray inxs = g.indices(); - QBox3D box; - for (int i = d->target->start(); i < (d->target->start() + d->target->count()); ++i) - box.unite(g.vertexAt(inxs.at(i))); - QVector3D sz = box.size(); - - qreal nearDist = cam->nearPlane(); - - QSizeF v = cam->viewSize(); - - qreal vh = d->view->geometry().height(); - qreal vw = d->view->geometry().width(); - if (!qFuzzyIsNull(vw - vh)) - { - qreal asp = vh / vw; - if (vh > vw) - v.setHeight(v.height() * asp); - else - v.setWidth(v.width() / asp); - } - - qreal qh = (nearDist * sz.y()) / v.height(); - qreal qw = (nearDist * sz.x()) / v.width(); - - qreal q = qMax(qh, qw); - q = qMax(q, qreal(nearDist * 1.05)); - - d->sourceCenter = cam->center(); - d->sourceEye = cam->eye(); - - d->targetCenter = d->target->position(); - d->targetEye = d->targetCenter + (toCam * q); - - d->reset = false; - } - cam->setCenter(d->sourceCenter + ((d->targetCenter - d->sourceCenter) * d->progress)); - cam->setEye(d->sourceEye + ((d->targetEye - d->sourceEye) * d->progress)); - } -} diff --git a/demos/qt3d/photobrowser3d/qfocusadaptor.h b/demos/qt3d/photobrowser3d/qfocusadaptor.h deleted file mode 100644 index 8d0fe895..00000000 --- a/demos/qt3d/photobrowser3d/qfocusadaptor.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 QFOCUSADAPTOR_H -#define QFOCUSADAPTOR_H - -#include <QObject> - -QT_BEGIN_NAMESPACE -class QGLView; -class QGLSceneNode; -QT_END_NAMESPACE - -class QFocusAdaptorPrivate; - -class QFocusAdaptor : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged) -public: - explicit QFocusAdaptor(QObject *parent = 0); - ~QFocusAdaptor(); - - qreal progress() const; - void setProgress(qreal progress); - - QGLView *view() const; - void setView(QGLView *view); - - QGLSceneNode *target() const; - void setTarget(QGLSceneNode *target); - -signals: - void progressChanged(); - -public slots: - -private: - void calculateValues(); - - QFocusAdaptorPrivate *d; -}; - -#endif // QFOCUSADAPTOR_H diff --git a/demos/qt3d/photobrowser3d/qphotobrowser3dscene.cpp b/demos/qt3d/photobrowser3d/qphotobrowser3dscene.cpp deleted file mode 100644 index e05e7d46..00000000 --- a/demos/qt3d/photobrowser3d/qphotobrowser3dscene.cpp +++ /dev/null @@ -1,58 +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 "qphotobrowser3dscene.h" -#include "qglscenenode.h" - -QPhotoBrowser3DScene::QPhotoBrowser3DScene(QObject *parent) - : QGLAbstractScene(parent) - , m_rootNode(new QGLSceneNode(this)) -{ -} - -QList<QObject *> QPhotoBrowser3DScene::objects() const -{ - QList<QGLSceneNode *> children = m_rootNode->allChildren(); - QList<QObject *> objects; - for (int index = 0; index < children.size(); ++index) - objects.append(children.at(index)); - return objects; -} diff --git a/demos/qt3d/photobrowser3d/qphotobrowser3dscene.h b/demos/qt3d/photobrowser3d/qphotobrowser3dscene.h deleted file mode 100644 index 73eb7159..00000000 --- a/demos/qt3d/photobrowser3d/qphotobrowser3dscene.h +++ /dev/null @@ -1,62 +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 QFRAMESSCENE_H -#define QFRAMESSCENE_H - -#include "qglabstractscene.h" - -QT_BEGIN_NAMESPACE -class QGLSceneNode; -QT_END_NAMESPACE - -class QPhotoBrowser3DScene : public QGLAbstractScene -{ - Q_OBJECT -public: - explicit QPhotoBrowser3DScene(QObject *parent = 0); - virtual QList<QObject *> objects() const; - QGLSceneNode *mainNode() const { return m_rootNode; } -private: - QGLSceneNode *m_rootNode; -}; - -#endif // QFRAMESSCENE_H diff --git a/demos/qt3d/photobrowser3d/qt3d.ico b/demos/qt3d/photobrowser3d/qt3d.ico Binary files differdeleted file mode 100644 index 1d07c43d..00000000 --- a/demos/qt3d/photobrowser3d/qt3d.ico +++ /dev/null diff --git a/demos/qt3d/photobrowser3d/shaders/replace_texture.fsh b/demos/qt3d/photobrowser3d/shaders/replace_texture.fsh deleted file mode 100644 index dc55a3c7..00000000 --- a/demos/qt3d/photobrowser3d/shaders/replace_texture.fsh +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -// This is equivilent to GL_REPLACE -varying highp vec4 qt_TexCoord0; -uniform bool picking; -uniform mediump vec4 color; -uniform sampler2D texture; - -void main(void) -{ - if (picking) - gl_FragColor = color; - else - gl_FragColor = texture2D(texture, qt_TexCoord0.st); -} diff --git a/demos/qt3d/photobrowser3d/shaders/replace_texture.vsh b/demos/qt3d/photobrowser3d/shaders/replace_texture.vsh deleted file mode 100644 index 458087f1..00000000 --- a/demos/qt3d/photobrowser3d/shaders/replace_texture.vsh +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D 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$ -** -****************************************************************************/ - -attribute highp vec4 vertex; -attribute highp vec4 texcoord; -attribute highp vec4 thumbcoord; - -uniform highp mat4 matrix; -uniform bool thumb; - -varying highp vec4 qt_TexCoord0; - -void main(void) -{ - if (thumb) - qt_TexCoord0 = thumbcoord; - else - qt_TexCoord0 = texcoord; - gl_Position = matrix * vertex; -} diff --git a/demos/qt3d/photobrowser3d/skybox.cpp b/demos/qt3d/photobrowser3d/skybox.cpp deleted file mode 100644 index 3162a76d..00000000 --- a/demos/qt3d/photobrowser3d/skybox.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "skybox.h" -#include "qglbuilder.h" -#include "qglcube.h" -#include "qglpainter.h" -#include "qglview.h" - -#include <QDir> -#include <QFileInfo> - -SkyBox::SkyBox(QGLView *view, const QString &imagePath) - : m_scene(0) - , m_view(view) - , m_camera(new QGLCamera(this)) -{ - m_camera->setEye(QVector3D()); - m_camera->setNearPlane(0.3f); - m_camera->setViewSize(QSizeF(0.3f, 0.3f)); - - QGLBuilder builder; - builder.newSection(QGL::Faceted); - QVector3D blb(-1.0, -1.0, -1.0); - QVector3D blf(-1.0, -1.0, 1.0); - QVector3D tlf(-1.0, 1.0, 1.0); - QVector3D tlb(-1.0, 1.0, -1.0); - QVector3D brb(1.0, -1.0, -1.0); - QVector3D brf(1.0, -1.0, 1.0); - QVector3D trf(1.0, 1.0, 1.0); - QVector3D trb(1.0, 1.0, -1.0); - QVector2D bl(0.0f, 0.0f); - QVector2D br(1.0f, 0.0f); - QVector2D tr(1.0f, 1.0f); - QVector2D tl(0.0f, 1.0f); - { - QGeometryData q; // left - builder.currentNode()->setObjectName("left"); - q.appendVertex(blf, blb, tlb, tlf); - q.appendTexCoord(bl, br, tr, tl); - builder.addQuads(q); - m_faces[0] = builder.currentNode(); - m_faces[0]->setMaterial(new QGLMaterial); - } - { - builder.newNode(); // top - builder.currentNode()->setObjectName("top"); - QGeometryData q; - q.appendVertex(trf, tlf, tlb, trb); - q.appendTexCoord(bl, br, tr, tl); - builder.addQuads(q); - m_faces[1] = builder.currentNode(); - m_faces[1]->setMaterial(new QGLMaterial); - } - { - builder.newNode(); // right - builder.currentNode()->setObjectName("right"); - QGeometryData q; - q.appendVertex(brb, brf, trf, trb); - q.appendTexCoord(bl, br, tr, tl); - builder.addQuads(q); - m_faces[2] = builder.currentNode(); - m_faces[2]->setMaterial(new QGLMaterial); - } - { - builder.newNode(); // bottom - builder.currentNode()->setObjectName("bottom"); - QGeometryData q; - q.appendVertex(brb, blb, blf, brf); - q.appendTexCoord(bl, br, tr, tl); - builder.addQuads(q); - m_faces[3] = builder.currentNode(); - m_faces[3]->setMaterial(new QGLMaterial); - } - { - builder.newNode(); // front - builder.currentNode()->setObjectName("front"); - QGeometryData q; - q.appendVertex(brf, blf, tlf, trf); - q.appendTexCoord(bl, br, tr, tl); - builder.addQuads(q); - m_faces[4] = builder.currentNode(); - m_faces[4]->setMaterial(new QGLMaterial); - } - { - builder.newNode(); // back - builder.currentNode()->setObjectName("back"); - QGeometryData q; - q.appendVertex(blb, brb, trb, tlb); - q.appendTexCoord(bl, br, tr, tl); - builder.addQuads(q); - m_faces[5] = builder.currentNode(); - m_faces[5]->setMaterial(new QGLMaterial); - } - m_scene = builder.finalizedSceneNode(); - m_scene->setObjectName("SkyboxList"); - m_scene->setEffect(QGL::FlatReplaceTexture2D); - m_scene->setEffectEnabled(true); - m_scene->setParent(this); - - QString resourceBase = QLatin1String(":/"); - setImagePath(imagePath.isEmpty() ? resourceBase : imagePath); -} - - -void SkyBox::setImagePath(const QString &imagePath) -{ - static QStringList expected2; - static QStringList expected; - - if (expected.isEmpty()) - expected << QLatin1String("east") << QLatin1String("up") << QLatin1String("west") - << QLatin1String("down") << QLatin1String("south") << QLatin1String("north"); - if (expected2.isEmpty()) - expected2 << QLatin1String("right") << QLatin1String("top") << QLatin1String("left") - << QLatin1String("bottom") << QLatin1String("front") << QLatin1String("back"); - if (imagePath != m_imagePath) - { - m_imagePath = imagePath; - QStringList notFound = expected; - QFileInfo info(m_imagePath); - if (info.exists() && info.isDir()) - { - QDir imDir(imagePath); - QFileInfoList files = imDir.entryInfoList(QDir::Files); - QFileInfoList::const_iterator it = files.constBegin(); - for ( ; it != files.constEnd() && notFound.size() > 0; ++it) - { - QFileInfo ent = *it; - QString tok = ent.baseName().toLower(); - int ix = 0; - for ( ; ix < 6; ++ix) - if (tok.contains(expected.at(ix))) - break; - if (ix == 6) - { - ix = 0; - for ( ; ix < 6; ++ix) - if (tok.contains(expected2.at(ix))) - break; - } - if (ix != 6) - { - notFound.removeOne(expected.at(ix)); - QUrl url; - url.setScheme("file"); - url.setPath(ent.absoluteFilePath()); - m_faces[ix]->material()->setTextureUrl(url); - m_faces[ix]->material()->texture()->setHorizontalWrap(QGL::ClampToEdge); - m_faces[ix]->material()->texture()->setVerticalWrap(QGL::ClampToEdge); - } - } - if (notFound.size() > 2) - { - qWarning("Could not load textures for"); - for (int i = 0; i < notFound.size(); ++i) - qWarning("\t%s", qPrintable(notFound.at(i))); - } - } - else - { - qWarning("SkyBox::setImagePath: Not an existing directory %s", - qPrintable(m_imagePath)); - } - } -} - -void SkyBox::draw(QGLPainter *painter) const -{ - painter->modelViewMatrix().push(); - painter->modelViewMatrix().setToIdentity(); - - QGLCamera *cam = m_view->camera(); - m_camera->setCenter(-cam->eye()); - painter->setCamera(m_camera); - - glDisable(GL_DEPTH_TEST); - - m_scene->draw(painter); - - glEnable(GL_DEPTH_TEST); - - painter->setCamera(cam); - painter->modelViewMatrix().pop(); -} diff --git a/demos/qt3d/photobrowser3d/skybox.h b/demos/qt3d/photobrowser3d/skybox.h deleted file mode 100644 index 79b17219..00000000 --- a/demos/qt3d/photobrowser3d/skybox.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SKYBOX_H -#define SKYBOX_H - -#include <QString> -#include <QObject> - -QT_BEGIN_NAMESPACE -class QGLBuilder; -class QGLSceneNode; -class QGLPainter; -class QGLView; -class QGLCamera; -QT_END_NAMESPACE - -class SkyBox : public QObject -{ - Q_OBJECT -public: - SkyBox(QGLView *view, const QString &imagePath = QString()); - QString imagePath() const { return m_imagePath; } - void setImagePath(const QString &imagePath); - void draw(QGLPainter *painter) const; -private: - QGLSceneNode *m_scene; - QString m_imagePath; - QGLSceneNode *m_faces[6]; - QGLView *m_view; - QGLCamera *m_camera; -}; - -#endif // SKYBOX_H diff --git a/demos/qt3d/photobrowser3d/threadpool.cpp b/demos/qt3d/photobrowser3d/threadpool.cpp deleted file mode 100644 index c4d9fa85..00000000 --- a/demos/qt3d/photobrowser3d/threadpool.cpp +++ /dev/null @@ -1,135 +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 "threadpool.h" -#include "imageloader.h" -#include "imagemanager.h" - -#include <QSemaphore> - -ThreadPool::ThreadPool() -{ - m_threadPoolSize = QThread::idealThreadCount(); - if (m_threadPoolSize < 2) - m_threadPoolSize = 2; - m_stop.store(0); -} - -ThreadPool::~ThreadPool() -{ - Q_ASSERT(m_allWorkers.size() == 0); -} - -void ThreadPool::deployLoader(const ThumbnailableImage &image) -{ - // INVARIANT: this critical section is only ever executed from its - // own thread via queued signals - thus access to it is serialized - Q_ASSERT(QThread::currentThread() == thread()); - - if (m_stop.load()) - return; - - ImageManager *manager = qobject_cast<ImageManager*>(sender()); - Q_ASSERT(manager); - - ImageLoader *loader = 0; - if (m_freeWorkers.size() > 0) - loader = m_freeWorkers.takeFirst(); - - if (loader) - { - loader->setImage(image); - } - else - { - if (m_allWorkers.size() < m_threadPoolSize) - { - loader = new ImageLoader; - m_allWorkers.append(loader); - loader->setImage(image); - connect(loader, SIGNAL(imageLoaded(ThumbnailableImage)), manager, - SIGNAL(imageReady(ThumbnailableImage))); - connect(loader, SIGNAL(imageLoaded(ThumbnailableImage)), this, - SLOT(retrieveLoader())); - connect(loader, SIGNAL(finished()), this, SLOT(closeLoader())); - connect(this, SIGNAL(stopAll()), loader, SLOT(stop())); - loader->start(); - } - else - { - m_workList.append(image); - } - } -} - -void ThreadPool::retrieveLoader() -{ - ImageLoader *loader = qobject_cast<ImageLoader*>(sender()); - Q_ASSERT(loader); - if (!m_stop.load()) - { - if (!m_workList.isEmpty()) - loader->setImage(m_workList.takeFirst()); - else - m_freeWorkers.append(loader); - } -} - -void ThreadPool::stop() -{ - m_stop.ref(); - if (m_allWorkers.isEmpty()) - emit stopped(); - else - emit stopAll(); -} - -void ThreadPool::closeLoader() -{ - ImageLoader *loader = qobject_cast<ImageLoader*>(sender()); - Q_ASSERT(loader); - m_allWorkers.removeOne(loader); - loader->deleteLater(); - if (m_allWorkers.isEmpty() && m_stop.load()) - { - emit stopped(); - } -} diff --git a/demos/qt3d/photobrowser3d/threadpool.h b/demos/qt3d/photobrowser3d/threadpool.h deleted file mode 100644 index ff13b2b1..00000000 --- a/demos/qt3d/photobrowser3d/threadpool.h +++ /dev/null @@ -1,81 +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 LOADINGJOB_H -#define LOADINGJOB_H - -#include <QObject> -#include <QAtomicInt> -#include <QList> -#include <QUrl> - -#include "thumbnailableimage.h" - -class ImageLoader; - -class ThreadPool : public QObject -{ - Q_OBJECT -public: - ThreadPool(); - ~ThreadPool(); - -signals: - void stopped(); - void stopAll(); - -public slots: - void deployLoader(const ThumbnailableImage &url); - void stop(); - -private slots: - void retrieveLoader(); - void closeLoader(); - -private: - QList<ImageLoader*> m_freeWorkers; - QList<ImageLoader*> m_allWorkers; - QList<ThumbnailableImage> m_workList; - QAtomicInt m_stop; - int m_threadPoolSize; -}; - -#endif // LOADINGJOB_H diff --git a/demos/qt3d/photobrowser3d/thumbnailableimage.cpp b/demos/qt3d/photobrowser3d/thumbnailableimage.cpp deleted file mode 100644 index b6e52ffd..00000000 --- a/demos/qt3d/photobrowser3d/thumbnailableimage.cpp +++ /dev/null @@ -1,302 +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 "thumbnailableimage.h" -#include "qareaallocator.h" -#include "qgltexture2d.h" -#include "qglmaterial.h" -#include "qatlas.h" - -#include <QUrl> - -class ThumbnailableImagePrivate -{ -public: - ThumbnailableImagePrivate(); - ~ThumbnailableImagePrivate(); - - ThumbnailableImagePrivate *clone() const - { - ThumbnailableImagePrivate *temp = new ThumbnailableImagePrivate; - temp->thumbnailed = thumbnailed; - temp->pending = pending; - temp->url = url; - temp->data = data; - temp->tex = tex; - temp->mat = mat; - temp->frame = frame; - temp->scale = scale; - temp->indices = indices; - return temp; - } - - QAtomicInt ref; - - bool thumbnailed; - bool pending; - QUrl url; - QImage data; - QGLTexture2D *tex; - QGLMaterial *mat; - QRect frame; - qreal scale; - QGL::IndexArray indices; -}; - -ThumbnailableImagePrivate::ThumbnailableImagePrivate() - : ref(0) - , thumbnailed(false) - , pending(false) - , tex(0) - , mat(0) - , scale(15.0f) -{ -} - -ThumbnailableImagePrivate::~ThumbnailableImagePrivate() -{ -} - -ThumbnailableImage::ThumbnailableImage() - : d(0) -{ -} - -/*! - Construct ThumbnailableImage as a copy of \a other -*/ -ThumbnailableImage::ThumbnailableImage(const ThumbnailableImage &other) - : d(other.d) -{ - if (d) - d->ref.ref(); -} - -/*! - Destroys this ThumbnailableImage recovering any resources. -*/ -ThumbnailableImage::~ThumbnailableImage() -{ - if (d && !d->ref.deref()) - delete d; -} - -/*! - Assigns this ThumbnailableImage to be a copy of \a other. -*/ -ThumbnailableImage &ThumbnailableImage::operator=(const ThumbnailableImage &other) -{ - if (d != other.d) - { - if (d && !d->ref.deref()) - delete d; - d = other.d; - if (d) - d->ref.ref(); - } - return *this; -} - -void ThumbnailableImage::setThumbnailed(bool enable) -{ - detach(); - if (enable != d->thumbnailed && !d->data.isNull()) - { - if (enable) - { - if (d->frame.isNull()) - { - Q_ASSERT(!d->data.isNull()); - QSize sz = (QSizeF(d->data.size()) / d->scale).toSize(); - QAtlas *atlas = QAtlas::instance(); - d->frame = atlas->allocate(sz, d->data, d->indices); - d->pending = true; - } - } - if (!d->pending) - d->thumbnailed = enable; - } -} - -bool ThumbnailableImage::isThumbnailed() const -{ - bool result = false; - if (d) - { - if (d->pending) - { - QList<QAtlasEntry> queue = QAtlas::instance()->allocationQueue(); - int i = 0; - for ( ; i < queue.count(); ++i) - if (d->frame == queue.at(i).rect) - break; - if (i == queue.count()) - { - d->pending = false; - d->thumbnailed = true; - } - } - result = d->thumbnailed; - } - return result; -} - -QImage ThumbnailableImage::data() const -{ - QImage result; - if (d) - result = d->data; - return result; -} - -void ThumbnailableImage::setData(QImage data) -{ - detach(); - d->data = data; -} - -QUrl ThumbnailableImage::url() const -{ - QUrl result; - if (d) - result = d->url; - return result; -} - -void ThumbnailableImage::setUrl(const QUrl &url) -{ - detach(); - d->url = url; -} - -QRectF ThumbnailableImage::frame() const -{ - QRectF result; - if (d) - result = d->frame; - return result; -} - -qreal ThumbnailableImage::scale() const -{ - qreal result = 0.0f; - if (d) - result = d->scale; - return result; -} - -void ThumbnailableImage::minimize() -{ - if (!d) - return; - detach(); - if (!isMinimized()) - { - if (d->thumbnailed) - { - // If thumbnailed, I don't really need the full size image - d->data = QImage(); - } - else - { - // If not thumbnailed, I don't need the atlas resources - QAtlas *atlas = QAtlas::instance(); - atlas->release(d->frame); - d->frame = QRect(); - } - } -} - -bool ThumbnailableImage::isMinimized() const -{ - bool result = true; - if (d) - result = (d->thumbnailed) ? (d->data.isNull()) : (d->frame.isNull()); - return result; -} - -void ThumbnailableImage::setIndices(const QGL::IndexArray &indices) -{ - detach(); - d->indices = indices; -} - -QGL::IndexArray ThumbnailableImage::indices() const -{ - QGL::IndexArray result; - if (d) - result = d->indices; - return result; -} - -/*! - \internal - You know what this is for. No user serviceable parts below here. -*/ -void ThumbnailableImage::detach() -{ - if (!d) // lazy creation of data block - { - d = new ThumbnailableImagePrivate; - d->ref.ref(); - } - else - { - if (d->ref.load() > 1) // being shared, must detach - { - ThumbnailableImagePrivate *temp = d->clone(); - d->ref.deref(); - d = temp; - d->ref.ref(); - } - } -} - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const ThumbnailableImage &image) -{ - dbg << "ThumbnailableImage" << image.url() << "size:" << image.data().size() << - "minimized:" << image.isMinimized() << "-- thumbnailed:" << image.isThumbnailed() - << "-- null:" << image.isNull() << "-- image loaded:" << (!image.data().isNull()) - << "-- index count:" << image.indices().count(); - return dbg; -} -#endif diff --git a/demos/qt3d/photobrowser3d/thumbnailableimage.h b/demos/qt3d/photobrowser3d/thumbnailableimage.h deleted file mode 100644 index 2f5b5b98..00000000 --- a/demos/qt3d/photobrowser3d/thumbnailableimage.h +++ /dev/null @@ -1,101 +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 THUMBNAILABLEIMAGE_H -#define THUMBNAILABLEIMAGE_H - -#include <QRectF> -#include <QMetaType> - -#include "qarray.h" -#include "qgeometrydata.h" - -QT_BEGIN_NAMESPACE -class QImage; -class QGLPainter; -QT_END_NAMESPACE - -class ThumbnailableImagePrivate; - -class ThumbnailableImage -{ -public: - ThumbnailableImage(); - ThumbnailableImage(const ThumbnailableImage&); - ~ThumbnailableImage(); - - ThumbnailableImage &operator=(const ThumbnailableImage &); - - void setThumbnailed(bool enable); - bool isThumbnailed() const; - - QImage data() const; - void setData(QImage data); - - QUrl url() const; - void setUrl(const QUrl &url); - - QRectF frame() const; - qreal scale() const; - - void minimize(); - bool isMinimized() const; - - QGL::IndexArray indices() const; - void setIndices(const QGL::IndexArray &indices); - - bool isNull() const { return d == 0; } - - ThumbnailableImagePrivate *priv() const { return d; } /// debug = remove me - -private: - void detach(); - - ThumbnailableImagePrivate *d; -}; - -Q_DECLARE_METATYPE(ThumbnailableImage); - -#ifndef QT_NO_DEBUG_STREAM -QDebug operator<<(QDebug dbg, const ThumbnailableImage &image); -#endif - -#endif // THUMBNAILABLEIMAGE_H diff --git a/demos/qt3d/photobrowser3d/thumbnaileffect.cpp b/demos/qt3d/photobrowser3d/thumbnaileffect.cpp deleted file mode 100644 index 927bf8b7..00000000 --- a/demos/qt3d/photobrowser3d/thumbnaileffect.cpp +++ /dev/null @@ -1,186 +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 "thumbnaileffect.h" - -#include <QtOpenGL/qglshaderprogram.h> - -class ThumbnailEffectPrivate -{ -public: - ThumbnailEffectPrivate() - : program(0) - , matrixUniform(-1) - , thumbnailUniform(-1) - , thumbnail(false) - , thumbnailUpdateRequired(false) - { - } - ~ThumbnailEffectPrivate() { delete program; } - - QGLShaderProgram *program; - int matrixUniform; - int thumbnailUniform; - int colorUniform; - int pickingUniform; - // true if we render a thumbnail, false do the large size - bool thumbnail; - bool thumbnailUpdateRequired; -}; - -/*! - Constructs a new flat texture effect. -*/ -ThumbnailEffect::ThumbnailEffect() - : d(new ThumbnailEffectPrivate) -{ -} - -/*! - Destroys this flat texture effect. -*/ -ThumbnailEffect::~ThumbnailEffect() -{ - delete d; -} - -/*! - \reimp -*/ -QList<QGL::VertexAttribute> ThumbnailEffect::requiredFields() const -{ - QList<QGL::VertexAttribute> fields; - fields += QGL::Position; - fields += QGL::TextureCoord0; - fields += QGL::TextureCoord1; - return fields; -} - -/*! - \reimp -*/ -void ThumbnailEffect::setActive(QGLPainter *painter, bool flag) -{ - Q_UNUSED(painter); - if (!d->program) { - if (!flag) - return; - d->program = new QGLShaderProgram(); - d->program->addShaderFromSourceFile(QGLShader::Vertex, ":/shaders/replace_texture.vsh"); - d->program->addShaderFromSourceFile(QGLShader::Fragment, ":/shaders/replace_texture.fsh"); - d->program->bindAttributeLocation("vertex", QGL::Position); - d->program->bindAttributeLocation("texcoord", QGL::TextureCoord0); - d->program->bindAttributeLocation("thumbcoord", QGL::TextureCoord1); - if (!d->program->link()) { - qWarning("ThumbnailEffect::setActive(): could not link shader d->program"); - delete d->program; - d->program = 0; - return; - } - d->matrixUniform = d->program->uniformLocation("matrix"); - d->thumbnailUniform = d->program->uniformLocation("thumb"); - d->colorUniform = d->program->uniformLocation("color"); - d->pickingUniform = d->program->uniformLocation("picking"); - d->program->bind(); - d->program->setUniformValue("texture", 0); - d->program->enableAttributeArray(QGL::Position); - d->program->enableAttributeArray(QGL::TextureCoord0); - d->program->enableAttributeArray(QGL::TextureCoord1); - } else if (flag) { - d->matrixUniform = d->program->uniformLocation("matrix"); - d->program->bind(); - d->program->setUniformValue("texture", 0); - d->program->enableAttributeArray(QGL::Position); - d->program->enableAttributeArray(QGL::TextureCoord0); - d->program->enableAttributeArray(QGL::TextureCoord1); - } else { - d->program->disableAttributeArray(QGL::Position); - d->program->disableAttributeArray(QGL::TextureCoord0); - d->program->disableAttributeArray(QGL::TextureCoord1); - d->program->release(); - } -} - -/*! - \reimp -*/ -void ThumbnailEffect::update - (QGLPainter *painter, QGLPainter::Updates updates) -{ - Q_ASSERT(d->program); - if ((updates & QGLPainter::UpdateMatrices) != 0) - { - d->program->setUniformValue(d->matrixUniform, - painter->combinedMatrix()); - } - if ((updates & QGLPainter::UpdateColor) != 0) { - d->program->setUniformValue(d->pickingUniform, painter->isPicking()); - if (painter->isPicking()) - d->program->setUniformValue(d->colorUniform, painter->pickColor()); - else - d->program->setUniformValue(d->colorUniform, Qt::green); - } - if (d->thumbnailUpdateRequired) - { - d->program->setUniformValue(d->thumbnailUniform, d->thumbnail); - d->thumbnailUpdateRequired = false; - } -} - -bool ThumbnailEffect::supportsPicking() const -{ - return true; -} - - -void ThumbnailEffect::setThumbnail(bool enable) -{ - if (d->thumbnail != enable) - { - d->thumbnailUpdateRequired = true; - d->thumbnail = enable; - } -} - -bool ThumbnailEffect::thumbnail() const -{ - return d->thumbnail; -} diff --git a/demos/qt3d/photobrowser3d/thumbnaileffect.h b/demos/qt3d/photobrowser3d/thumbnaileffect.h deleted file mode 100644 index 488887de..00000000 --- a/demos/qt3d/photobrowser3d/thumbnaileffect.h +++ /dev/null @@ -1,70 +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 QGLFLATTEXTUREEFFECT_H -#define QGLFLATTEXTUREEFFECT_H - -#include "qglabstracteffect.h" -#include <QtCore/qscopedpointer.h> - -class ThumbnailEffectPrivate; - -class ThumbnailEffect : public QGLAbstractEffect -{ -public: - ThumbnailEffect(); - virtual ~ThumbnailEffect(); - - QList<QGL::VertexAttribute> requiredFields() const; - void setActive(QGLPainter *painter, bool flag); - void update(QGLPainter *painter, QGLPainter::Updates updates); - bool supportsPicking() const; - - void setThumbnail(bool enable); - bool thumbnail() const; - - QString name() const { return QLatin1String("ThumbnailEffect"); } - -private: - ThumbnailEffectPrivate *d; -}; - -#endif diff --git a/demos/qt3d/photobrowser3d/thumbnailnode.cpp b/demos/qt3d/photobrowser3d/thumbnailnode.cpp deleted file mode 100644 index 2199fc03..00000000 --- a/demos/qt3d/photobrowser3d/thumbnailnode.cpp +++ /dev/null @@ -1,281 +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 "thumbnailnode.h" -#include "qglpainter.h" -#include "thumbnaileffect.h" -#include "imagemanager.h" -#include "qatlas.h" -#include "qglrendersequencer.h" -#include "qglpicknode.h" -#include "qlogicalvertex.h" - -#include <QMatrix4x4> -#include <QTimer> - -ThumbnailNode::ThumbnailNode(QObject *parent) - : QGLSceneNode(parent) - , m_thresholdSquared(20.0f * 20.0f) - , m_defaultMaterial(-1) - , m_loading(false) - , m_full(0) - , m_manager(0) - , m_lastDistance(ThumbnailNode::Unknown) -{ - setPalette(new QGLMaterialCollection(this)); -} - -ThumbnailNode::~ThumbnailNode() -{ - delete m_full; -} - -void ThumbnailNode::setUrl(const QUrl &url) -{ - m_url = url; - m_image = ThumbnailableImage(); - m_image.setUrl(m_url); - QGL::IndexArray inxs = geometry().indices(); - m_image.setIndices(inxs.mid(start(), count())); -} - -void ThumbnailNode::setupLoading() -{ - if (!m_loading && !m_url.isEmpty() && m_image.data().isNull()) - { - m_loading = true; -#ifdef QT_NO_THREADED_FILE_LOAD - ThumbnailableImage image; - image.setUrl(m_url); - QImage im(m_url.toLocalFile()); - if (im.isNull()) - qDebug() << "ThumbnailNode::setupLoading: could not load image:" - << m_url.toLocalFile(); - if (im.size().width() > 1024 || im.size().height() > 768) - im = im.scaled(QSize(1024, 768), Qt::KeepAspectRatio, - Qt::SmoothTransformation); - image.setData(im); - setImage(image); -#else - if (m_manager) - // reconnect the signal we disconnnected in setImage() below - connect(m_manager, SIGNAL(imageReady(ThumbnailableImage)), - this, SLOT(setImage(ThumbnailableImage))); - emit imageRequired(m_image); - setMaterialIndex(m_defaultMaterial); -#endif - } -} - -void ThumbnailNode::createFullNode() -{ - m_full = new QGLSceneNode; - m_full->setPosition(position()); - m_full->setGeometry(geometry()); - m_full->setStart(start()); - m_full->setCount(count()); - m_full->setPalette(palette()); - m_full->setMaterialIndex(m_defaultMaterial); -} - -void ThumbnailNode::destroyFullNode() -{ - if (!m_full) - return; - QGLMaterial *mat = m_full->material(); - if (m_full->materialIndex() != m_defaultMaterial) - m_full->palette()->removeMaterial(mat); - delete m_full; - m_full = 0; -} - -void ThumbnailNode::loadFullImage() -{ - if (!m_full) - createFullNode(); - Q_CHECK_PTR(m_full); - // if we have a valid image, and the full node still has the - // default material, switch to a new material which displays - // the full size image - if (!m_image.data().isNull() && - m_full->materialIndex() == m_defaultMaterial) - { - QGLMaterial *mat = new QGLMaterial; - QGLTexture2D *tex = new QGLTexture2D; - tex->setImage(m_image.data()); - mat->setTexture(tex); - mat->setObjectName(m_image.url().path()); - int ix = palette()->addMaterial(mat); - m_full->setMaterialIndex(ix); - mat->setParent(m_full); - } -} - -void ThumbnailNode::drawGeometry(QGLPainter *painter) -{ - QGLSceneNode::drawGeometry(painter); -} - -void ThumbnailNode::draw(QGLPainter *painter) -{ - QGLSceneNode *p = qobject_cast<QGLSceneNode*>(parent()); - Q_ASSERT_X(p && p->userEffect() && (!hasEffect()), - Q_FUNC_INFO, "Should only inherit parents ThumbnailEffect"); - - ThumbnailEffect *effect = static_cast<ThumbnailEffect*>(p->userEffect()); - Q_ASSERT_X(effect && effect->name() == QLatin1String("ThumbnailEffect"), - Q_FUNC_INFO, "Can only be drawn with custom ThumbnailEffect"); - - if (m_defaultMaterial == -1) - m_defaultMaterial = materialIndex(); - - QMatrix4x4 m = painter->modelViewMatrix().top(); - QVector3D pos = m.map(position()); - qreal magSquared = pos.lengthSquared(); - - Distance distance = Unknown; - - if (magSquared > (4.0f * m_thresholdSquared)) - distance = VeryFar; - else if (magSquared > (2.0f * m_thresholdSquared)) - distance = Far; - else if (magSquared > m_thresholdSquared) - distance = Middle; - else - distance = Near; - - if (true) // distance != m_lastDistance) - { - m_lastDistance = distance; - m_image.setThumbnailed(m_lastDistance > Near); - switch (distance) - { - case Unknown: - case Near: - setupLoading(); - loadFullImage(); - break; - case Middle: - setupLoading(); - loadFullImage(); - break; - case Far: - setupLoading(); - break; - case VeryFar: - destroyFullNode(); - break; - } - } - - effect->setThumbnail(m_image.isThumbnailed()); - if (m_image.isThumbnailed() || !m_full) - { - QGLSceneNode::draw(painter); - } - else - { - if (m_image.data().isNull()) - m_full->setMaterialIndex(m_defaultMaterial); - if (pickNode() && painter->isPicking()) - painter->setObjectPickId(pickNode()->id()); - m_full->draw(painter); - } - -} - -void ThumbnailNode::setImage(const ThumbnailableImage &image) -{ - Q_ASSERT(QThread::currentThread() == thread()); - Q_ASSERT(!image.isNull()); - - // the manager will be (potentially) loading a number of images, but - // we only want our one, so just check this is our order - if (m_url != image.url()) - return; - - // ok we got the right one, stop listening to the manager - if (sender()) - { - m_manager = sender(); - m_manager->disconnect(this, SLOT(setImage(ThumbnailableImage))); - } - - // ok maybe we got what we asked for but in the meantime we decided - // we did not want it anymore - if (!m_loading) - return; - - // the indices we are about to set will index this thumbnail image - // into the image that its atlas is based on via the texture coords - // that the atlas is using - those texture coords must be in the - // same geometry that this node is referencing, so that they will - // arrive at the vertex shader at the same time - ie they are all - // matched in the data arrays in the geometry object - //Q_ASSERT(QAtlas::instance()->geometry() == geometry()); - - m_image = image; - Q_ASSERT(!m_image.data().isNull()); - - // configure the placeholder for the actual image size - // this makes a photo of 1024 x 768 display on approx 3.0 x 2.8 pane - // add salt to taste - //QSizeF f = QSizeF(m_image.data().size()) / 600.0f; - QSizeF f = QSizeF(m_image.data().size()); - f.scale(1.6, 1.2, Qt::KeepAspectRatio); - QVector3D a(-f.width(), -f.height(), 0.0f); - QVector3D b(f.width(), -f.height(), 0.0f); - QVector3D c(f.width(), f.height(), 0.0f); - QVector3D d(-f.width(), f.height(), 0.0f); - int k = start(); - Q_ASSERT(count() == 6); - QGeometryData g = geometry(); - QGL::IndexArray inxs = g.indices(); - g.vertex(inxs.at(k)) = a; - g.vertex(inxs.at(k+1)) = b; - g.vertex(inxs.at(k+2)) = c; - g.vertex(inxs.at(k+5)) = d; - - setMaterialIndex(-1); - m_loading = false; - - emit nodeChanged(); -} diff --git a/demos/qt3d/photobrowser3d/thumbnailnode.h b/demos/qt3d/photobrowser3d/thumbnailnode.h deleted file mode 100644 index c05da591..00000000 --- a/demos/qt3d/photobrowser3d/thumbnailnode.h +++ /dev/null @@ -1,96 +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 THUMBNAILNODE_H -#define THUMBNAILNODE_H - -#include "qglscenenode.h" -#include "thumbnailableimage.h" - -#include <QtCore/qmath.h> -#include <QUrl> - -class ThumbnailNode : public QGLSceneNode -{ - Q_OBJECT -public: - enum Distance - { - Unknown, - Near, - Middle, - Far, - VeryFar - }; - - explicit ThumbnailNode(QObject *parent = 0); - ~ThumbnailNode(); - QUrl url() const { return m_url; } - void setUrl(const QUrl &url); - void setThreshold(qreal threshold) { m_thresholdSquared = threshold * threshold; } - qreal threshold() const { return qSqrt(m_thresholdSquared); } - void draw(QGLPainter *painter); - void drawGeometry(QGLPainter *painter); - ThumbnailableImage image() const { return m_image; } -signals: - void imageRequired(const ThumbnailableImage &); - void nodeChanged(); -public slots: - void setImage(const ThumbnailableImage &image); -private: - void createFullNode(); - void destroyFullNode(); - void setupLoading(); - void setupThumbnailing(); - void loadFullImage(); - - ThumbnailableImage m_image; - qreal m_thresholdSquared; - int m_defaultMaterial; - QUrl m_url; - bool m_loading; - QGLSceneNode *m_full; - QSizeF m_max; - QObject *m_manager; - Distance m_lastDistance; -}; - -#endif // THUMBNAILNODE_H diff --git a/demos/qt3d/qt3d.pro b/demos/qt3d/qt3d.pro deleted file mode 100644 index 90e858a3..00000000 --- a/demos/qt3d/qt3d.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = teaservice shapes pageflip cubehouse photobrowser3d diff --git a/demos/qt3d/qt3d.svg b/demos/qt3d/qt3d.svg deleted file mode 100644 index 37e093c6..00000000 --- a/demos/qt3d/qt3d.svg +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<!-- Converted with SVG Converter - Version 0.9.5 (Compiled Mon May 30 09:08:51 2011) - Copyright (C) 2011 Nokia --> -<svg xmlns="http://www.w3.org/2000/svg" width="156.4375" version="1.1" height="157.4375" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="tiny" id="svg3033"> - <defs id="defs3035"/> - <metadata id="metadata3038"/> - <g id="layer1" transform="translate(28.03125,33.8125)"> - <rect width="150.51273" x="-25.074545" y="-30.852354" height="151.52289" ry="22.142857" style="fill:#000000;stroke:#d4f301;stroke-width:5.92500019;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" id="rect2996"/> - <image width="134" x="-14.079733" y="-21.892805" height="128" id="image2993" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIYAAACACAYAAADOIBGMAAAABHNCSVQICAgIfAhkiAAAHLhJREFU eJztnXmUHVWdxz9Vb+vXe2clCYGEJSEQVhEEFIGjuDIqijri6BEdZcaVUVFm3MYdFcd1nDkCMjMi orggLkcUYRzWiAIBgQRIE7J1Op3et7dVzR+/e6tu1av3Xr1OdxKS+p5TXe/Vu1V1q+73/rb7u7ct BC4JDmZY4QP2vqhFgv0fCTESRCIhRoJIJMRIEImEGAkikRAjQSQSYiSIREKMBJFIiJEgEgkxEkQi IUaCSCTESBCJhBgJIpEQI0EkEmIkiERCjASRSIiRIBIJMRJEIiFGgkgkxEgQiXSzJ8xfBmvOgpUn wsoTYNEKaOuSLdcGhQmYGIHJUeh/GnrXQ+9D8NjdMLBldit/1HPg7VfBFefM7Pzlx8Ixz4MjT4El R8qzdS+GbB5yeSlTnIbiFIwPwe5tMLAVNj8CT9wPG9fB9Hj0tY87G/7pv2DxipnVLQ7KJSgXYXwY RnfBzqfh6fWw/nb4653glGd+bZ0dXDdLvHsxnPtmOPO18iKtqpzieNiwDu7+CdxxvbzkPUFrF1x1 D4wNwuXPj3/evKVwwXvhBW+AQ1buWR1KBXjgd/I8d/4YnErw93wHvOOr8JJ37Nl9ZoLd2+FX34Zf fKM2eQ1UtWhdYnQfAq+7HF52qd+DZgOlAtx6Dfz4izOTIrk2+OQtcMK58Ohd8Yhh2XDRFfC3n4BM tvl7NsL2J+E/3gN/+W31b6e+At5/NfQcMvv3bYTBHfCdd8M9P6tbLB4x7BS85oPwpk81JsTTj8DN /wYP3yEstVMwf6mI0gveC0ecWPvcUhFuuhJu/KyIxDjoWgQfv1kkF8Qnxls+D6+/ovbvhSm4+Wtw 789h20aYGoN0ViTMmjPh1ZfBkSfXv4fjwLcvhd9+t/q3jvnw7u/A8y9qXFeA26+Hq94cPGanRWXP WwpHnARnvBqe+8p4RL/lm/Ddy6qlmkJjYnTMh4/+CE48r/HNbr0GvvWumjcDCy75Elz4ofrXeeJ+ +NyFjaXH8efCh6+HeUv8Y3GIYdlw4zC0dtQuc8V58PDttX9PZ+Er98BRp9S/V2EK3r4ShndG//7S d8J7/rP+NSCaGFFYugo++N+w+vTGZe/6CVz5hsj2qj/hqH0efOGOeKR48i/wrUvrkALAhWs/DOt+ Wf9aR58KX7oTFtfQ+Z0L4H1Xw+dvC5IiLlxHDMha2LaxPilAJNqdP2p8r1weVp1W+/eH/tD4Gs1g +0b42PkiuRvhrNfCJV+Jd90AMT78A1ixNt6JN30xvtX7/U80LrPoMPjELZDO+ccWLBcVcE0vnP/2 aKP32LPgl25wu+o+kRImvvEOmJ6IvrfjxHuOtu545Xb2xis3W5gahasvi1f21R8Qr7IRPHf1jAvh OS+Jd/FKpbEUMLHpAejrbewFHH6c6HJcOOUlsPaFYDcZaamURb25ocZedwu8c5UQ7KQXwbLV0Dlf DOGhPkhloFLyy1u2qI98u9g1q04TI7wRrv+UuLN7Gw/eBsP90L2ocdnXfQQ+8zf1y3jEeOk741di +8b6ojkKmx6I5x6+8t3QswRSqeaur3Hz16H3wejfBrfDDz8jWy0cdSp8+a7mPZdH/gg3fBoeuq25 82YNrsSLTn5x46Inv7i6I4ThEUNb+XEwMhC/rHfOrnjlFhwKb1sBuzbL97ZuuHGodvm4XklcdC6I R4qpcXFN198O9/9676uPKIzXeU8msi3iOtcz9j1i5OtY7GHEdS0D59RhZxjtPT4x9lfk2+G0C+Aw FT196A+irkZn0GlmrU5NtGFxuv7vHjF2PRM/fNvW5X8+7QJ448dh+RrR7xvXwc+uggduDZ4TR/dp zHboHCDXKj7/Wa+Fw9dKNDfXCn2b4M+/gWsvB1xRBa/JC/nTWWjtlLKHr4VzL4bnvsK/ZiYrz718 jUSGSwW49Vq47qNiEO5tLFsVr9xQn4TQ68Ejxl0/gQs/GO/Chx4jxtlJL4JP/CL42ynny3bdFeK5 aKyOqao23Adju+OVjUKuFQqTwWOrTod/vknUVBhLjpTgj47kVEq+7i1Nw8g0jPTD5ofhjzfAx34O z3tV9L0zOXjFP0is40NnVhvAc4mVJ8mzxMHt329cxrP5b7pSrNo4yLeLx3Dxv4LrwtcugYs64X2n yCATwFs/D8cq3b/mLHFH4+CGOoZhHLzwTRKI6lzoH7v8hmhSAOzaItIyLjaua1xm9elw/Dnxr7mn aJ8nIfc4GOqToYhG8Igxugs++5ravn4YF39KAlMP/QF+/z0JIW96AH73PfndsuBNn5QQ+SVfjnfN n34F7v9VvLIamVzwe6UsOv9VH/CPdc6vff7So+I3YjYPZ14Yr2ylRoznhHPjnR8FyxaJ2LlQJMTz L4J3fROufkpGmhthchQ+86p4Ejkw7P743fCRs+FffgqLDq9/4tqzZV8uwqFrxC6YHg+K8RPOgw9d D2vOaFyRGz8H//Ox6uNug9XBVpwAx70AHr9X7IDXXS7HuwyJ8cPPSmg+CpYFn/4t/O5auPdm2PKo SM5SAdIZMYQXrxTp9/JL44nre2+Gv/5f8FjHfPjHf4cXvL7x+SD2zLkXxysbB1sehy9eFD/GEjmI 1toFb/2CxDaaiSdUyhIiD/fieuh/Rgae/vyb2jW8ZlPzeQ1fu0QkmcZ5b4G3fQl6Fjd3nWYwOSoq +aYrg0MFp74c3n/NvhldHe6XwcGffRXKhZrFmht2X7ZaRlnP+zvxfWcTgzuksr/+jiT31MPyY8VO WHlCvGvffj189S3Vxl82D2e/UUTw8efMTipBqSDS4e6fwh0/gMkR/7eWdsnHeOnf7/l9mkGlDI/d A//7A/j9dWJEN0BzxNDoWgTnXAynXyBiO9V03pdgegLu/41U+E+/ai4eYtlw8vmi41edJhKkpV0a f3IU+jfDE3+CP/5QUgAaIZ0TI3HliTI+tPBwGaDrXiR6PJMTd7VcksYvTIp3MrhDjNXNj0ikccN9 0VHg486Gy67b82SgWigVRXVPjYvNsG0jbNsgGXMP3QYTw01dbmbEMNHaJfkJhx0nYxtLjpK4Rr5D opTtEQNNd94k4mzjuvph2AT7DHtOjHo47YLquAZIAs8nXyb5iAn2S1QRY4ZKIRqmJ2Bi/lL4+l9E xD1xP2x/QkT/0A4Zda1jFCXYR5hVYtRzLVMpPypq4gsXwV03zWYtEswGZnVeSa10tgTPPsyqjZHg WYtkkfkE8ZAQI0EkEmIkiERCjASRSIiRIBIJMRJEIiFGgkgkxEgQiYQYCSKRECNBJBJiJIjErI6u 7rewwLb8GfDmwICr/jhO48TjgwkHBTHa2qGzB1rbJfPbtoUcrisz94sFGBuGoYH4SyIc6DigiWHb sHQFHLoSDjkUunokATidkWkDjiNzOKcmYfdO2NoLvRtgcoKDfrz5gCYGFuRaoGchLFwCnd2Qb5Uk X8uSFP/CtCICMDo080TnAw0H9GtwHZEEO7dCS17S6qdblcSw5XuxABNjsHMb7Nwua2gd7NICDnRi uDC8G3ofF5sio1RIDlEz5ZJIi9274JknpVxigAoOCnd1ZBB29QkJ7JSolxY1d6RShoEdMNCXkMLE QUEMxxHJMdAnkiLfJp5KrgWmp+T4aHMTdA54HNCqxESxAEO7YGpC7IhKGaYnxU2dmqw9O/1gxUGR DJzNwfzF4rJ2dst325YYxuQEDO6C/m2yP0gxtzPR9jksP3CVSstSSNms7DNZUR22rcpZ8tCuo6TH tEz+rVREvZSKwesd4JjbmWizCcuSnp3NSSOnUmI4Wiq0rUPcliXH0xk/cJVKyTnpjHgiqZQigUtk F7Asf3FZp6JIUpTPrgqXl4tQKsl3b3P86KlTkX25JEGz8n6imix7Zks+7XfEsGzp3a3t0N0DHT0S lMq1KJJkIJ2WLaXC22lFgnRakcdWYW8LTzrohg+vLmxKA00c3eiOE2zwUsk/Vi7LMR0LKRbEdpkY E0N3fBQKhZmtcBgHtu0/q6Ukm+736bQE8VIpqd/kuJKATWD/IoYlhFhyGMxfBO0dEpjK5YUUmawv GdJpkQp2ypcQtm2QwvZXFbbC5FC3c70/hkRBDag5/sCaJodT8ReHKZel0ctlIUyxKJKiMCV2y+gQ 9G+HXTuaW8oyDrIt0LNAtpa8fM+oTuI40olyrYADfVth02Mw8mwmRsqW8YyOTmjrkIfTkiKblV4Q IIVSMaaa8UhhBaUGRq+KGl0FX0VYgKvtENdXX466nmMbPdXosabv7zrSS0cGZ5cY+TY4cg2sXA2L D1XvKS/voFQUL6t/O2x9GvqeEYJOjDV/n/2KGLm8Gs9oU42fUiLTaAjdyCa8xjVFgeVLgCoJYRqV lhwzbRD92dubtolBMo8Ytl9PTdRsDlrboKNb1MxskCPfBkevhWNOhOVH+hIjlZYxn907RUL0boBt veJlzdRwnhVieHrb8o2/KN1nfg4jlZL/J5JvF9FoGpyaGOhrWsa1jevWsiMIlQseUAi/QCt0zHgG 836aGFZKNluptVRapN28hdJjx0fYI+RaYNkKOP65sPRwSSPI5kR1jA/6KuOhe0V97Wn6wJ4Rw4KW FmlIretb8n7uQyYjBqLu+VrUYwcb1bJFBO7uh1wuaD/Y+qVbIqptkxxhKRIihGUcCxC0jpNuWWC5 wXMsRZIAKfX9K6pulqhC2zY8ImVEd3arf7o3w3VALAsWHAKrjocFi6G9U1Qrrtg0m5+E9ffBhvUw MTo77vWMiJFO+0PZi5ZC93wZe8jlhRgtKufBtvxGjdLvKKL0b4fNT0hU0nRPTYnhqRT1ompJj6AY qf7sCYIIaYA6bhJB790QAS0bLMcgqiJwKi2Gakq50LkWsQMmRmdOjHybBOgWLoG2TnlHli1rg42N wMb1sPHhPZdKJpoiRioNCw+R5JdlK4QUXT0qcJTCa/iKst4rFXBUPMBx8FxBrcdBHnBotwSVWlqV 52FIC88lC3kcmgxhcpgualiSaFKY0iNgd5h2iqkeqXE/o05O2M4wpEZ7lxBjdHhmvbmzJ/iutRs6 PCik6H1cJO5sIjYxLEskw8lniQE0f7E8tLaER3eJv1yYlLGHYkF+K5XEpXPKPjlM/Weph0ylpGel M6GAliktIkhhxikCx/F/05+Nne9xoDwQV0kF8NljEMUjgmvch2D9HMuQbtrWyEgcprVDiD8Vc+Vl E93zYP5CkRz6X2ZMTYpdsX4d9O9o/pqNEJsY+TZYcTSsPgEWLZPGHugTQ2dbL+zYCiO7fTI4FV9S VCp+lBCCn3N5OGS5SCJtW6QMIqR0lDNCvwcaHnwxX0+9uKFzMEhhEAVCtkiEFNK2hWPaP5oUap9W KiXfCh1dIhmbiUS2totnk28Xu8KyoFwRN3jLprmJk0ATxFi8DNacDPMWAa6Q4vEHYcND4hbpEUsz ZBwHmZwfq0hn5EXa2ro31IgnNQyjUzeMbRCkqtFDeyzDvDCkQoBfxkmuG7x25KYNZFfVveLXP50W I7ylTSTi0ED8KKRtS3pAR5cYnGklLYrT8v6feVIkx1wgFjFSaancgkOkAaenxGd+5klJoJ3pkLWl Alo6e9uzLVIh1REOVIW2sJQI2wJyswgJYsDUHlpyoK7jHTPtDKVWvONmYM0gtnZdszl5zpa8SNQ4 w5Z2SoYEOrpVECvtD/IN7ITtm+cuXSBWoo5lqdHKjLyYcknsidHhBv9eswGyLfLQLXnfC7HCXohu 3BpGJ1HkiCIN+MQKnR+OioalR3isJewye664ZagTvSl7KZuR5+zoUq5mzPfTNU+5pypVoFSUaObQ LsknmSvEzuAKuGzg9apawaRGyOQk+KNdWy/EbRtSwzTmzBdvinBjX+WFGHUzYxrhYJgVOqeKdMY5 gfsbasz0oExip2wj4KXyQlpirGGezkj8Y95CRaacqLViAfq2iIs/l4htY1TUoJHrSg/QA1q1IpmN YNvyorR7Goh0pqolRiQhwuqDYBkINTp4XcHVB1yjHEY58IasbQsc/YMmjPZQXLyYhkcQgyh2xQh6 Zf15LY2Qb4NFS8QjybcpF7UittzATjE+5xKxJEalLGHdkSH5nM4oa7lL1MtMkG+V0dNMxu9Rurel IkSyZVf31kgbI6KXN1I1UbYLoWt50rHGdawQiW3TiFbPl1bJQ20d9f+bQ0urjC4vXAJdKnhop/x2 GBuRsZG5RCxiuC6MjoglXCoKMTq6JfrZ0tq8Osm1iN704hYhu6LKxggZoFENUmUrhCVKrQaNKEPo mPiiIUmlniVQvxrPYBqi6YwaQe6qfi+WLe9z4RIZD5m/WNRJrkXqVCxK5xwbaT6/olnEtjEmx0WE FablAdu7JG7f2d387K22Dv88L6fC6GWk8ELeHjkINZwdVBee+giRRgrUJkl4aL6elAGq1ViE/ePZ I8qY9mIbSl3m8n6Wuq5fJgudXXDoClixSqLLPQuUGkmLSitMidGp40VzidhNOjUB25+GwX5p1NY2 cV+XrpCQdjNx+mxOci1qjomoF+2l7pmfo1xXIo7phjQlCf7vGq5b/d3zTpSNYZ6rr6nr4jjBe5oh cssSwjs2VOzgkHxLXqSmzjnp7BEidHVLrKhnoXgk+bxcrzjte4LTTf6X7JmgKeNzd78kgMxbJA8y bxEsP0JCsxNj8SN66axhW6T8nhXlppqJN+EebEZETTfUJAhU7z2iGHkbYXUYHlPxykLQ8LT8urmW REE9O8NQhQF7wwj/Z1tEKrR3KSK0CmHaO9UIddafYzs2BDuembuglommlMDkGDz5V2H2UceJnlx6 GCxfKZWOk36vE3w9FzVMiLDRGUWAsLowyULwe8AjCUkOY1cbuoCNuOiGhMD2yeGRRdffibY19JZR HsrSw8WuyOYk7J1r8Ueo9ShquSASe3RYAotzlUdqoiliOI4kg3R2CykOO1pE3vKjYHAAxsfq/2to y5LzWlWGVuBl6ReaCkoMnaBTZfyZjd7ILsBP1fPGSkxGaKmhGtYL57vBclqyuMZ9tL1j5mvYFrhR JFf7dEaty1EUqdvajjd1MpsTaepNvFZZ62MjKpy+l/5DVNP5GKUiPPmoiL7u+SLylh8hhHAdeOrR +nkHOtXfTOQ1ff+At2GKY4KqJcqz8IzSOmokQApFFP3RJIFHAILH9N4LiZukUPV1zbhGCiwdyzDs DP38OrKJ6yc1pdJyrlOR9zoxqvI4eyUHY29gRok6Q7vgiUck+LLmJJEgK1cLmyfHJYYfZTXrdDdP WpiNXqvBqSMR8BsrHKXEOE8j/DuuP+Suj3lSIWx3hOwRfW+X6LqGDdIqwitvpa1DbAzHwYv2gnwv lcSeGB6UJRp29YkE2RuYcWrfzq3w4L3ysEcfL775kccIIWxbjKSw9ZzOiD7VE4MCYyFRjU/weN2X T2irIzU8hL671YeCScD6GuEBNd3gjl+26pkM4ps2h44k6xly4M9V0XNrtz0t73NyPE7LzA5mTIxS EZ7eIN5IsQDHPUfsjeNPFR/9sQegd6P8S01HiVU9ymhGOU1X1FMXod4WdkvNchBqHPO7ZWSKh6QH hBLLI0LjnvQwTtAqJkqVhSWeztUwv6cUQXTsZ3i32FzZFhmcLKs5KtOTYlcM9Il63rpppi01M+xR MrDrSqLIA/eKO3XMiZLEc/RaP7rZu0EeTmdvhV+ga7w0s6d59gK+5IjarPBnqqVFlaRQUJ3fKxce CvdUhU4wMq6nx1o8yWYSEL9eluXZzoF66nkgmzb44yKlopBialw63NCApDYMDTTdNHuMPZ4+4Dqw c4tIhv7tcNLzxAVbuVoMq3mLYetTQqBSyTesrDoNC35PNlVFpG9ZSz1YRsNbwesFH0B+D0gPhAzh hJ4qCUTQQwnYQgSf0ysTMo6nxsQVnZ4SVTE1KcHCgT7J0Op9XKY77m3MyrySckn86907xWo+eq2E dRctFe9lyXLY8pToyVTKeLlEtHWtHm5FlK2FEDkCn63qop5UMCREwCMJZPFEVTp0LPwMlr+r4qWa AjA2LAQYHZL1wLZvhm2bxdDfF5j1mWgb1kt09Khj4aQzRLUcdoR4MF09Ijor5qxxfaLrb+Zxfbgm Ii1G4zf838PZWebQuxs6rdE9vTJmRfW5OrXR2HvPZWyOI/bZ6JC/6k//dtj0KPRtm5tczriYdWJU KvKgjz4g2csrVslEmXkLoHshuI+p5GAXKnpGuQOOqzZHooauseme7CBD8t4SBCDK25G9NnIdHYFE zvXUQkhquMi5Jjl1w1Y1pOM3plcv16i/E13G+66er2Icr5ShWJH3tHMb7Ngi3t7Y8L5fRmHO5q5O T4qbpSfZLjtcbA4d0SuX5LOXTV7xX3DFAUt91jO9gEBGttERPe8EZczamiyGNPCMS8NOAP+z2fvN Xq8b0dyHZ8O7xndHZcRXHKi4am6NY3QCY+Z8sSDxib4t8j7GRvafxWfndFKz60im0cigPPziZWJ8 6vkR6RJUMkG/PmyU6p7uTTIm2JO1PWCOWYTD3pFBLq+ShjZwg8d0byeCGI7R0N7eWEClopZK0Pvw ViyqVIYdcz+EPhPstdnuo0OypbMSQs9k/XwMDd2rXQcR8QYBUnpgyhicCoTMQ3u7BjGqjNiQxPC4 YYh/kxiOsa8ihVq2STd+peQvsFIuKXdULbIyPioRzX2tMmphry+DUC7KSGxrq9/AprHnOJBRZKi4 kHbATYFjzNfwBt+MIfnIgFjIpqjl8gbmwGhpoW0Ig5xhmyJMDm9qptr0KjylknhrxYJau3xCXNKx YWa0DNLewD5ZH2N0WMUzdOOCb7mrHpl2hAhuGZyMMeBWJjDby5QaUbGCRu4q1CZGlZ1RR2Jou6Gs Vtyp6ChmSTpDsShBwMK0BKwG5zj9f0+xT4hRLEjWl/YcXNNoq0DG8WeMV9KQqhi5G1YovyFq8E1L EQjGNAwD1IPpqoaNz7DhaXgc2qB0naBdYUoMb+6uIsXkuBiYu3fKfn8wMmthn62oU5wWb0Wnxbd3 ystOZxU5yr4NkkobUxdDhEiFiRGRs1FTarihtolwV71/cGNKipAaCazapwzOSsknRVH9h4OxEXFH J8bYr0kB+3ipJUf58GVjyl7W6IXpDKQckRiViNxQTQwMKeGpFWNgTiM8yhpwW70/sqvyRjRRKoZn 4oakRcW3LbSxWSqItBgeFA9kYmzPV7vZG9jna3CVCqJvtSWvFxvLZCFdVptObkmBbWR+BchQT2pA leQAAr02HNsIq5BIV9WR5R1MYnheSNEfOh/aLVHNyWcJKWA/IAZIzxre7TeAuXoO4PdkV2YWuGq8 xbKDa1JU5WiYqiPsphpjH560UDER7ZGY3omnRrR6qaigVchNrZR9w3N6Skgx2L93cylmA/sFMUBe 6OiQJPK0tPoztbzEllBKXDiXI5z0o4lgBro0wqokTEDHJI3lExaVjKMXSUFFZS0V4teJOq6rglgF IfxMFkvZ19hviAHSy/q3KcOtIKvQdPWIWtFkyeq1PrVaMSZAVxmdpk2hGjgQ7GqgSjxyGJLClBAl Y2XgwjS44zBlBK+GBkR9zMZiaXsbEdp230MvCJ/J+in15srAti3zL/TcjMAqwbYRHzGyxAI5Eca9 AiOhhOwIbWhWZBUbrS6mJ0VNFNWi9KWSWlpK/eO9glohuFh41tgUVdGd/ZIYARjGpfm/U3NqIZIq 9WJMPwgbpZEhctfv0Z6BaRiaruGSVpSxqUlRLgdjG97YyrMPz0JiJNgbqCKGvS9qkWD/R0KMBJFI iJEgEgkxEkQiIUaCSCTESBCJhBgJIpEQI0EkEmIkiERCjASRSIiRIBIJMRJEIiFGgkj8Pzajg3sM SzT+AAAAAElFTkSuQmCC "/> - </g> -</svg> diff --git a/demos/qt3d/shapes/icon-l-qt3d.png b/demos/qt3d/shapes/icon-l-qt3d.png Binary files differdeleted file mode 100644 index 07cc4092..00000000 --- a/demos/qt3d/shapes/icon-l-qt3d.png +++ /dev/null diff --git a/demos/qt3d/shapes/m5-shapes.desktop b/demos/qt3d/shapes/m5-shapes.desktop deleted file mode 100644 index e3ef575d..00000000 --- a/demos/qt3d/shapes/m5-shapes.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Name=Shapes -Comment=Qt3D example application -Exec=/usr/bin/shapes -fullscreen -Icon=icon-l-qt3d -Terminal=false -Type=Application -Categories=Development; -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable -X-Text-Domain=qt3d - diff --git a/demos/qt3d/shapes/qt3d.ico b/demos/qt3d/shapes/qt3d.ico Binary files differdeleted file mode 100644 index 1d07c43d..00000000 --- a/demos/qt3d/shapes/qt3d.ico +++ /dev/null diff --git a/demos/qt3d/shapes/shapes.cpp b/demos/qt3d/shapes/shapes.cpp deleted file mode 100644 index 4da051a3..00000000 --- a/demos/qt3d/shapes/shapes.cpp +++ /dev/null @@ -1,520 +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 "qglpainter.h" -#include "qglbuilder.h" -#include "qglcube.h" -#include "qglteapot.h" -#include "qglcamera.h" -#include "qgltexture2d.h" -#include "qglsubsurface.h" -#include <QApplication> -#include <QImage> -#include <QPainter> -#include <QDebug> -#include <QtGui/QFontDatabase> - -#include <QtGui/QWindow> -#include <QtGui/QOpenGLContext> -#include <QtGui/QSurfaceFormat> - -class ShapesWidget : public QWindow -{ - Q_OBJECT -public: - ShapesWidget(QWindow *parent = 0); - ~ShapesWidget(); - -protected: - void exposeEvent(QExposeEvent *); - - void resizeGL(int w, int h); - void initializeGL(); - void paintGL(); - -private: - void ensureContext(); - - void paintPoints(QGLPainter *painter, const QRect& rect); - void paintLines(QGLPainter *painter, const QRect& rect); - void paintLineStrip(QGLPainter *painter, const QRect& rect); - void paintLineLoop(QGLPainter *painter, const QRect& rect); - void paintTriangles(QGLPainter *painter, const QRect& rect); - void paintTriangleStrip(QGLPainter *painter, const QRect& rect); - void paintTriangleFan(QGLPainter *painter, const QRect& rect); - void paintCube(QGLPainter *painter, const QRect& rect); - void paintTeapot(QGLPainter *painter, const QRect& rect); - void drawText(QGLPainter *painter, const QRect& posn, const QString& str); - - static QVector2DArray basicPoints(const QRect& rect); - - QGLCamera camera; - QGLSceneNode *scene; - QGLSceneNode *cube; - QGLSceneNode *teapot; - QGLLightModel oneSidedModel; - QGLLightModel twoSidedModel; - - QOpenGLContext *context; - bool initialised; - QSurfaceFormat format; -}; - -ShapesWidget::ShapesWidget(QWindow *parent) - : QWindow(parent) - , context(0) - , initialised(false) -{ - setWindowTitle(tr("GL Primitive Shapes")); - format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); - format.setDepthBufferSize(24); - setSurfaceType(QWindow::OpenGLSurface); - setFormat(format); - - oneSidedModel.setModel(QGLLightModel::OneSided); - twoSidedModel.setModel(QGLLightModel::TwoSided); -} - -ShapesWidget::~ShapesWidget() -{ - delete scene; -} - -void ShapesWidget::exposeEvent(QExposeEvent *e) -{ - Q_UNUSED(e); - - ensureContext(); - - QRect rect = geometry(); - resizeGL(rect.width(), rect.height()); - - if (!initialised) - initializeGL(); - - paintGL(); - - if (format.swapBehavior() == QSurfaceFormat::DoubleBuffer) - context->swapBuffers(this); -} - -void ShapesWidget::resizeGL(int w, int h) -{ - glViewport(0, 0, w, h); -} - -void ShapesWidget::initializeGL() -{ - QGLPainter painter; - painter.begin(); - - painter.setLightModel(&twoSidedModel); - painter.setFaceColor(QGL::FrontFaces, QColor(170, 202, 0)); - painter.setFaceColor(QGL::BackFaces, QColor(202, 170, 0)); - - QGLBuilder builder; - builder << QGL::Faceted << QGLCube(); - cube = builder.currentNode(); - builder << QGL::Smooth << QGLTeapot(); - teapot = builder.currentNode(); - scene = builder.finalizedSceneNode(); - - initialised = true; -} - -void ShapesWidget::paintGL() -{ - QGLPainter painter(this); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glDisable(GL_DEPTH_TEST); - - QMatrix4x4 projm; - projm.ortho(geometry()); - painter.projectionMatrix() = projm; - painter.modelViewMatrix().setToIdentity(); - - QRect wrect = geometry(); - int boxw = wrect.width() / 3; - int boxh = wrect.height() / 3; - - paintLines(&painter, QRect(0, 0, boxw, boxh)); - paintLineStrip(&painter, QRect(boxw, 0, boxw, boxh)); - paintLineLoop(&painter, QRect(boxw * 2, 0, boxw, boxh)); - paintTriangles(&painter, QRect(0, boxh, boxw, boxh)); - paintTriangleStrip(&painter, QRect(boxw, boxh, boxw, boxh)); - paintTriangleFan(&painter, QRect(boxw * 2, boxh, boxw, boxh)); - paintPoints(&painter, QRect(0, boxh * 2, boxw, boxh)); - - glEnable(GL_DEPTH_TEST); - - paintCube(&painter, QRect(boxw, boxh * 2, boxw, boxh)); - paintTeapot(&painter, QRect(boxw * 2, boxh * 2, boxw, boxh)); -} - -QVector2DArray ShapesWidget::basicPoints(const QRect& rect) -{ - QVector2DArray vertices; - int step = qMin(rect.width() / 6, rect.height() / 6); - int midx = rect.x() + rect.width() / 2; - int midy = rect.y() + rect.height() / 2; - vertices.append(midx - step * 2, midy - step); - vertices.append(midx + step, midy - step * 2); - vertices.append(midx, midy - step); - vertices.append(midx + step * 2 + step / 2, midy - step / 2); - vertices.append(midx - step, midy); - vertices.append(midx + step * 2, midy + step); - vertices.append(midx - step, midy + step); - vertices.append(midx + step * 2, midy); - return vertices; -} - -void ShapesWidget::paintPoints(QGLPainter *painter, const QRect& rect) -{ - painter->setStandardEffect(QGL::FlatColor); - painter->setColor(QColor(170, 202, 0)); - - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, basicPoints(rect)); - painter->draw(QGL::Points, 8); - - drawText(painter, rect, tr("Points")); -} - -void ShapesWidget::paintLines(QGLPainter *painter, const QRect& rect) -{ - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, basicPoints(rect)); - painter->draw(QGL::Lines, 8); - - drawText(painter, rect, tr("Lines")); -} - -void ShapesWidget::paintLineStrip(QGLPainter *painter, const QRect& rect) -{ - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, basicPoints(rect)); - painter->draw(QGL::LineStrip, 8); - - drawText(painter, rect, tr("Line strip")); -} - -void ShapesWidget::paintLineLoop(QGLPainter *painter, const QRect& rect) -{ - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, basicPoints(rect)); - painter->draw(QGL::LineLoop, 8); - - drawText(painter, rect, tr("Line loop")); -} - -void ShapesWidget::paintTriangles(QGLPainter *painter, const QRect& rect) -{ - painter->setStandardEffect(QGL::LitMaterial); - - QVector2DArray vertices; - QVector3DArray normals; - int step = qMin(rect.width() / 8, rect.height() / 8); - int midx = rect.x() + rect.width() / 2; - int midy = rect.y() + rect.height() / 2; - - vertices.append(midx - step * 3, midy); - vertices.append(midx - step * 3, midy + step * 2); - vertices.append(midx - step, midy + step * 2); - - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - - vertices.append(midx - step * 2, midy - step); - vertices.append(midx + step / 2, midy + step * 2); - vertices.append(midx + step * 3, midy - step); - - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, vertices); - painter->setVertexAttribute(QGL::Normal, normals); - painter->draw(QGL::Triangles, 6); - - drawText(painter, rect, tr("Triangles")); -} - -void ShapesWidget::paintTriangleStrip(QGLPainter *painter, const QRect& rect) -{ - painter->setStandardEffect(QGL::LitMaterial); - - QVector2DArray vertices; - QVector3DArray normals; - int step = qMin(rect.width() / 8, rect.height() / 8); - int midx = rect.x() + rect.width() / 2; - int midy = rect.y() + rect.height() / 2; - - vertices.append(midx - step * 3, midy - step * 2); - vertices.append(midx - step * 3, midy + step); - vertices.append(midx - step, midy - step * 2); - vertices.append(midx, midy + step); - vertices.append(midx + step, midy - step * 2); - vertices.append(midx + step * 2, midy + step * 2); - - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, vertices); - painter->setVertexAttribute(QGL::Normal, normals); - painter->draw(QGL::TriangleStrip, 6); - - // Overpaint some lines to show the triangle boundaries. - painter->clearAttributes(); - painter->setStandardEffect(QGL::FlatColor); - painter->setColor(QColor(202, 170, 0)); - painter->setVertexAttribute(QGL::Position, vertices); - painter->draw(QGL::LineStrip, 4, 1); - - drawText(painter, rect, tr("Triangle strip")); -} - -void ShapesWidget::paintTriangleFan(QGLPainter *painter, const QRect& rect) -{ - painter->setStandardEffect(QGL::LitMaterial); - - QVector2DArray vertices; - QVector3DArray normals; - int step = qMin(rect.width() / 8, rect.height() / 8); - int midx = rect.x() + rect.width() / 2; - int midy = rect.y() + rect.height() / 2; - - vertices.append(midx - step, midy + step); - vertices.append(midx + step * 2, midy + step * 2); - vertices.append(midx + step * 2, midy); - vertices.append(midx + step, midy - step); - vertices.append(midx - step, midy - step * 2); - - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - normals.append(0.0f, 0.0f, 1.0f); - - painter->clearAttributes(); - painter->setVertexAttribute(QGL::Position, vertices); - painter->setVertexAttribute(QGL::Normal, normals); - painter->draw(QGL::TriangleFan, 5); - - // Overpaint some lines to show the triangle boundaries. - painter->clearAttributes(); - painter->setStandardEffect(QGL::FlatColor); - painter->setColor(QColor(202, 170, 0)); - static ushort const indices[] = {0, 2, 0, 3}; - painter->setVertexAttribute(QGL::Position, vertices); - painter->draw(QGL::Lines, indices, 4); - - drawText(painter, rect, tr("Triangle fan")); -} - -void ShapesWidget::paintCube(QGLPainter *painter, const QRect& rect) -{ - painter->setStandardEffect(QGL::LitMaterial); - - painter->projectionMatrix().push(); - painter->modelViewMatrix().push(); - - QGLSubsurface surface(painter->currentSurface(), rect); - painter->pushSurface(&surface); - - painter->setCamera(&camera); - painter->modelViewMatrix().rotate(45.0f, 1.0f, 1.0f, 1.0f); - - cube->draw(painter); - - painter->projectionMatrix().pop(); - painter->modelViewMatrix().pop(); - - painter->popSurface(); - - drawText(painter, rect, tr("Cube")); -} - -void ShapesWidget::paintTeapot(QGLPainter *painter, const QRect& rect) -{ - painter->setStandardEffect(QGL::LitMaterial); - - painter->projectionMatrix().push(); - painter->modelViewMatrix().push(); - - QGLSubsurface surface(painter->currentSurface(), rect); - painter->pushSurface(&surface); - - painter->setCamera(&camera); - - // Need a one-sided lighting model for the teapot. - painter->setLightModel(&oneSidedModel); - - teapot->draw(painter); - - painter->setLightModel(&twoSidedModel); - - painter->projectionMatrix().pop(); - painter->modelViewMatrix().pop(); - - painter->popSurface(); - - drawText(painter, rect, tr("Teapot")); -} - -// Draw text centered on the bottom of the "posn" rectangle. -void ShapesWidget::drawText - (QGLPainter *painter, const QRect& posn, const QString& str) -{ - QFont f = QApplication::font(); - QFontMetrics metrics(f); - QRect rect = metrics.boundingRect(str); - rect.adjust(0, 0, 1, 1); - - QImage image(rect.size(), QImage::Format_ARGB32); - image.fill(0); - QPainter p2(&image); - p2.setFont(f); - p2.setPen(Qt::white); - p2.drawText(-rect.x(), metrics.ascent(), str); - p2.end(); - - QGLTexture2D texture; - texture.setImage(image); - - int x = posn.x() + (posn.width() - rect.width()) / 2; - int y = posn.y() + posn.height() - metrics.ascent() - metrics.descent(); - y -= 10; - - QVector2DArray vertices; - vertices.append(x + rect.x(), y + metrics.ascent()); - vertices.append(x + rect.x(), y - metrics.descent()); - vertices.append(x + rect.x() + rect.width(), y - metrics.descent()); - vertices.append(x + rect.x() + rect.width(), y + metrics.ascent()); - - QVector2DArray texCoord; - texCoord.append(0.0f, 0.0f); - texCoord.append(0.0f, 1.0f); - texCoord.append(1.0f, 1.0f); - texCoord.append(1.0f, 0.0f); - - painter->clearAttributes(); - painter->setStandardEffect(QGL::FlatReplaceTexture2D); - texture.bind(); - painter->setVertexAttribute(QGL::Position, vertices); - painter->setVertexAttribute(QGL::TextureCoord0, texCoord); - painter->draw(QGL::TriangleFan, 4); - painter->setStandardEffect(QGL::FlatColor); - glBindTexture(GL_TEXTURE_2D, 0); -} - -void ShapesWidget::ensureContext() -{ - if (!context) - { - format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); - context = new QOpenGLContext(); - context->setFormat(format); -#ifndef QT_NO_DEBUG_STREAM - QSurfaceFormat oldFormat = format; -#endif - context->create(); - // TODO: is it possible that the platform will downgrade the actual - // format, or will it just fail if it can't deliver the actual format - format = context->format(); -#ifndef QT_NO_DEBUG_STREAM - if (oldFormat.swapBehavior() != format.swapBehavior()) - qWarning() << "Could not create context for swap behavior" - << oldFormat.swapBehavior(); -#endif - context->makeCurrent(this); - } - else - { - context->makeCurrent(this); - } -} - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - ShapesWidget view; - - QStringList args = QCoreApplication::arguments(); - int w_pos = args.indexOf("-width"); - int h_pos = args.indexOf("-height"); - if (w_pos >= 0 && h_pos >= 0) - { - bool ok = true; - int w = args.at(w_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse width argument:" << args; - return 1; - } - int h = args.at(h_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse height argument:" << args; - return 1; - } - view.resize(w, h); - } - else - { - view.resize(800, 600); - } - view.show(); - - return app.exec(); -} - - - -#include "shapes.moc" diff --git a/demos/qt3d/shapes/shapes.desktop b/demos/qt3d/shapes/shapes.desktop deleted file mode 100644 index 7a841e12..00000000 --- a/demos/qt3d/shapes/shapes.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=shapes -Icon=icon-l-qt3d -Exec=/usr/bin/shapes -fullscreen -OnlyShowIn=X-MeeGo; -X-MeeGo-Logical-Id=qtn_comm_appname_shapes -X-MeeGo-Translation-Catalog=essentials diff --git a/demos/qt3d/shapes/shapes.pro b/demos/qt3d/shapes/shapes.pro deleted file mode 100644 index bebc7157..00000000 --- a/demos/qt3d/shapes/shapes.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app -TARGET = shapes -CONFIG += qt warn_on -QT += widgets qt3d - -SOURCES = shapes.cpp - -CONFIG += qt3d_deploy_pkg -include(../../../pkg.pri) - -OTHER_FILES += \ - shapes.rc - -RC_FILE = shapes.rc diff --git a/demos/qt3d/shapes/shapes.rc b/demos/qt3d/shapes/shapes.rc deleted file mode 100644 index b40ecdc1..00000000 --- a/demos/qt3d/shapes/shapes.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "qt3d.ico" diff --git a/demos/qt3d/teaservice/README b/demos/qt3d/teaservice/README deleted file mode 100644 index d7d71a61..00000000 --- a/demos/qt3d/teaservice/README +++ /dev/null @@ -1,7 +0,0 @@ - -This example demonstrates a view with multiple scene objects, plus material -parameters. It shows a teapot, two teacups, and two teaspoons. - -The model source data came from "http://www.sjbaker.org/teapot/teaset.tgz". - -Note: the teacups have no bottoms in the original source data. diff --git a/demos/qt3d/teaservice/icon-l-qt3d.png b/demos/qt3d/teaservice/icon-l-qt3d.png Binary files differdeleted file mode 100644 index 07cc4092..00000000 --- a/demos/qt3d/teaservice/icon-l-qt3d.png +++ /dev/null diff --git a/demos/qt3d/teaservice/m5-teaservice.desktop b/demos/qt3d/teaservice/m5-teaservice.desktop deleted file mode 100644 index be3e241a..00000000 --- a/demos/qt3d/teaservice/m5-teaservice.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Name=Tea Service -Comment=Qt3D example application -Exec=/usr/bin/teaservice -fullscreen -Icon=icon-l-qt3d -Terminal=false -Type=Application -Categories=Development; -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable -X-Text-Domain=qt3d - diff --git a/demos/qt3d/teaservice/meshobject.cpp b/demos/qt3d/teaservice/meshobject.cpp deleted file mode 100644 index f2ef5242..00000000 --- a/demos/qt3d/teaservice/meshobject.cpp +++ /dev/null @@ -1,155 +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 "meshobject.h" -#include "qglview.h" - -MeshObject::MeshObject(QGLSceneNode *meshObject, QObject *parent) - : QObject(parent) -{ - m_mesh = 0; - m_meshObject = meshObject; - m_scale = 1.0f; - m_rotationAngle = 0.0f; - m_effect = 0; - m_objectId = -1; - m_hovering = false; - m_material = 0; - m_hoverMaterial = 0; -} - -MeshObject::MeshObject(QGLAbstractScene *scene, QObject *parent) - : QObject(parent) -{ - scene->setParent(this); - m_mesh = 0; - m_meshObject = scene->mainNode(); - m_scale = 1.0f; - m_rotationAngle = 0.0f; - m_effect = 0; - m_objectId = -1; - m_hovering = false; - m_material = 0; - m_hoverMaterial = 0; -} - -MeshObject::~MeshObject() -{ - delete m_mesh; -} - -void MeshObject::initialize(QGLView *view, QGLPainter *painter) -{ - Q_UNUSED(painter); - if (m_objectId != -1) - view->registerObject(m_objectId, this); -} - -void MeshObject::draw(QGLPainter *painter) -{ - // Position the model at its designated position, scale, and orientation. - painter->modelViewMatrix().push(); - painter->modelViewMatrix().translate(m_position); - if (m_scale != 1.0f) - painter->modelViewMatrix().scale(m_scale); - if (m_rotationAngle != 0.0f) - painter->modelViewMatrix().rotate(m_rotationAngle, m_rotationVector); - - // Apply the material and effect to the painter. - QGLMaterial *material; - if (m_hovering) - material = m_hoverMaterial; - else - material = m_material; - painter->setColor(material->diffuseColor()); - painter->setFaceMaterial(QGL::AllFaces, material); - if (m_effect) - painter->setUserEffect(m_effect); - else - painter->setStandardEffect(QGL::LitMaterial); - - // Mark the object for object picking purposes. - int prevObjectId = painter->objectPickId(); - if (m_objectId != -1) - painter->setObjectPickId(m_objectId); - - // Draw the geometry mesh. - if (m_meshObject) - m_meshObject->draw(painter); - else - m_mesh->draw(painter); - - // Turn off the user effect, if present. - if (m_effect) - painter->setStandardEffect(QGL::LitMaterial); - - // Revert to the previous object identifier. - painter->setObjectPickId(prevObjectId); - - // Restore the modelview matrix. - painter->modelViewMatrix().pop(); -} - -bool MeshObject::event(QEvent *e) -{ - // Convert the raw event into a signal representing the user's action. - if (e->type() == QEvent::MouseButtonPress) { - QMouseEvent *me = (QMouseEvent *)e; - if (me->button() == Qt::LeftButton) - emit pressed(); - } else if (e->type() == QEvent::MouseButtonRelease) { - QMouseEvent *me = (QMouseEvent *)e; - if (me->button() == Qt::LeftButton) { - emit released(); - if (me->x() >= 0) // Positive: inside object, Negative: outside. - emit clicked(); - } - } else if (e->type() == QEvent::MouseButtonDblClick) { - emit doubleClicked(); - } else if (e->type() == QEvent::Enter) { - m_hovering = true; - emit hoverChanged(); - } else if (e->type() == QEvent::Leave) { - m_hovering = false; - emit hoverChanged(); - } - return QObject::event(e); -} diff --git a/demos/qt3d/teaservice/meshobject.h b/demos/qt3d/teaservice/meshobject.h deleted file mode 100644 index 15b62f05..00000000 --- a/demos/qt3d/teaservice/meshobject.h +++ /dev/null @@ -1,117 +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 MESHOBJECT_H -#define MESHOBJECT_H - -#include <QtCore/qobject.h> -#include <QtGui/qevent.h> - -#include "qglpainter.h" -#include "qglabstractscene.h" - -QT_BEGIN_NAMESPACE -class QGLView; -class QGLSceneNode; -QT_END_NAMESPACE - -class MeshObject : public QObject -{ - Q_OBJECT -public: - explicit MeshObject(QGLSceneNode *meshObject, QObject *parent=0); - explicit MeshObject(QGLAbstractScene *scene, QObject *parent=0); - virtual ~MeshObject(); - - QVector3D position() const { return m_position; } - void setPosition(const QVector3D& value) { m_position = value; } - - qreal scale() const { return m_scale; } - void setScale(qreal value) { m_scale = value; } - - qreal rotationAngle() const { return m_rotationAngle; } - void setRotationAngle(qreal value) { m_rotationAngle = value; } - - QVector3D rotationVector() const { return m_rotationVector; } - void setRotationVector(const QVector3D& value) { m_rotationVector = value; } - - QGLMaterial *material() const { return m_material; } - void setMaterial(QGLMaterial *value) - { m_material = value; m_hoverMaterial = value; } - - QGLMaterial *hoverMaterial() const { return m_hoverMaterial; } - void setHoverMaterial(QGLMaterial *value) { m_hoverMaterial = value; } - - QGLAbstractEffect *effect() const { return m_effect; } - void setEffect(QGLAbstractEffect *value) { m_effect = value; } - - int objectId() const { return m_objectId; } - void setObjectId(int id) { m_objectId = id; } - - void initialize(QGLView *view, QGLPainter *painter); - void draw(QGLPainter *painter); - -signals: - void pressed(); - void released(); - void clicked(); - void doubleClicked(); - void hoverChanged(); - -protected: - bool event(QEvent *e); - -private: - QGLSceneNode *m_mesh; - QGLSceneNode *m_meshObject; - QGLAbstractScene *m_scene; - QVector3D m_position; - qreal m_scale; - qreal m_rotationAngle; - QVector3D m_rotationVector; - QGLMaterial *m_material; - QGLMaterial *m_hoverMaterial; - QGLAbstractEffect *m_effect; - int m_objectId; - bool m_hovering; -}; - -#endif diff --git a/demos/qt3d/teaservice/per_pixel_lighting.fsh b/demos/qt3d/teaservice/per_pixel_lighting.fsh deleted file mode 100644 index d97a0461..00000000 --- a/demos/qt3d/teaservice/per_pixel_lighting.fsh +++ /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$ -** -****************************************************************************/ - -// Per-pixel lighting - fragment shader side. - -struct qt_MaterialParameters { - mediump vec4 emission; - mediump vec4 ambient; - mediump vec4 diffuse; - mediump vec4 specular; - mediump float shininess; -}; -uniform qt_MaterialParameters qt_Material; - -struct qt_SingleLightParameters { - mediump vec4 position; - mediump vec3 spotDirection; - mediump float spotExponent; - mediump float spotCutoff; - mediump float spotCosCutoff; - mediump float constantAttenuation; - mediump float linearAttenuation; - mediump float quadraticAttenuation; -}; -uniform qt_SingleLightParameters qt_Light; - -varying mediump vec3 qNormal; -varying mediump vec3 qLightDirection; -varying mediump vec3 qHalfVector; -varying mediump vec3 qVertexToLight; -varying mediump vec4 qAmbient; -varying mediump vec4 qDiffuse; - -vec4 qLightPixel(vec4 ambient, vec4 diffuse) -{ - float angle, spot; - vec4 color; - vec4 component; - vec3 normal = normalize(qNormal); - - // Start with the ambient color. - color = ambient; - - // Determine the cosine of the angle between the normal and the - // vector from the vertex to the light. - angle = max(dot(normal, qLightDirection), 0.0); - - // Calculate the diffuse light components. - component = angle * diffuse; - - // Calculate the specular light components. - if (angle != 0.0) { - angle = max(dot(normal, qHalfVector), 0.0); - component += pow(angle, qt_Material.shininess) * qt_Material.specular; - } - - // Apply the spotlight angle and exponent. - if (qt_Light.spotCutoff != 180.0) { - spot = max(dot(normalize(qVertexToLight), - normalize(qt_Light.spotDirection)), 0.0); - if (spot < qt_Light.spotCosCutoff) - spot = 0.0; - else - spot = pow(spot, qt_Light.spotExponent); - component *= spot; - } - - return clamp(color + component, 0.0, 1.0); -} - -void main(void) -{ - gl_FragColor = qLightPixel(qAmbient, qDiffuse); -} diff --git a/demos/qt3d/teaservice/per_pixel_lighting.vsh b/demos/qt3d/teaservice/per_pixel_lighting.vsh deleted file mode 100644 index d5157840..00000000 --- a/demos/qt3d/teaservice/per_pixel_lighting.vsh +++ /dev/null @@ -1,96 +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$ -** -****************************************************************************/ - -// Per-pixel lighting - vertex shader side. - -attribute highp vec4 qt_Vertex; -attribute mediump vec3 qt_Normal; -uniform mediump mat4 qt_ModelViewMatrix; -uniform mediump mat4 qt_ModelViewProjectionMatrix; -uniform mediump mat3 qt_NormalMatrix; - -struct qt_MaterialParameters { - mediump vec4 emission; - mediump vec4 ambient; - mediump vec4 diffuse; - mediump vec4 specular; - mediump float shininess; -}; -uniform qt_MaterialParameters qt_Material; - -struct qt_SingleLightParameters { - mediump vec4 position; - mediump vec3 spotDirection; - mediump float spotExponent; - mediump float spotCutoff; - mediump float spotCosCutoff; - mediump float constantAttenuation; - mediump float linearAttenuation; - mediump float quadraticAttenuation; -}; -uniform qt_SingleLightParameters qt_Light; - -varying mediump vec4 qAmbient; -varying mediump vec4 qDiffuse; -varying mediump vec3 qNormal; -varying mediump vec3 qLightDirection; -varying mediump vec3 qHalfVector; -varying mediump vec3 qVertexToLight; - -void qLightVertex(vec4 vertex, vec3 normal) -{ - vec3 toEye; - qNormal = normal; - qAmbient = qt_Material.emission + qt_Material.ambient; - qDiffuse = qt_Material.diffuse; - qLightDirection = normalize(qt_Light.position.xyz); - toEye = vec3(0, 0, 1); - qHalfVector = normalize(qLightDirection + toEye); - qVertexToLight = vertex.xyz - qt_Light.position.xyz; -} - -void main(void) -{ - gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; - vec4 vertex = qt_ModelViewMatrix * qt_Vertex; - vec3 normal = normalize(qt_NormalMatrix * qt_Normal); - qLightVertex(vertex, normal); -} diff --git a/demos/qt3d/teaservice/perpixeleffect.cpp b/demos/qt3d/teaservice/perpixeleffect.cpp deleted file mode 100644 index fc3a4260..00000000 --- a/demos/qt3d/teaservice/perpixeleffect.cpp +++ /dev/null @@ -1,52 +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 "perpixeleffect.h" - -PerPixelEffect::PerPixelEffect() -{ - setVertexShaderFromFile(":per_pixel_lighting.vsh"); - setFragmentShaderFromFile(":per_pixel_lighting.fsh"); -} - -PerPixelEffect::~PerPixelEffect() -{ -} diff --git a/demos/qt3d/teaservice/perpixeleffect.h b/demos/qt3d/teaservice/perpixeleffect.h deleted file mode 100644 index dd265f2a..00000000 --- a/demos/qt3d/teaservice/perpixeleffect.h +++ /dev/null @@ -1,58 +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 PERPIXELEFFECT_H -#define PERPIXELEFFECT_H - -#include "qglshaderprogrameffect.h" - -class PerPixelEffectPrivate; -class QGLShader; - -class PerPixelEffect : public QGLShaderProgramEffect -{ - Q_DISABLE_COPY(PerPixelEffect); -public: - PerPixelEffect(); - virtual ~PerPixelEffect(); -}; - -#endif diff --git a/demos/qt3d/teaservice/qt3d.ico b/demos/qt3d/teaservice/qt3d.ico Binary files differdeleted file mode 100644 index 1d07c43d..00000000 --- a/demos/qt3d/teaservice/qt3d.ico +++ /dev/null diff --git a/demos/qt3d/teaservice/sceneobject.cpp b/demos/qt3d/teaservice/sceneobject.cpp deleted file mode 100644 index 0c7ec4ed..00000000 --- a/demos/qt3d/teaservice/sceneobject.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtQuick3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "sceneobject.h" -#include "meshobject.h" - -SceneObject::SceneObject(QObject *parent) - : QObject(parent) -{ -} - -SceneObject::~SceneObject() -{ -} - -void SceneObject::initialize(QGLView *view, QGLPainter *painter) -{ - // Initialize all of the mesh objects that we have as children. - foreach (QObject *obj, children()) { - MeshObject *meshobj = qobject_cast<MeshObject *>(obj); - if (meshobj) - meshobj->initialize(view, painter); - } -} - -void SceneObject::draw(QGLPainter *painter) -{ - // Draw all of the mesh objects that we have as children. - foreach (QObject *obj, children()) { - MeshObject *meshobj = qobject_cast<MeshObject *>(obj); - if (meshobj) - meshobj->draw(painter); - } -} diff --git a/demos/qt3d/teaservice/sceneobject.h b/demos/qt3d/teaservice/sceneobject.h deleted file mode 100644 index 0e3a3323..00000000 --- a/demos/qt3d/teaservice/sceneobject.h +++ /dev/null @@ -1,63 +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 SCENEOBJECT_H -#define SCENEOBJECT_H - -#include <QtCore/qobject.h> -#include "qglpainter.h" - -QT_BEGIN_NAMESPACE -class QGLView; -QT_END_NAMESPACE - -class SceneObject : public QObject -{ - Q_OBJECT -public: - explicit SceneObject(QObject *parent=0); - virtual ~SceneObject(); - - virtual void initialize(QGLView *view, QGLPainter *painter); - virtual void draw(QGLPainter *painter); -}; - -#endif diff --git a/demos/qt3d/teaservice/teacup.txt b/demos/qt3d/teaservice/teacup.txt deleted file mode 100644 index f4dde3ef..00000000 --- a/demos/qt3d/teaservice/teacup.txt +++ /dev/null @@ -1,280 +0,0 @@ -26 -1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 -4,17,18,19,8,20,21,22,12,23,24,25,16,26,27,28 -19,29,30,31,22,32,33,34,25,35,36,37,28,38,39,40 -31,41,42,1,34,43,44,5,37,45,46,9,40,47,48,13 -13,14,15,16,49,50,51,52,53,54,55,56,57,58,59,60 -16,26,27,28,52,61,62,63,56,64,65,66,60,67,68,69 -28,38,39,40,63,70,71,72,66,73,74,75,69,76,77,78 -40,47,48,13,72,79,80,49,75,81,82,53,78,83,84,57 -193,194,195,196,197,198,199,200,201,202,203,204,1,2,3,4 -196,205,206,207,200,208,209,210,204,211,212,213,4,17,18,19 -207,214,215,216,210,217,218,219,213,220,221,222,19,29,30,31 -216,223,224,193,219,225,226,197,222,227,228,201,31,41,42,1 -229,230,231,28,232,233,234,235,236,237,238,239,240,241,242,243 -28,244,245,229,235,246,247,232,239,248,249,236,243,250,251,240 -57,58,59,60,85,86,87,88,89,90,91,92,93,94,95,96 -60,67,68,69,88,97,98,99,92,100,101,102,96,103,104,105 -69,76,77,78,99,106,107,108,102,109,110,111,105,112,113,114 -78,83,84,57,108,115,116,85,111,117,118,89,114,119,120,93 -93,94,95,96,121,122,123,124,125,126,127,128,129,130,131,132 -96,103,104,105,124,133,134,135,128,136,137,138,132,139,140,141 -105,112,113,114,135,142,143,144,138,145,146,147,141,148,149,150 -114,119,120,93,144,151,152,121,147,153,154,125,150,155,156,129 -129,130,131,132,157,158,159,160,161,162,163,164,165,166,167,168 -132,139,140,141,160,169,170,171,164,172,173,174,168,175,176,177 -141,148,149,150,171,178,179,180,174,181,182,183,177,184,185,186 -150,155,156,129,180,187,188,157,183,189,190,161,186,191,192,165 -251 -0.409091,0.772727,0.0 -0.409091,0.772727,-0.229091 -0.229091,0.772727,-0.409091 -0.0,0.772727,-0.409091 -0.409091,0.886364,0.0 -0.409091,0.886364,-0.229091 -0.229091,0.886364,-0.409091 -0.0,0.886364,-0.409091 -0.454545,0.886364,0.0 -0.454545,0.886364,-0.254545 -0.254545,0.886364,-0.454545 -0.0,0.886364,-0.454545 -0.454545,0.772727,0.0 -0.454545,0.772727,-0.254545 -0.254545,0.772727,-0.454545 -0.0,0.772727,-0.454545 --0.229091,0.772727,-0.409091 --0.409091,0.772727,-0.229091 --0.409091,0.772727,0.0 --0.229091,0.886364,-0.409091 --0.409091,0.886364,-0.229091 --0.409091,0.886364,0.0 --0.254545,0.886364,-0.454545 --0.454545,0.886364,-0.254545 --0.454545,0.886364,0.0 --0.254545,0.772727,-0.454545 --0.454545,0.772727,-0.254545 --0.454545,0.772727,0.0 --0.409091,0.772727,0.229091 --0.229091,0.772727,0.409091 -0.0,0.772727,0.409091 --0.409091,0.886364,0.229091 --0.229091,0.886364,0.409091 -0.0,0.886364,0.409091 --0.454545,0.886364,0.254545 --0.254545,0.886364,0.454545 -0.0,0.886364,0.454545 --0.454545,0.772727,0.254545 --0.254545,0.772727,0.454545 -0.0,0.772727,0.454545 -0.229091,0.772727,0.409091 -0.409091,0.772727,0.229091 -0.229091,0.886364,0.409091 -0.409091,0.886364,0.229091 -0.254545,0.886364,0.454545 -0.454545,0.886364,0.254545 -0.254545,0.772727,0.454545 -0.454545,0.772727,0.254545 -0.454545,0.545455,0.0 -0.454545,0.545455,-0.254545 -0.254545,0.545455,-0.454545 -0.0,0.545455,-0.454545 -0.454545,0.272727,0.0 -0.454545,0.272727,-0.254545 -0.254545,0.272727,-0.454545 -0.0,0.272727,-0.454545 -0.318182,0.0454545,0.0 -0.318182,0.0454545,-0.178182 -0.178182,0.0454545,-0.318182 -0.0,0.0454545,-0.318182 --0.254545,0.545455,-0.454545 --0.454545,0.545455,-0.254545 --0.454545,0.545455,0.0 --0.254545,0.272727,-0.454545 --0.454545,0.272727,-0.254545 --0.454545,0.272727,0.0 --0.178182,0.0454545,-0.318182 --0.318182,0.0454545,-0.178182 --0.318182,0.0454545,0.0 --0.454545,0.545455,0.254545 --0.254545,0.545455,0.454545 -0.0,0.545455,0.454545 --0.454545,0.272727,0.254545 --0.254545,0.272727,0.454545 -0.0,0.272727,0.454545 --0.318182,0.0454545,0.178182 --0.178182,0.0454545,0.318182 -0.0,0.0454545,0.318182 -0.254545,0.545455,0.454545 -0.454545,0.545455,0.254545 -0.254545,0.272727,0.454545 -0.454545,0.272727,0.254545 -0.178182,0.0454545,0.318182 -0.318182,0.0454545,0.178182 -0.545455,0.0454545,0.0 -0.545455,0.0454545,-0.305455 -0.305455,0.0454545,-0.545455 -0.0,0.0454545,-0.545455 -0.727273,0.136364,0.0 -0.727273,0.136364,-0.407273 -0.407273,0.136364,-0.727273 -0.0,0.136364,-0.727273 -0.909091,0.136364,0.0 -0.909091,0.136364,-0.509091 -0.509091,0.136364,-0.909091 -0.0,0.136364,-0.909091 --0.305455,0.0454545,-0.545455 --0.545455,0.0454545,-0.305455 --0.545455,0.0454545,0.0 --0.407273,0.136364,-0.727273 --0.727273,0.136364,-0.407273 --0.727273,0.136364,0.0 --0.509091,0.136364,-0.909091 --0.909091,0.136364,-0.509091 --0.909091,0.136364,0.0 --0.545455,0.0454545,0.305455 --0.305455,0.0454545,0.545455 -0.0,0.0454545,0.545455 --0.727273,0.136364,0.407273 --0.407273,0.136364,0.727273 -0.0,0.136364,0.727273 --0.909091,0.136364,0.509091 --0.509091,0.136364,0.909091 -0.0,0.136364,0.909091 -0.305455,0.0454545,0.545455 -0.545455,0.0454545,0.305455 -0.407273,0.136364,0.727273 -0.727273,0.136364,0.407273 -0.509091,0.136364,0.909091 -0.909091,0.136364,0.509091 -1.0,0.136364,0.0 -1.0,0.136364,-0.56 -0.56,0.136364,-1.0 -0.0,0.136364,-1.0 -1.0,0.0909091,0.0 -1.0,0.0909091,-0.56 -0.56,0.0909091,-1.0 -0.0,0.0909091,-1.0 -0.909091,0.0909091,0.0 -0.909091,0.0909091,-0.509091 -0.509091,0.0909091,-0.909091 -0.0,0.0909091,-0.909091 --0.56,0.136364,-1.0 --1.0,0.136364,-0.56 --1.0,0.136364,0.0 --0.56,0.0909091,-1.0 --1.0,0.0909091,-0.56 --1.0,0.0909091,0.0 --0.509091,0.0909091,-0.909091 --0.909091,0.0909091,-0.509091 --0.909091,0.0909091,0.0 --1.0,0.136364,0.56 --0.56,0.136364,1.0 -0.0,0.136364,1.0 --1.0,0.0909091,0.56 --0.56,0.0909091,1.0 -0.0,0.0909091,1.0 --0.909091,0.0909091,0.509091 --0.509091,0.0909091,0.909091 -0.0,0.0909091,0.909091 -0.56,0.136364,1.0 -1.0,0.136364,0.56 -0.56,0.0909091,1.0 -1.0,0.0909091,0.56 -0.509091,0.0909091,0.909091 -0.909091,0.0909091,0.509091 -0.727273,0.0909091,0.0 -0.727273,0.0909091,-0.407273 -0.407273,0.0909091,-0.727273 -0.0,0.0909091,-0.727273 -0.545455,0.0,0.0 -0.545455,0.0,-0.305455 -0.305455,0.0,-0.545455 -0.0,0.0,-0.545455 -0.318182,0.0,0.0 -0.318182,0.0,-0.178182 -0.178182,0.0,-0.318182 -0.0,0.0,-0.318182 --0.407273,0.0909091,-0.727273 --0.727273,0.0909091,-0.407273 --0.727273,0.0909091,0.0 --0.305455,0.0,-0.545455 --0.545455,0.0,-0.305455 --0.545455,0.0,0.0 --0.178182,0.0,-0.318182 --0.318182,0.0,-0.178182 --0.318182,0.0,0.0 --0.727273,0.0909091,0.407273 --0.407273,0.0909091,0.727273 -0.0,0.0909091,0.727273 --0.545455,0.0,0.305455 --0.305455,0.0,0.545455 -0.0,0.0,0.545455 --0.318182,0.0,0.178182 --0.178182,0.0,0.318182 -0.0,0.0,0.318182 -0.407273,0.0909091,0.727273 -0.727273,0.0909091,0.407273 -0.305455,0.0,0.545455 -0.545455,0.0,0.305455 -0.178182,0.0,0.318182 -0.318182,0.0,0.178182 -0.272727,0.0454545,0.0 -0.272727,0.0454545,-0.152727 -0.152727,0.0454545,-0.272727 -0.0,0.0454545,-0.272727 -0.409091,0.272727,0.0 -0.409091,0.272727,-0.229091 -0.229091,0.272727,-0.409091 -0.0,0.272727,-0.409091 -0.409091,0.545455,0.0 -0.409091,0.545455,-0.229091 -0.229091,0.545455,-0.409091 -0.0,0.545455,-0.409091 --0.152727,0.0454545,-0.272727 --0.272727,0.0454545,-0.152727 --0.272727,0.0454545,0.0 --0.229091,0.272727,-0.409091 --0.409091,0.272727,-0.229091 --0.409091,0.272727,0.0 --0.229091,0.545455,-0.409091 --0.409091,0.545455,-0.229091 --0.409091,0.545455,0.0 --0.272727,0.0454545,0.152727 --0.152727,0.0454545,0.272727 -0.0,0.0454545,0.272727 --0.409091,0.272727,0.229091 --0.229091,0.272727,0.409091 -0.0,0.272727,0.409091 --0.409091,0.545455,0.229091 --0.229091,0.545455,0.409091 -0.0,0.545455,0.409091 -0.152727,0.0454545,0.272727 -0.272727,0.0454545,0.152727 -0.229091,0.272727,0.409091 -0.409091,0.272727,0.229091 -0.229091,0.545455,0.409091 -0.409091,0.545455,0.229091 --0.454545,0.704545,0.0 --0.454545,0.704545,-0.0454545 --0.454545,0.772727,-0.0454545 --0.772727,0.863636,0.0 --0.772727,0.863636,-0.0454545 --0.818182,0.954545,-0.0454545 --0.818182,0.954545,0.0 --0.772727,0.522727,0.0 --0.772727,0.522727,-0.0454545 --0.909091,0.477273,-0.0454545 --0.909091,0.477273,0.0 --0.409091,0.363636,0.0 --0.409091,0.363636,-0.0454545 --0.409091,0.295455,-0.0454545 --0.409091,0.295455,0.0 --0.454545,0.772727,0.0454545 --0.454545,0.704545,0.0454545 --0.818182,0.954545,0.0454545 --0.772727,0.863636,0.0454545 --0.909091,0.477273,0.0454545 --0.772727,0.522727,0.0454545 --0.409091,0.295455,0.0454545 --0.409091,0.363636,0.0454545 -# reverse-patches diff --git a/demos/qt3d/teaservice/teaservice.cpp b/demos/qt3d/teaservice/teaservice.cpp deleted file mode 100644 index 560ea364..00000000 --- a/demos/qt3d/teaservice/teaservice.cpp +++ /dev/null @@ -1,394 +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 <QApplication> -#include <QMainWindow> -#include <QMenu> -#include <QMenuBar> -#include <QKeyEvent> -#include <QAction> -#include <QDebug> -#include <QtCore/QTimer> - -#include "qglview.h" -#include "meshobject.h" -#include "sceneobject.h" -#include "qglteapot.h" -#include "qglbuilder.h" -#include "perpixeleffect.h" - -enum { - ObjTeapot, - ObjTeacup1, - ObjTeacup2, - ObjTeaspoon1, - ObjTeaspoon2 -}; - -class Teapot : public MeshObject -{ - Q_OBJECT -public: - Teapot(QObject *parent=0); - ~Teapot() {} -}; - -static QGLSceneNode *createTeapot(QObject *parent) -{ - QGLBuilder builder; - builder << QGLTeapot(); - QGLSceneNode *n = builder.finalizedSceneNode(); - n->setParent(parent); - return n; -} - -Teapot::Teapot(QObject *parent) - : MeshObject(createTeapot(parent), parent) -{ -} - -class Teacup : public MeshObject -{ - Q_OBJECT -public: - Teacup(QObject *parent=0); - ~Teacup() {} -}; - -static QGLAbstractScene *loadBezier(const QString& fileName) -{ - QGLAbstractScene *scene; - scene = QGLAbstractScene::loadScene(fileName, QLatin1String("bezier")); - if (!scene) - qFatal("Could not load %s, probably plugin could not be found", - fileName.toLatin1().constData()); - return scene; -} - -Teacup::Teacup(QObject *parent) - : MeshObject(loadBezier(QLatin1String(":/teacup.txt")), parent) -{ -} - -class Teaspoon : public MeshObject -{ - Q_OBJECT -public: - Teaspoon(QObject *parent=0); - ~Teaspoon() {} -}; - -Teaspoon::Teaspoon(QObject *parent) - : MeshObject(loadBezier(QLatin1String(":/teaspoon.txt")), parent) -{ -} - -class TeaService : public QObject -{ - Q_OBJECT -public: - TeaService(QObject *parent=0); - ~TeaService(); - - SceneObject *service; - - Teapot *teapot; - Teacup *teacup1; - Teacup *teacup2; - Teaspoon *teaspoon1; - Teaspoon *teaspoon2; - PerPixelEffect *lighting; - - void changeMaterials(bool perPixel); - -signals: - void changed(); - -private slots: - void teapotClicked(); - void teacup1Clicked(); - void teacup2Clicked(); - void teaspoon1Clicked(); - void teaspoon2Clicked(); - -private: - QGLMaterial *china; - QGLMaterial *chinaHighlight; - QGLMaterial *metal; - QGLMaterial *metalHighlight; -}; - -TeaService::TeaService(QObject *parent) - : QObject(parent) -{ - china = new QGLMaterial(this); - china->setAmbientColor(QColor(192, 150, 128)); - china->setSpecularColor(QColor(60, 60, 60)); - china->setShininess(128); - - chinaHighlight = new QGLMaterial(this); - chinaHighlight->setAmbientColor(QColor(255, 192, 0)); - chinaHighlight->setSpecularColor(QColor(60, 60, 0)); - chinaHighlight->setShininess(128); - - metal = new QGLMaterial(this); - metal->setAmbientColor(QColor(255, 255, 255)); - metal->setDiffuseColor(QColor(150, 150, 150)); - metal->setSpecularColor(QColor(255, 255, 255)); - metal->setShininess(128); - - metalHighlight = new QGLMaterial(this); - metalHighlight->setAmbientColor(QColor(255, 255, 96)); - metalHighlight->setDiffuseColor(QColor(150, 150, 96)); - metalHighlight->setSpecularColor(QColor(255, 255, 255)); - metalHighlight->setShininess(128); - - service = new SceneObject(this); - teapot = new Teapot(service); - teacup1 = new Teacup(service); - teacup2 = new Teacup(service); - teacup1->setPosition(QVector3D(-2.3f, -0.75f, 0.0f)); - teacup2->setRotationAngle(180); - teacup2->setRotationVector(QVector3D(0, 1, 0)); - teacup2->setPosition(QVector3D(2.3f, -0.75f, 0.0f)); - teaspoon1 = new Teaspoon(service); - teaspoon2 = new Teaspoon(service); - teaspoon1->setRotationAngle(275); - teaspoon1->setRotationVector(QVector3D(1, 0, 0)); - teaspoon1->setPosition(QVector3D(-1.7f, -0.58f, 0.0f)); - teaspoon2->setRotationAngle(275); - teaspoon2->setRotationVector(QVector3D(1, 0, 0)); - teaspoon2->setPosition(QVector3D(1.7f, -0.58f, 0.0f)); - - teapot->setObjectId(ObjTeapot); - teacup1->setObjectId(ObjTeacup1); - teacup2->setObjectId(ObjTeacup2); - teaspoon1->setObjectId(ObjTeaspoon1); - teaspoon2->setObjectId(ObjTeaspoon2); - - lighting = new PerPixelEffect(); - changeMaterials(false); - - connect(teapot, SIGNAL(hoverChanged()), this, SIGNAL(changed())); - connect(teacup1, SIGNAL(hoverChanged()), this, SIGNAL(changed())); - connect(teacup2, SIGNAL(hoverChanged()), this, SIGNAL(changed())); - connect(teaspoon1, SIGNAL(hoverChanged()), this, SIGNAL(changed())); - connect(teaspoon2, SIGNAL(hoverChanged()), this, SIGNAL(changed())); - - connect(teapot, SIGNAL(clicked()), this, SLOT(teapotClicked())); - connect(teacup1, SIGNAL(clicked()), this, SLOT(teacup1Clicked())); - connect(teacup2, SIGNAL(clicked()), this, SLOT(teacup2Clicked())); - connect(teaspoon1, SIGNAL(clicked()), this, SLOT(teaspoon1Clicked())); - connect(teaspoon2, SIGNAL(clicked()), this, SLOT(teaspoon2Clicked())); -} - -TeaService::~TeaService() -{ - delete lighting; -} - -void TeaService::changeMaterials(bool perPixel) -{ - teapot->setMaterial(china); - teapot->setHoverMaterial(chinaHighlight); - teacup1->setMaterial(china); - teacup1->setHoverMaterial(chinaHighlight); - teacup2->setMaterial(china); - teacup2->setHoverMaterial(chinaHighlight); - if (perPixel) { - teapot->setEffect(lighting); - teacup1->setEffect(lighting); - teacup2->setEffect(lighting); - } else - { - teapot->setEffect(0); - teacup1->setEffect(0); - teacup2->setEffect(0); - } - - teaspoon1->setMaterial(metal); - teaspoon1->setHoverMaterial(metalHighlight); - teaspoon2->setMaterial(metal); - teaspoon2->setHoverMaterial(metalHighlight); - if (perPixel) { - teaspoon1->setEffect(lighting); - teaspoon2->setEffect(lighting); - } else - { - teaspoon1->setEffect(0); - teaspoon2->setEffect(0); - } -} - -void TeaService::teapotClicked() -{ - qDebug("teapot clicked"); -} - -void TeaService::teacup1Clicked() -{ - qDebug("teacup1 clicked"); -} - -void TeaService::teacup2Clicked() -{ - qDebug("teacup2 clicked"); -} - -void TeaService::teaspoon1Clicked() -{ - qDebug("teaspoon1 clicked"); -} - -void TeaService::teaspoon2Clicked() -{ - qDebug("teaspoon2 clicked"); -} - -class TeaServiceView : public QGLView -{ - Q_OBJECT -public: - TeaServiceView(QWindow *parent=0); - -public slots: - void standardLighting(); - void perPixelLighting(); - -protected: - void initializeGL(QGLPainter *painter); - void paintGL(QGLPainter *painter); - void keyPressEvent(QKeyEvent *e); - -private: - TeaService *teaService; -}; - -TeaServiceView::TeaServiceView(QWindow *parent) - : QGLView(parent) -{ - teaService = new TeaService(this); - - setOption(QGLView::ObjectPicking, true); - - connect(teaService, SIGNAL(changed()), this, SLOT(update())); -} - -void TeaServiceView::initializeGL(QGLPainter *painter) -{ - teaService->service->initialize(this, painter); -} - -void TeaServiceView::paintGL(QGLPainter *painter) -{ - teaService->service->draw(painter); -} - -void TeaServiceView::standardLighting() -{ - teaService->changeMaterials(false); - update(); -} - -void TeaServiceView::perPixelLighting() -{ - teaService->changeMaterials(true); - update(); -} - -void TeaServiceView::keyPressEvent(QKeyEvent *e) -{ - if (e->key() == Qt::Key_Tab) { - // The Tab key turns the ShowPicking option on and off, - // which helps show what the pick buffer looks like. - setOption(QGLView::ShowPicking, ((options() & QGLView::ShowPicking) == 0)); - update(); - } - QGLView::keyPressEvent(e); -} - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - TeaServiceView view; - QStringList args = QCoreApplication::arguments(); - int w_pos = args.indexOf("-width"); - int h_pos = args.indexOf("-height"); - if (w_pos >= 0 && h_pos >= 0) - { - bool ok = true; - int w = args.at(w_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse width argument:" << args; - return 1; - } - int h = args.at(h_pos + 1).toInt(&ok); - if (!ok) - { - qWarning() << "Could not parse height argument:" << args; - return 1; - } - view.resize(w, h); - } - else - { - view.resize(800, 600); - } - view.show(); - - // TODO: QWindow has no setFocus function - // view.setFocus(); - - view.camera()->setEye(QVector3D(0, 3, 10)); - - if (args.contains("-per-pixel-lighting")) - { - QTimer::singleShot(0, &view, SLOT(perPixelLighting())); - } - - view.show(); - - return app.exec(); -} - -#include "teaservice.moc" diff --git a/demos/qt3d/teaservice/teaservice.desktop b/demos/qt3d/teaservice/teaservice.desktop deleted file mode 100644 index 2d49ae2f..00000000 --- a/demos/qt3d/teaservice/teaservice.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Tea Service -Icon=icon-l-qt3d -Exec=/usr/bin/teaservice -fullscreen -OnlyShowIn=X-MeeGo; -X-MeeGo-Logical-Id=qtn_comm_appname_teaservice -X-MeeGo-Translation-Catalog=essentials diff --git a/demos/qt3d/teaservice/teaservice.pro b/demos/qt3d/teaservice/teaservice.pro deleted file mode 100644 index 650fe030..00000000 --- a/demos/qt3d/teaservice/teaservice.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = app -TARGET = teaservice -CONFIG += qt warn_on -QT += widgets - -include(../../../pkg.pri) -QT += qt3d - -SOURCES = teaservice.cpp meshobject.cpp sceneobject.cpp perpixeleffect.cpp -HEADERS = meshobject.h sceneobject.h perpixeleffect.h -RESOURCES = teaservice.qrc - -CONFIG += qt3d_deploy_pkg -include(../../../pkg.pri) - -OTHER_FILES += \ - teaservice.rc - -RC_FILE = teaservice.rc diff --git a/demos/qt3d/teaservice/teaservice.qrc b/demos/qt3d/teaservice/teaservice.qrc deleted file mode 100644 index ab55d88c..00000000 --- a/demos/qt3d/teaservice/teaservice.qrc +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>per_pixel_lighting.vsh</file> - <file>per_pixel_lighting.fsh</file> - <file>teacup.txt</file> - <file>teaspoon.txt</file> -</qresource> -</RCC> diff --git a/demos/qt3d/teaservice/teaservice.rc b/demos/qt3d/teaservice/teaservice.rc deleted file mode 100644 index b40ecdc1..00000000 --- a/demos/qt3d/teaservice/teaservice.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "qt3d.ico" diff --git a/demos/qt3d/teaservice/teaspoon.txt b/demos/qt3d/teaservice/teaspoon.txt deleted file mode 100644 index 3c6a1b74..00000000 --- a/demos/qt3d/teaservice/teaspoon.txt +++ /dev/null @@ -1,275 +0,0 @@ -16 -1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 -17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 -33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48 -49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64 -65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80 -81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96 -97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112 -113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128 -129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144 -145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160 -161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176 -177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192 -193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208 -209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224 -225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240 -241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256 -256 --0.000107143,0.205357,0.0 -0.0,0.196429,-0.0178571 -0.0,0.196429,-0.0178571 -0.000107143,0.205357,0.0 --0.0535714,0.205357,0.0 --0.0222714,0.178571,-0.0534286 -0.0222714,0.178571,-0.0534286 -0.0535714,0.205357,0.0 --0.107143,0.0952429,-0.0178571 --0.0446429,0.0952429,-0.0892857 -0.0446429,0.0952429,-0.0892857 -0.107143,0.0952429,-0.0178571 --0.107143,0.0,-0.0178571 --0.0446429,0.0,-0.0892857 -0.0446429,0.0,-0.0892857 -0.107143,0.0,-0.0178571 -0.000107143,0.205357,0.0 -0.000135714,0.207589,0.00446429 -0.000157143,0.216518,0.00446429 -0.000125,0.214286,0.0 -0.0535714,0.205357,0.0 -0.0613964,0.212054,0.0133571 -0.0714286,0.220982,0.015625 -0.0625,0.214286,0.0 -0.107143,0.0952429,-0.0178571 -0.122768,0.0952429,0.0 -0.142857,0.0952429,0.00446429 -0.125,0.0952429,-0.0178571 -0.107143,0.0,-0.0178571 -0.122768,0.0,0.0 -0.142857,0.0,0.00446429 -0.125,0.0,-0.0178571 -0.000125,0.214286,0.0 -0.0,0.205357,-0.0178571 -0.0,0.205357,-0.0178571 --0.000125,0.214286,0.0 -0.0625,0.214286,0.0 -0.0267857,0.1875,-0.0625 --0.0267857,0.1875,-0.0625 --0.0625,0.214286,0.0 -0.125,0.0952429,-0.0178571 -0.0535714,0.0952429,-0.107143 --0.0535714,0.0952429,-0.107143 --0.125,0.0952429,-0.0178571 -0.125,0.0,-0.0178571 -0.0535714,0.0,-0.107143 --0.0535714,0.0,-0.107143 --0.125,0.0,-0.0178571 --0.000125,0.214286,0.0 --0.000157143,0.216518,0.00446429 --0.000135714,0.207589,0.00446429 --0.000107143,0.205357,0.0 --0.0625,0.214286,0.0 --0.0714286,0.220982,0.015625 --0.0613964,0.212054,0.0133571 --0.0535714,0.205357,0.0 --0.125,0.0952429,-0.0178571 --0.142857,0.0952429,0.00446429 --0.122768,0.0952429,0.0 --0.107143,0.0952429,-0.0178571 --0.125,0.0,-0.0178571 --0.142857,0.0,0.00446429 --0.122768,0.0,0.0 --0.107143,0.0,-0.0178571 --0.107143,0.0,-0.0178571 --0.0446429,0.0,-0.0892857 -0.0446429,0.0,-0.0892857 -0.107143,0.0,-0.0178571 --0.107143,-0.142857,-0.0178571 --0.0446429,-0.142857,-0.0892857 -0.0446429,-0.142857,-0.0892857 -0.107143,-0.142857,-0.0178571 --0.0133929,-0.160714,0.0386893 --0.00557857,-0.160714,0.0386893 -0.00557857,-0.160714,0.0386893 -0.0133929,-0.160714,0.0386893 --0.0133929,-0.25,0.0535714 --0.00557857,-0.25,0.0535714 -0.00557857,-0.25,0.0535714 -0.0133929,-0.25,0.0535714 -0.107143,0.0,-0.0178571 -0.122768,0.0,0.0 -0.142857,0.0,0.00446429 -0.125,0.0,-0.0178571 -0.107143,-0.142857,-0.0178571 -0.122768,-0.142857,0.0 -0.142857,-0.142857,0.00446429 -0.125,-0.142857,-0.0178571 -0.0133929,-0.160714,0.0386893 -0.0153464,-0.160714,0.0386893 -0.0178571,-0.160714,0.0314357 -0.015625,-0.160714,0.0297607 -0.0133929,-0.25,0.0535714 -0.0153464,-0.25,0.0535714 -0.0178571,-0.25,0.0463179 -0.015625,-0.25,0.0446429 -0.125,0.0,-0.0178571 -0.0535714,0.0,-0.107143 --0.0535714,0.0,-0.107143 --0.125,0.0,-0.0178571 -0.125,-0.142857,-0.0178571 -0.0535714,-0.142857,-0.107143 --0.0535714,-0.142857,-0.107143 --0.125,-0.142857,-0.0178571 -0.015625,-0.160714,0.0297607 -0.00669643,-0.160714,0.0230643 --0.00781071,-0.160714,0.0208321 --0.015625,-0.160714,0.0297607 -0.015625,-0.25,0.0446429 -0.00669643,-0.25,0.0379464 --0.00781071,-0.25,0.0357143 --0.015625,-0.25,0.0446429 --0.125,0.0,-0.0178571 --0.142857,0.0,0.00446429 --0.122768,0.0,0.0 --0.107143,0.0,-0.0178571 --0.125,-0.142857,-0.0178571 --0.142857,-0.142857,0.00446429 --0.122768,-0.142857,0.0 --0.107143,-0.142857,-0.0178571 --0.015625,-0.160714,0.0297607 --0.0175786,-0.160714,0.0319929 --0.0153464,-0.160714,0.0386893 --0.0133929,-0.160714,0.0386893 --0.015625,-0.25,0.0446429 --0.0175786,-0.25,0.046875 --0.0153464,-0.25,0.0535714 --0.0133929,-0.25,0.0535714 --0.0133929,-0.25,0.0535714 --0.00557857,-0.25,0.0535714 -0.00557857,-0.25,0.0535714 -0.0133929,-0.25,0.0535714 --0.0133929,-0.46425,0.0892857 --0.00557857,-0.46425,0.0892857 -0.00557857,-0.46425,0.0892857 -0.0133929,-0.46425,0.0892857 --0.0446429,-0.678571,0.0535714 --0.00892857,-0.678571,0.0625 -0.00892857,-0.678571,0.0625 -0.0446429,-0.678571,0.0535714 --0.0446429,-0.857143,0.0357143 --0.00892857,-0.857143,0.0446429 -0.00892857,-0.857143,0.0446429 -0.0446429,-0.857143,0.0357143 -0.0133929,-0.25,0.0535714 -0.0153464,-0.25,0.0535714 -0.0178571,-0.25,0.0463179 -0.015625,-0.25,0.0446429 -0.0133929,-0.46425,0.0892857 -0.0153464,-0.464286,0.0892857 -0.0178571,-0.46425,0.0820321 -0.015625,-0.46425,0.0803571 -0.0446429,-0.678571,0.0535714 -0.0535714,-0.678571,0.0513393 -0.0535714,-0.678571,0.0334821 -0.0446429,-0.678571,0.0357143 -0.0446429,-0.857143,0.0357143 -0.0535714,-0.857143,0.0334821 -0.0535714,-0.857143,0.015625 -0.0446429,-0.857143,0.0178571 -0.015625,-0.25,0.0446429 -0.00669643,-0.25,0.0379464 --0.00781071,-0.25,0.0357143 --0.015625,-0.25,0.0446429 -0.015625,-0.46425,0.0803571 -0.00669643,-0.464286,0.0736607 --0.00781071,-0.46425,0.0714286 --0.015625,-0.46425,0.0803571 -0.0446429,-0.678571,0.0357143 -0.00892857,-0.678571,0.0446429 --0.00892857,-0.678571,0.0446429 --0.0446429,-0.678571,0.0357143 -0.0446429,-0.857143,0.0178571 -0.00892857,-0.857143,0.0267857 --0.00892857,-0.857143,0.0267857 --0.0446429,-0.857143,0.0178571 --0.015625,-0.25,0.0446429 --0.0175786,-0.25,0.046875 --0.0153464,-0.25,0.0535714 --0.0133929,-0.25,0.0535714 --0.015625,-0.46425,0.0803571 --0.0175786,-0.464286,0.0825893 --0.0153464,-0.464286,0.0892857 --0.0133929,-0.46425,0.0892857 --0.0446429,-0.678571,0.0357143 --0.0535714,-0.678571,0.0334821 --0.0535714,-0.678571,0.0513393 --0.0446429,-0.678571,0.0535714 --0.0446429,-0.857143,0.0178571 --0.0535714,-0.857143,0.015625 --0.0535714,-0.857143,0.0334821 --0.0446429,-0.857143,0.0357143 --0.0446429,-0.857143,0.0357143 --0.00892857,-0.857143,0.0446429 -0.00892857,-0.857143,0.0446429 -0.0446429,-0.857143,0.0357143 --0.0446429,-0.928571,0.0285714 --0.00892857,-0.928571,0.0375 -0.00892857,-0.928571,0.0375 -0.0446429,-0.928571,0.0285714 --0.0539286,-0.999643,0.0178571 -0.000357143,-0.999643,0.0178571 -0.0,-0.999643,0.0178571 -0.0535714,-0.999643,0.0178571 --0.000357143,-1,0.0178571 -0.000357143,-1,0.0178571 -0.0,-1,0.0178571 -0.0,-1,0.0178571 -0.0446429,-0.857143,0.0357143 -0.0535714,-0.857143,0.0334821 -0.0535714,-0.857143,0.015625 -0.0446429,-0.857143,0.0178571 -0.0446429,-0.928571,0.0285714 -0.0535714,-0.928571,0.0263393 -0.0535714,-0.928571,0.00848214 -0.0446429,-0.928571,0.0107143 -0.0535714,-0.999643,0.0178571 -0.0669643,-0.999643,0.0178571 -0.0673214,-0.999643,0.0 -0.0539286,-0.999643,0.0 -0.0,-1,0.0178571 -0.0,-1,0.0178571 -0.000357143,-1,0.0 -0.000357143,-1,0.0 -0.0446429,-0.857143,0.0178571 -0.00892857,-0.857143,0.0267857 --0.00892857,-0.857143,0.0267857 --0.0446429,-0.857143,0.0178571 -0.0446429,-0.928571,0.0107143 -0.00892857,-0.928571,0.0196429 --0.00892857,-0.928571,0.0196429 --0.0446429,-0.928571,0.0107143 -0.0539286,-0.999643,0.0 -0.000357143,-0.999643,0.0 --0.000357143,-0.999643,0.0 --0.0539286,-0.999643,0.0 -0.000357143,-1,0.0 -0.000357143,-1,0.0 --0.000357143,-1,0.0 --0.000357143,-1,0.0 --0.0446429,-0.857143,0.0178571 --0.0535714,-0.857143,0.015625 --0.0535714,-0.857143,0.0334821 --0.0446429,-0.857143,0.0357143 --0.0446429,-0.928571,0.0107143 --0.0535714,-0.928571,0.00848214 --0.0535714,-0.928571,0.0263393 --0.0446429,-0.928571,0.0285714 --0.0539286,-0.999643,0.0 --0.0673214,-0.999643,0.0 --0.0675,-0.999643,0.0178571 --0.0539286,-0.999643,0.0178571 --0.000357143,-1,0.0 --0.000357143,-1,0.0 --0.000535714,-1,0.0178571 --0.000357143,-1,0.0178571 -# reverse-patches |