diff options
author | dpope <daniel.pope@nokia.com> | 2012-02-03 15:45:25 +1000 |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2012-02-10 07:24:48 +0100 |
commit | bc66ec0bc5f548a72d21557d529f2d03c7417f09 (patch) | |
tree | 53aa0444fc698cde712fb8e0486e3da1a56f853d /examples/qt3d/solarsystem | |
parent | 98451b5e136af38b00b008ae58ec8243c981eee4 (diff) |
Change-Id: I271146636615ab16f79ad3e66985076e2bd7a95c
Reviewed-by: Sarah Jane Smith <sarah.j.smith@nokia.com>
Diffstat (limited to 'examples/qt3d/solarsystem')
-rw-r--r-- | examples/qt3d/solarsystem/main.cpp | 65 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/qt3d.ico | bin | 67646 -> 0 bytes | |||
-rw-r--r-- | examples/qt3d/solarsystem/qt3d.png | bin | 3677 -> 0 bytes | |||
-rw-r--r-- | examples/qt3d/solarsystem/resources/attribution.txt | 4 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/resources/moon-texture.jpg | bin | 111322 -> 0 bytes | |||
-rw-r--r-- | examples/qt3d/solarsystem/resources/planet.jpg | bin | 87865 -> 0 bytes | |||
-rw-r--r-- | examples/qt3d/solarsystem/resources/solar.fsh | 70 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/resources/solar.jpg | bin | 103406 -> 0 bytes | |||
-rw-r--r-- | examples/qt3d/solarsystem/resources/solar.vsh | 175 | ||||
-rwxr-xr-x | examples/qt3d/solarsystem/resources/solar2.jpg | bin | 144007 -> 0 bytes | |||
-rw-r--r-- | examples/qt3d/solarsystem/solarsystem.cpp | 232 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/solarsystem.desktop | 7 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/solarsystem.h | 96 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/solarsystem.pro | 29 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/solarsystem.qrc | 10 | ||||
-rw-r--r-- | examples/qt3d/solarsystem/solarsystem.rc | 1 |
16 files changed, 0 insertions, 689 deletions
diff --git a/examples/qt3d/solarsystem/main.cpp b/examples/qt3d/solarsystem/main.cpp deleted file mode 100644 index a4d44d3d..00000000 --- a/examples/qt3d/solarsystem/main.cpp +++ /dev/null @@ -1,65 +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 examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QApplication> - -#include "solarsystem.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - SolarSystemView view; - -#ifdef Q_OS_SYMBIAN - view.setAttribute(Qt::WA_LockLandscapeOrientation, true); - view.showFullScreen(); -#else - if (view.stereoType() != QGLView::RedCyanAnaglyph) - view.camera()->setEyeSeparation(0.3f); - if (QApplication::arguments().contains(QLatin1String("-maximize"))) - view.showMaximized(); - else if (QApplication::arguments().contains(QLatin1String("-fullscreen"))) - view.showFullScreen(); - else - view.show(); -#endif - - return app.exec(); -} diff --git a/examples/qt3d/solarsystem/qt3d.ico b/examples/qt3d/solarsystem/qt3d.ico Binary files differdeleted file mode 100644 index e6442baf..00000000 --- a/examples/qt3d/solarsystem/qt3d.ico +++ /dev/null diff --git a/examples/qt3d/solarsystem/qt3d.png b/examples/qt3d/solarsystem/qt3d.png Binary files differdeleted file mode 100644 index 21ec0176..00000000 --- a/examples/qt3d/solarsystem/qt3d.png +++ /dev/null diff --git a/examples/qt3d/solarsystem/resources/attribution.txt b/examples/qt3d/solarsystem/resources/attribution.txt deleted file mode 100644 index 28fe61c3..00000000 --- a/examples/qt3d/solarsystem/resources/attribution.txt +++ /dev/null @@ -1,4 +0,0 @@ -Image files based on textures courtesy of: -qzma.deviantart.com -sirius-sdz.deviantart.com - diff --git a/examples/qt3d/solarsystem/resources/moon-texture.jpg b/examples/qt3d/solarsystem/resources/moon-texture.jpg Binary files differdeleted file mode 100644 index b6955e38..00000000 --- a/examples/qt3d/solarsystem/resources/moon-texture.jpg +++ /dev/null diff --git a/examples/qt3d/solarsystem/resources/planet.jpg b/examples/qt3d/solarsystem/resources/planet.jpg Binary files differdeleted file mode 100644 index c6d92c43..00000000 --- a/examples/qt3d/solarsystem/resources/planet.jpg +++ /dev/null diff --git a/examples/qt3d/solarsystem/resources/solar.fsh b/examples/qt3d/solarsystem/resources/solar.fsh deleted file mode 100644 index b85bd708..00000000 --- a/examples/qt3d/solarsystem/resources/solar.fsh +++ /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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -uniform sampler2D qt_Texture0; -uniform sampler2D qt_Texture1; -varying mediump vec4 lightingColor; -varying highp vec4 texCoord0; -uniform mediump float glowFactor; - -void main(void) -{ - vec4 unlitColor0 = texture2D(qt_Texture0, texCoord0.st); - vec4 unlitColor1 = texture2D(qt_Texture1, texCoord0.st); - - // interpolate between the two textures - vec4 unlitColor = mix(unlitColor0, unlitColor1, glowFactor); - - // Apply lighting - vec4 litColor = lightingColor * unlitColor; - // Normally, we'd just paint this lit colour like so: -// gl_FragColor = litColor; - - // However, we want a cool glow effect, because the sun is generating - // it's own light. - - // Multiplying the color by itself will washing out the darker colours, - // leaving the brighter colours brighter by comparison - vec4 powerColor = unlitColor * unlitColor; - powerColor = powerColor * powerColor ; - - // Then combine the higher contrast color and the lit color - gl_FragColor= mix(litColor, powerColor, glowFactor); -} diff --git a/examples/qt3d/solarsystem/resources/solar.jpg b/examples/qt3d/solarsystem/resources/solar.jpg Binary files differdeleted file mode 100644 index 86f5921a..00000000 --- a/examples/qt3d/solarsystem/resources/solar.jpg +++ /dev/null diff --git a/examples/qt3d/solarsystem/resources/solar.vsh b/examples/qt3d/solarsystem/resources/solar.vsh deleted file mode 100644 index 420bc701..00000000 --- a/examples/qt3d/solarsystem/resources/solar.vsh +++ /dev/null @@ -1,175 +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:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -attribute highp vec4 qt_Vertex; -attribute highp vec3 qt_Normal; -attribute highp vec4 qt_MultiTexCoord0; -uniform highp mat4 qt_ModelViewProjectionMatrix; -uniform highp mat4 qt_ModelViewMatrix; -uniform highp mat3 qt_NormalMatrix; -varying highp vec4 texCoord0; - -// varying values for per-pixel lighting -varying mediump vec4 lightingColor; -varying highp vec3 normal; -varying highp vec3 lightDirection; -varying highp vec3 halfVector; -varying highp vec3 vertexToLight; - -// Varying values for per-vertex lighting -varying mediump vec4 litCombinedColor; - -// These structs are copied from the QGLShaderProgramEffect documentation -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; - -// This is a pretty standard lighting function, adapted from QGLLitMaterial. -// The changes are mostly just renaming to improve readablity, but some -// unecessary features are removed too (e.g. support for two-sided materials) - -void qLightVertex(vec4 vertex, vec3 normal) -{ - // Start with the material's emissive color and the ambient scene color, - // which have been combined into the emission parameter. - vec4 color = qt_Material.emission; - vec4 scolor = qt_Material.specular; - - // Viewer is at infinity. - vec3 toEye = vec3(0, 0, 1); - - // Determine the angle between the normal and the light direction. - vec4 lightPosition = qt_Light.position; - vec3 lightDirection; - if (lightPosition.w == 0.0) - lightDirection = normalize(lightPosition.xyz); - else - lightDirection = normalize(lightPosition.xyz - vertex.xyz); - // Clean up negative values - float angle = max(dot(normal, lightDirection), 0.0); - - // Calculate the ambient and diffuse light components. - vec4 adcomponent = qt_Material.ambient + angle * qt_Material.diffuse; - - // Calculate the specular light components, in case they're needed for - // per-vertex lighting. - vec4 scomponent; - if (angle != 0.0) { - halfVector = normalize(lightDirection + toEye); - angle = max(dot(normal, halfVector), 0.0); - float srm = qt_Material.shininess; - vec4 scm = qt_Material.specular; - if (srm != 0.0) - scomponent = pow(angle, srm) * scm; - else - scomponent = scm; - } else { - scomponent = vec4(0, 0, 0, 0); - } - - // Apply the spotlight angle and exponent. - if (qt_Light.spotCutoff != 180.0) { - vertexToLight = vertex.xyz - lightPosition.xyz; - float spot = max(dot(normalize(vertexToLight), - qt_Light.spotDirection), 0.0); - if (spot < qt_Light.spotCosCutoff) { - adcomponent = vec4(0, 0, 0, 0); - scomponent = vec4(0, 0, 0, 0); - } else { - spot = pow(spot, qt_Light.spotExponent); - adcomponent *= spot; - scomponent *= spot; - } - } - - // Apply attenuation to the colors. - if (lightPosition.w != 0.0) { - float attenuation = qt_Light.constantAttenuation; - float k1 = qt_Light.linearAttenuation; - float k2 = qt_Light.quadraticAttenuation; - if (k1 != 0.0 || k2 != 0.0) { - float len = length(lightPosition.xyz - vertex.xyz); - attenuation += k1 * len + k2 * len * len; - } - color += adcomponent / attenuation; - scolor += scomponent / attenuation; - } else { - color += adcomponent; - scolor += scomponent; - } - - // Generate the final output colors to pass to the fragment shader. - float alpha = qt_Material.diffuse.a; - // This is the combined diffuse and ambient lighting color - lightingColor = vec4(clamp(color.rgb, 0.0, 1.0), alpha); - // Specular lighting and combined color is used for per vertex lighting if - // per-pixel is too expensive or not required. - vec4 specularLightingColor = vec4(clamp(scolor.rgb, 0.0, 1.0), 0.0); - litCombinedColor = clamp(lightingColor + vec4(specularLightingColor.xyz, 0.0), 0.0, 1.0); -} - - void main(void) - { - gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex; - texCoord0 = qt_MultiTexCoord0; - - // Calculate the vertex and normal to use for lighting calculations. - highp vec4 vertex = qt_ModelViewMatrix * qt_Vertex; - normal = normalize(qt_NormalMatrix * qt_Normal); - qLightVertex(vertex,normal); -} - diff --git a/examples/qt3d/solarsystem/resources/solar2.jpg b/examples/qt3d/solarsystem/resources/solar2.jpg Binary files differdeleted file mode 100755 index 1aa0f02d..00000000 --- a/examples/qt3d/solarsystem/resources/solar2.jpg +++ /dev/null diff --git a/examples/qt3d/solarsystem/solarsystem.cpp b/examples/qt3d/solarsystem/solarsystem.cpp deleted file mode 100644 index 25b0f769..00000000 --- a/examples/qt3d/solarsystem/solarsystem.cpp +++ /dev/null @@ -1,232 +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 examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QPropertyAnimation> -#include "solarsystem.h" -#include "qglbuilder.h" -#include "qglmaterialcollection.h" -#include "qgltexture2d.h" -#include "qglmaterial.h" -#include "qglscenenode.h" -#include "qgllightmodel.h" -#include "qglsphere.h" -#include "qgraphicsrotation3d.h" -#include "qgraphicstranslation3d.h" -#include "qglshaderprogrameffect.h" -#include "qglshaderprogram.h" - -#include <QtGui/qmatrix4x4.h> - -#include <QtCore/qmath.h> - -SolarSystemView::SolarSystemView(QWidget *parent) - : QGLView(parent) - , spaceScene(new QGLSceneNode(this)) - , sunEffect(0) -{ - //Generate geometry for the scene - spaceScene = createScene(); - - //Set up the camera - camera()->setEye(QVector3D(0, 0, 15)); - - //Create the animation for the rotation of the Sun - QPropertyAnimation *animation; - animation = new QPropertyAnimation(this, "angle1", this); - animation->setStartValue(0.0f); - animation->setEndValue(360.0f); - animation->setDuration(7000); - animation->setLoopCount(-1); - animation->start(); - - //Create the animation for the rotation of the Planet - QPropertyAnimation *animation2; - animation2 = new QPropertyAnimation(this, "angle2", this); - animation2->setStartValue(0.0f); - animation2->setEndValue(360.0f); - animation2->setDuration(3000); - animation2->setLoopCount(-1); - animation2->start(); - - //Create the animation for the rotation of the Solar-System - QPropertyAnimation *animation3; - animation3 = new QPropertyAnimation(this, "angle3", this); - animation3->setStartValue(0.0f); - animation3->setEndValue(360.0f); - animation3->setDuration(30000); - animation3->setLoopCount(-1); - animation3->start(); - - //Create the animation for the glow effect - QPropertyAnimation *glowAnimation; - glowAnimation = new QPropertyAnimation(this, "glowFactor", this); - glowAnimation->setStartValue(0.0f); - glowAnimation->setEndValue(0.0f); - glowAnimation->setKeyValueAt(0.5, 1.0f); - glowAnimation->setDuration(3000); - glowAnimation->setLoopCount(-1); - glowAnimation->start(); -} - -SolarSystemView::~SolarSystemView() -{ - delete spaceScene; - delete sunEffect; -} - -void SolarSystemView::initializeGL(QGLPainter *painter) -{ - Q_UNUSED(painter); - //nothing for now -} - - -void SolarSystemView::paintGL(QGLPainter *painter) -{ - sunRotation->setAngle(-m_angle1); - planetRotation->setAngle(m_angle2); - systemRotation->setAngle(m_angle3); - // Set the effect active to make sure that the program is created - // and bound so that we can update our uniform - sunEffect->setActive(painter,true); - sunEffect->program()->setUniformValue("glowFactor", m_glowFactor); - spaceScene->draw(painter); -} - -QGLSceneNode *SolarSystemView::createScene() -{ - QGLBuilder builder; - QGLSceneNode *root = builder.sceneNode(); - QUrl url; - - //set up our materials palette - this describes all - //of the materials we will use for this scene. - - //solar surface - QGLMaterial *mat1 = new QGLMaterial; - url.setPath(QLatin1String(":/solar.jpg")); - url.setScheme(QLatin1String("file")); - mat1->setTextureUrl(url,0); - url.setPath(QLatin1String(":/solar2.jpg")); - url.setScheme(QLatin1String("file")); - mat1->setTextureUrl(url, 1); - //mat1->setEmittedLight(Qt::white); - int sunMat = root->palette()->addMaterial(mat1); - - //planetary surface - QGLMaterial *mat2 = new QGLMaterial; - url.setPath(QLatin1String(":/planet.jpg")); - url.setScheme(QLatin1String("file")); - mat2->setTextureUrl(url); - int planetMat = root->palette()->addMaterial(mat2); - - //moon surface - QGLMaterial *mat3 = new QGLMaterial; - url.setPath(QLatin1String(":/moon-texture.jpg")); - url.setScheme(QLatin1String("file")); - mat3->setTextureUrl(url); - int moonMat = root->palette()->addMaterial(mat3); - - //Set the rotation of the solar-system - systemRotation = new QGraphicsRotation3D(); - systemRotation->setAxis(QVector3D(0,1,0)); - root->addTransform(systemRotation); - - // create the sun for our solar system - builder.pushNode()->setObjectName(QLatin1String("Solar")); - builder<<QGLSphere(1.5); - builder.currentNode()->setMaterialIndex(sunMat); - sunEffect = new QGLShaderProgramEffect(); - sunEffect->setVertexShaderFromFile(":/solar.vsh"); - sunEffect->setFragmentShaderFromFile(":/solar.fsh"); -// builder.currentNode()->setEffect(QGL::LitModulateTexture2D); - builder.currentNode()->setUserEffect(sunEffect); - - //create and add rotations for axial tilt and rotation - sunRotation = new QGraphicsRotation3D(); - QGraphicsRotation3D *axialTilt1 = new QGraphicsRotation3D(); - axialTilt1->setAngle(90.0f); - axialTilt1->setAxis(QVector3D(1,0,0)); - builder.currentNode()->addTransform(sunRotation); - builder.currentNode()->addTransform(axialTilt1); - - // create the planet - builder.newNode()->setObjectName(QLatin1String("Planet")); - builder<<QGLSphere(0.4); - builder.currentNode()->setMaterialIndex(planetMat); - builder.currentNode()->setEffect(QGL::LitModulateTexture2D); - - //position our planet - positioning occurs only AFTER transformations - //have taken place. - builder.currentNode()->setPosition(QVector3D(4.5,0,0)); - - //create and add rotations for axial tilt and rotation - planetRotation = new QGraphicsRotation3D(); - QGraphicsRotation3D *axialTilt2 = new QGraphicsRotation3D(); - axialTilt2->setAngle(75.0f); - axialTilt2->setAxis(QVector3D(1,0,0)); - - builder.currentNode()->addTransform(planetRotation); - builder.currentNode()->addTransform(axialTilt2); - - //create the moon - builder.pushNode()->setObjectName("Moon"); - builder<<QGLSphere(0.1); - builder.currentNode()->setMaterialIndex(moonMat); - builder.currentNode()->setEffect(QGL::LitModulateTexture2D); - - //as our moon is tidally locked to the planet (ie. they - //always face the same side to one another), we are just - //correcting the axial tilt of the moon here. - QGraphicsRotation3D *axialTilt3 = new QGraphicsRotation3D(); - axialTilt3->setAngle(90.0f); - axialTilt3->setAxis(QVector3D(1,0,0)); - builder.currentNode()->addTransform(axialTilt3); - - //The position is set relative to the parent node... - builder.currentNode()->setPosition(QVector3D(0.7,0,0)); - - - - - - //completed building, so finalise - return builder.finalizedSceneNode(); -} diff --git a/examples/qt3d/solarsystem/solarsystem.desktop b/examples/qt3d/solarsystem/solarsystem.desktop deleted file mode 100644 index 3d16c486..00000000 --- a/examples/qt3d/solarsystem/solarsystem.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Type=Application -Name=Basket -Icon=/usr/share/icons/hicolor/80x80/apps/qt3d.png -Exec=/usr/bin/invoker --type=e -s /usr/bin/basket -fullscreen -OnlyShowIn=X-MeeGo; -X-MeeGo-Logical-Id=qtn_comm_appname_basket diff --git a/examples/qt3d/solarsystem/solarsystem.h b/examples/qt3d/solarsystem/solarsystem.h deleted file mode 100644 index 9b8bcc1a..00000000 --- a/examples/qt3d/solarsystem/solarsystem.h +++ /dev/null @@ -1,96 +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 examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef BUILDER_H -#define BUILDER_H - -#include "qglview.h" -#include "qgraphicsrotation3d.h" - -QT_BEGIN_NAMESPACE -class QGLSceneNode; -class QGLBuilder; -class QGLShaderProgramEffect; -QT_END_NAMESPACE - -class SolarSystemView : public QGLView -{ - Q_OBJECT - Q_PROPERTY(qreal angle1 READ angle1 WRITE setAngle1) - Q_PROPERTY(qreal angle2 READ angle2 WRITE setAngle2) - Q_PROPERTY(qreal angle3 READ angle3 WRITE setAngle3) - Q_PROPERTY(qreal glowFactor READ glowFactor WRITE setGlowFactor) -public: - SolarSystemView(QWidget *parent = 0); - ~SolarSystemView(); - - qreal angle1() const { return m_angle1; } - void setAngle1(qreal angle) { m_angle1 = angle; update(); } - - qreal angle2() const { return m_angle2; } - void setAngle2(qreal angle) { m_angle2 = angle; update(); } - - qreal angle3() const { return m_angle3; } - void setAngle3(qreal angle) { m_angle3 = angle; update(); } - - qreal glowFactor() const { return m_glowFactor; } - void setGlowFactor(qreal arg) { m_glowFactor = arg; update(); } - -protected: - void initializeGL(QGLPainter *painter); - void paintGL(QGLPainter *painter); - -private: - qreal m_angle1; - qreal m_angle2; - qreal m_angle3; - float m_glowFactor; - QGraphicsRotation3D *sunRotation; - QGraphicsRotation3D *planetRotation; - QGraphicsRotation3D *moonRotation; - QGraphicsRotation3D *systemRotation; - QGLSceneNode *spaceScene; - - QGLShaderProgramEffect* sunEffect; - - QGLSceneNode *createScene(); -}; - -#endif diff --git a/examples/qt3d/solarsystem/solarsystem.pro b/examples/qt3d/solarsystem/solarsystem.pro deleted file mode 100644 index 757d3753..00000000 --- a/examples/qt3d/solarsystem/solarsystem.pro +++ /dev/null @@ -1,29 +0,0 @@ -TEMPLATE = app -TARGET = solarsystem -CONFIG += qt warn_on - -CONFIG += qt3d_deploy_pkg -include(../../../pkg.pri) - -SOURCES = solarsystem.cpp \ - main.cpp -HEADERS = solarsystem.h -RESOURCES += solarsystem.qrc -DEPENDPATH += resources - -OTHER_FILES += \ - resources/moon-texture.jpg \ - resources/planet.jpg \ - resources/solar.jpg \ - resources/solar.fsh \ - resources/solar.vsh - -OTHER_FILES += \ - solarsystem.rc \ - solarsystem.desktop - -RC_FILE = solarsystem.rc - -symbian { - TARGET.EPOCHEAPSIZE = 0x40000 0x4000000 -} diff --git a/examples/qt3d/solarsystem/solarsystem.qrc b/examples/qt3d/solarsystem/solarsystem.qrc deleted file mode 100644 index 8a90a5eb..00000000 --- a/examples/qt3d/solarsystem/solarsystem.qrc +++ /dev/null @@ -1,10 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file alias="moon-texture.jpg">resources/moon-texture.jpg</file> - <file alias="planet.jpg">resources/planet.jpg</file> - <file alias="solar.fsh">resources/solar.fsh</file> - <file alias="solar.jpg">resources/solar.jpg</file> - <file alias="solar.vsh">resources/solar.vsh</file> - <file alias="solar2.jpg">resources/solar2.jpg</file> - </qresource> -</RCC> diff --git a/examples/qt3d/solarsystem/solarsystem.rc b/examples/qt3d/solarsystem/solarsystem.rc deleted file mode 100644 index b40ecdc1..00000000 --- a/examples/qt3d/solarsystem/solarsystem.rc +++ /dev/null @@ -1 +0,0 @@ -IDI_ICON1 ICON DISCARDABLE "qt3d.ico" |