From 24f57d45f10824fcfa4076c45e47a8b22e86e8d1 Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Thu, 10 Mar 2011 18:39:38 +1000 Subject: Update to quick3d product focus. Mostly doco changes, add new logo. Switch role of the Qt3D C++ API to being a way to extend the QML3D bindings. De-emphasise the portability and OpenGL aspects of C++ side. Also remove stereo stuff as far as possible. --- README | 26 +- doc/config/qt-html-default-styles.qdocconf | 1 + doc/config/qt-html-online-styles.qdocconf | 1 + doc/config/qt-html-templates-online.qdocconf | 5 +- doc/config/qt-html-templates.qdocconf | 5 +- doc/config/qt3d-project.qdocconf | 6 +- doc/doc.pri | 2 +- doc/src/acceptance/qt3d-acceptance.qdoc | 37 +-- doc/src/classes.qdoc | 8 +- doc/src/demos/pageflip.qdoc | 2 +- doc/src/demos/shapes.qdoc | 2 +- doc/src/demos/teaservice.qdoc | 2 +- doc/src/examples/basket.qdoc | 40 +-- doc/src/examples/nesting.qdoc | 8 +- doc/src/examples/painter.qdoc | 2 +- doc/src/examples/teapot-qml.qdoc | 6 +- doc/src/examples/teapot.qdoc | 4 +- doc/src/images/qt3d-logo.png | Bin 0 -> 41332 bytes doc/src/index.qdoc | 42 ++- doc/src/qt3d-all-classes.qdoc | 6 +- doc/src/qt3d-arrays.qdoc | 2 +- doc/src/qt3d-building.qdoc | 226 ++++++-------- doc/src/qt3d-contrib.qdoc | 24 +- doc/src/qt3d-examples.qdoc | 43 ++- doc/src/qt3d-geometry.qdoc | 4 +- doc/src/qt3d-graphicsview.qdoc | 4 +- doc/src/qt3d-materials.qdoc | 4 +- doc/src/qt3d-math.qdoc | 4 +- doc/src/qt3d-painting.qdoc | 10 +- doc/src/qt3d-qml3d.qdoc | 14 +- doc/src/qt3d-scene.qdoc | 4 +- doc/src/qt3d-textures.qdoc | 4 +- doc/src/qt3d-viewing.qdoc | 4 +- doc/src/tutorials/converting.qdoc | 172 ----------- doc/src/tutorials/penguin.qdoc | 4 +- doc/src/tutorials/sceneformat.qdoc | 11 +- doc/src/tutorials/shaders.qdoc | 6 +- doc/src/tutorials/simpleobject.qdoc | 23 +- src/imports/threed/floatingitem.cpp | 142 --------- src/imports/threed/floatingitem.h | 78 ----- src/imports/threed/floatingitem_sg.cpp | 113 ------- src/imports/threed/floatingitem_sg.h | 81 ----- src/imports/threed/floatingitemeffect.cpp | 127 -------- src/imports/threed/floatingitemeffect.h | 76 ----- src/imports/threed/floatingitemnode_sg.cpp | 98 ------ src/imports/threed/floatingitemnode_sg.h | 75 ----- src/imports/threed/qgraphicslookattransform.cpp | 2 - src/imports/threed/stereoinfo_sg.cpp | 120 -------- src/imports/threed/stereoinfo_sg.h | 80 ----- src/imports/threed/stereoview.cpp | 339 --------------------- src/imports/threed/stereoview.h | 124 -------- src/imports/threed/stereovieweffect.cpp | 175 ----------- src/imports/threed/stereovieweffect.h | 70 ----- src/imports/threed/threed.cpp | 5 - src/imports/threed/threed.pro | 14 - src/imports/threed/viewport.cpp | 16 +- src/quick3d/quick3d.pro | 4 +- .../graphicsview/qgraphicsbillboardtransform.cpp | 2 - src/threed/scene/qglabstractscene.cpp | 2 +- src/threed/threed.pro | 5 +- src/threed/viewing/qglview.cpp | 4 +- 61 files changed, 306 insertions(+), 2214 deletions(-) create mode 100644 doc/src/images/qt3d-logo.png delete mode 100644 doc/src/tutorials/converting.qdoc delete mode 100644 src/imports/threed/floatingitem.cpp delete mode 100644 src/imports/threed/floatingitem.h delete mode 100644 src/imports/threed/floatingitem_sg.cpp delete mode 100644 src/imports/threed/floatingitem_sg.h delete mode 100644 src/imports/threed/floatingitemeffect.cpp delete mode 100644 src/imports/threed/floatingitemeffect.h delete mode 100644 src/imports/threed/floatingitemnode_sg.cpp delete mode 100644 src/imports/threed/floatingitemnode_sg.h delete mode 100644 src/imports/threed/stereoinfo_sg.cpp delete mode 100644 src/imports/threed/stereoinfo_sg.h delete mode 100644 src/imports/threed/stereoview.cpp delete mode 100644 src/imports/threed/stereoview.h delete mode 100644 src/imports/threed/stereovieweffect.cpp delete mode 100644 src/imports/threed/stereovieweffect.h diff --git a/README b/README index d8f54f2fa..39285ee0c 100644 --- a/README +++ b/README @@ -1,32 +1,34 @@ +This directory contains the QtQuick3D product tree derived from the Qt3D project. -This directory contains a prototype 3D API and examples for Qt 4.7 or later. +Run qmake and then make to build it against Qt. As of 10 March 2011 it requires +version 4.7.x of Qt, built with OpenGL and declarative support. This is standard +for binary distributions of Qt. + +As of 10 March 2011 this product tree is being ported to avoid the dependency +on private headers in Qt. If it fails to build against your version of Qt +try building it against a developer build from source. -Run qmake and then make to build it against your favourite version of Qt. You will need to have built Qt with the "-opengl" option. Run "make install" afterwards to install the plugins into your Qt build. -Note: a build tree for Qt is required, not the SDK version of Qt. -The SDK version of Qt lacks the private headers that are needed to -build some parts of Qt/3D. - Directory structure: src/threed/ - This is the main library of the Qt/3D project, containing abstractions + This is the main library of the Qt3D project, containing abstractions for cross-platform GL, shaders, lighting models, and so on. src/plugins/ Scene format loading plugins. src/imports/ QML import plugins. util/ - Various utilities that are useful when working with Qt/3D. + Various utilities that are useful when working with Qt3D. examples/ - Some examples of using the Qt/3D library. + Some examples of using the Qt3D library. demos/ - More complex demos of Qt/3D, including QML/3D for integrating - Qt/3D with the "Qt Quick" Declarative UI component of Qt 4.7. + More complex demos of Qt3D, including QtQuick3D for integrating + Qt3D with the "Qt Quick" Declarative UI component of Qt 4.7. tests/ - Unit tests for the Qt/3D libraries. + Unit tests for the Qt3D libraries. doc/ Documentation. devices/symbian/ diff --git a/doc/config/qt-html-default-styles.qdocconf b/doc/config/qt-html-default-styles.qdocconf index c9a69907d..61be7f100 100644 --- a/doc/config/qt-html-default-styles.qdocconf +++ b/doc/config/qt-html-default-styles.qdocconf @@ -20,6 +20,7 @@ extraimages.HTML = qt-logo.png \ horBar.png \ sprites-combined.png \ teapot-logo.png \ + qt3d-logo.png \ gradient.png # Include the style sheets and scripts used. diff --git a/doc/config/qt-html-online-styles.qdocconf b/doc/config/qt-html-online-styles.qdocconf index 84b8ff400..da94e2ec3 100644 --- a/doc/config/qt-html-online-styles.qdocconf +++ b/doc/config/qt-html-online-styles.qdocconf @@ -41,6 +41,7 @@ extraimages.HTML = qt-logo.png \ sprites-combined.png \ spinner.gif \ teapot-logo.png \ + qt3d-logo.png \ gradient.png # Include the style sheets and scripts used. diff --git a/doc/config/qt-html-templates-online.qdocconf b/doc/config/qt-html-templates-online.qdocconf index 8108f1c69..9230e592e 100644 --- a/doc/config/qt-html-templates-online.qdocconf +++ b/doc/config/qt-html-templates-online.qdocconf @@ -5,7 +5,7 @@ HTML.postheader = \ "
\n" \ "
\n" \ " Home
\n" \ - " Qt/3D Reference Documentation\n" \ + " QtQuick3D Reference Documentation\n" \ "
\n" \ "
\n" \ "
    \n" \ @@ -19,7 +19,7 @@ HTML.postheader = \ "
\n" \ "
\n" \ " \n" \ "
\n" \ @@ -192,6 +192,7 @@ qhp.Qt3D.extraFiles = index.html \ images/sprites-combined.png \ images/spinner.gif \ images/teapot-logo.png \ + images/qt3d-logo.png \ scripts/functions.js \ scripts/jquery.js \ scripts/narrow.js \ diff --git a/doc/config/qt-html-templates.qdocconf b/doc/config/qt-html-templates.qdocconf index 71ba7cb0a..7a78a0a0f 100644 --- a/doc/config/qt-html-templates.qdocconf +++ b/doc/config/qt-html-templates.qdocconf @@ -3,7 +3,7 @@ include(qt-html-default-styles.qdocconf) HTML.postheader = \ "
\n" \ " \n" \ "
\n" \ "
    \n" \ @@ -14,7 +14,7 @@ HTML.postpostheader = \ "
\n" \ "
\n" \ "
\n" \ - "\n" \ + "\n" \ "
\n" HTML.footer = \ @@ -53,4 +53,5 @@ qhp.Qt3D.extraFiles = index.html \ images/horBar.png \ images/sprites-combined.png \ images/teapot-logo.png \ + images/qt3d-logo.png \ style/offline.css diff --git a/doc/config/qt3d-project.qdocconf b/doc/config/qt3d-project.qdocconf index 6ab52c328..258dfe4b0 100644 --- a/doc/config/qt3d-project.qdocconf +++ b/doc/config/qt3d-project.qdocconf @@ -7,9 +7,9 @@ sourceencoding = UTF-8 outputencoding = UTF-8 naturallanguage = en_US -project = Qt/3D -description = Qt/3D Documentation -url = http://doc.qt.nokia.com/qt3d-snapshot +project = QtQuick3D +description = QtQuick3D Documentation +url = http://doc.qt.nokia.com/qtquick3d language = Cpp sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" diff --git a/doc/doc.pri b/doc/doc.pri index 53f117ce3..9853a5371 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -2,7 +2,7 @@ # Determine which qdoc3 binary we should be using. We try to use the # one from the Qt we built against. Otherwise use "qdoc3" on the PATH. TOPSRC = $$PWD/.. -QDOCCONF_FILE = $$PWD/config/qt3d.qdocconf +QDOCCONF_FILE = $$PWD/config/qt3d-online.qdocconf DESTDIR = $$OUT_PWD/doc win32:!win32-g++ { diff --git a/doc/src/acceptance/qt3d-acceptance.qdoc b/doc/src/acceptance/qt3d-acceptance.qdoc index 82a94b6c6..bb9833607 100644 --- a/doc/src/acceptance/qt3d-acceptance.qdoc +++ b/doc/src/acceptance/qt3d-acceptance.qdoc @@ -27,31 +27,34 @@ /*! \page qt3d-acceptance.html - \title Acceptance tests for Qt/3D + \title Acceptance tests for Qt3D \keyword Acceptance + As described in the \l{index.html}{Introduction} Qt3D is the C++ framework + that underlies QtQuick3D. + This section of the documentation contains some recommended - acceptance tests for use when verifying that Qt/3D has been + acceptance tests for use when verifying that Qt3D has been successfully ported to a new platform or device, and to - determine if the major features of Qt/3D work correctly prior + determine if the major features of Qt3D work correctly prior to a release. The list of tests is not intended to be exhaustive. - When \l{Contributing to Qt/3D}{reporting bugs}, please include + When \l{Contributing to Qt3D}{reporting bugs}, please include as much information as possible about your platform and particularly - its OpenGL implementation. The \c{qglinfo} program in the Qt/3D + its OpenGL implementation. The \c{qglinfo} program in the Qt3D source tree can be used to collect up information about the OpenGL version, features, and extensions. On X11 systems, usually \c{glxinfo} can be run to obtain similar information. \section1 Basic bring-up - A pre-requisite for the acceptance tests is that Qt and Qt/3D have + A pre-requisite for the acceptance tests is that Qt and Qt3D have been built and installed in accordance with the - \l{Building Qt/3D}{build instructions}. In particular, Qt must + \l{Building QtQuick3D}{build instructions}. In particular, Qt must be configured with OpenGL support and QGLWidget must be working. First, run all unit tests on the platform or device and verify that - they all pass (\l{Contributing to Qt/3D}{report bugs} for those that + they all pass (\l{Contributing to Qt3D}{report bugs} for those that do not pass). The "make check" rule can be used to run the unit tests if you are not cross-compiling. For cross-compile environments, copy all of the \c{tst_*} binaries under \c{tests/auto} @@ -115,7 +118,7 @@ If the basket does not spin, then try to determine if \c{BasketView::paintGL()} is being called every frame or not. If it is being called over and over, then the problem - may be in Qt/3D. But if it is not being called repeatedly, then + may be in Qt3D. But if it is not being called repeatedly, then it could be a problem in Qt's animation framework or QGLWidget update processing. @@ -134,7 +137,7 @@ \section1 Model loading - Run the \l{Loading a 3DS model with Qt/3D}{Penguin} example + Run the \l{Loading a 3DS model with Qt3D}{Penguin} example to check that 3DS model loading basically works: \image penguin-screenshot.png @@ -145,10 +148,10 @@ \c{QT_DEBUG_PLUGINS} environment variable to 1 to get extra information about why the plug-in could not be loaded. - \section1 QML/3D + \section1 QtQuick3D Verification - Run the QML/3D version of the bouncing - \l{Teapot Example in QML/3D}{Teapot Example} using + Run the QtQuick3D version of the bouncing + \l{Teapot Example in QtQuick3D}{Teapot Example} using "qmlviewer -opengl teapot-bounce.qml". The teapot should have a shiny appearence (compared to the grey teapot above) and bounce up and down: @@ -158,13 +161,13 @@ It should be possible to rotate the teapot using the mouse and keyboard. - Note that when running QML/3D examples on a device that both the + Note that when running QtQuick3D examples on a device that both the QML files and the model files must be copied to the device (the model file is "teapot.bez" in the case of the bouncing teapot example). \section1 Object picking - Run the QML/3D \l{Tea Service Demo in QML}{Tea Service} demo + Run the QtQuick3D \l{Tea Service Demo in QML}{Tea Service} demo with "qmlviewer -opengl teaservice.qml". Click on the teapot, teacups, and teaspoons to make them jump up, and click on the teapot spout and handle for other effects. This example tests object @@ -177,7 +180,7 @@ \section1 Build tests - The Qt/3D code base contains a number of \c{#ifdef} statements + The Qt3D code base contains a number of \c{#ifdef} statements that may cause the build to fail in non-default Qt configurations or when strict API options are enabled. It is recommended that these configurations be verified periodically, particularly @@ -192,5 +195,5 @@ DEFINES+=QT_NO_CAST_FROM_ASCII \endcode - \l{index.html}{Return to the main Qt/3D page}. + \l{index.html}{Return to the main Qt3D page}. */ diff --git a/doc/src/classes.qdoc b/doc/src/classes.qdoc index fe3a5b8f5..b6427cc84 100644 --- a/doc/src/classes.qdoc +++ b/doc/src/classes.qdoc @@ -51,7 +51,7 @@ \brief If you know the name of the class you want, find it here. - This is a list of all Qt/3d classes. + This is a list of all Qt3D classes. \generatelist classes @@ -78,7 +78,7 @@ \ingroup classlists \brief The C++ class inheritance hierarchy for all classes in the - Qt/3d API. + Qt3D API. \generatelist classhierarchy */ @@ -90,11 +90,11 @@ \title All Functions \ingroup funclists - \brief All documented Qt/3d functions listed alphabetically with a + \brief All documented Qt3D functions listed alphabetically with a link to where each one is declared. This is the list of all documented member functions and global - functions in the Qt/3d API. Each function has a link to the class or + functions in the Qt3D API. Each function has a link to the class or header file where it is declared and documented. \generatelist functionindex diff --git a/doc/src/demos/pageflip.qdoc b/doc/src/demos/pageflip.qdoc index 56e195ceb..61fef790d 100644 --- a/doc/src/demos/pageflip.qdoc +++ b/doc/src/demos/pageflip.qdoc @@ -29,7 +29,7 @@ \example pageflip \title Page Flip Demo - The Page Flip demo shows how Qt/3D can be used to animate + The Page Flip demo shows how Qt3D can be used to animate flipping pages in a book. A shader program is used to combine a gradient texture with the page textures to create a curl effect. diff --git a/doc/src/demos/shapes.qdoc b/doc/src/demos/shapes.qdoc index 4c5190dcf..065c212f7 100644 --- a/doc/src/demos/shapes.qdoc +++ b/doc/src/demos/shapes.qdoc @@ -30,7 +30,7 @@ \title Shapes Demo The Shapes demo shows many of the basic shapes that can be - drawn using Qt/3D. + drawn using Qt3D. \image shapes-screenshot.png diff --git a/doc/src/demos/teaservice.qdoc b/doc/src/demos/teaservice.qdoc index d4da3464f..695b351e3 100644 --- a/doc/src/demos/teaservice.qdoc +++ b/doc/src/demos/teaservice.qdoc @@ -29,7 +29,7 @@ \example teaservice \title Tea Service Demo - The Tea Service demo shows how Qt/3D can be used to draw a complex + The Tea Service demo shows how Qt3D can be used to draw a complex scene made up of several objects. It also demonstrates object picking. \image teaservice-screenshot.png diff --git a/doc/src/examples/basket.qdoc b/doc/src/examples/basket.qdoc index cf6381109..78358fb78 100644 --- a/doc/src/examples/basket.qdoc +++ b/doc/src/examples/basket.qdoc @@ -29,9 +29,27 @@ \example basket \title Basket Example - \section2 Basket in C++ + \section2 Basket in QtQuick3D - The Basket example shows how Qt/3D can be used to draw an animated + The QtQuick3D version of the basket example is very similar in + structure to the C++ version above, but much simpler. + We start by defining a viewport with a specific camera position: + + \snippet declarative/basket.qml 1 + + We then add an \l Item3D object to load the basket model and + apply the desired texture to it: + + \snippet declarative/basket.qml 2 + + And then we apply an animation to the rotation component of + the item's transform property: + + \snippet declarative/basket.qml 3 + + \section2 Basket in Qt3D + + The Basket example shows how Qt3D can be used to draw an animated object covered in a texture. The basic application shell is similar to the \l{teapot}{Hello Teapot} example. In this case, we create the basket object and add a texture to it as follows: @@ -58,23 +76,5 @@ \image basket-screenshot.png - \section2 Basket in QML/3D - - The QML/3D version of the basket example is very similar in - structure to the C++ version above, but much simpler. - We start by defining a viewport with a specific camera position: - - \snippet declarative/basket.qml 1 - - We then add an \l Item3D object to load the basket model and - apply the desired texture to it: - - \snippet declarative/basket.qml 2 - - And then we apply an animation to the rotation component of - the item's transform property: - - \snippet declarative/basket.qml 3 - \l{qt3d-examples.html}{Return to Examples}. */ diff --git a/doc/src/examples/nesting.qdoc b/doc/src/examples/nesting.qdoc index c34e332fc..38c99ad53 100644 --- a/doc/src/examples/nesting.qdoc +++ b/doc/src/examples/nesting.qdoc @@ -29,20 +29,20 @@ \example nesting \title Drawing into framebuffer objects - The Nesting example shows how Qt/3D can be used to draw into a + The Nesting example shows how Qt3D can be used to draw into a framebuffer object and then use the associated texture in subsequent drawing operations. It is assumed that the reader is already familar with the following examples: \list \o \l{Teapot Example}{Hello Teapot} - drawing a basic object in 3D. - \o \l{Applying transformations and materials to objects}{Cube} - applying transformations and materials to objects. + \o \l{Object Effects}{Cube} - applying transformations and materials to objects. \o \l{basket}{Basket} - animating objects in 3D. \endlist In this example we are going to draw two rotating and transparent cubes. One cube will display a simple texture as in the - \l{Applying transformations and materials to objects}{Cube} example, + \l{Object Effects}{Cube} example, and the other cube will display a nested scene containing a rotating teapot. @@ -110,7 +110,7 @@ \snippet nesting/cubeview.cpp 9 Drawing the first cube with the simple texture is very similar to - the \l{Applying transformations and materials to objects}{Cube} example: + the \l{Object Effects}{Cube} example: \snippet nesting/cubeview.cpp 10 diff --git a/doc/src/examples/painter.qdoc b/doc/src/examples/painter.qdoc index 91810df12..1353cf66b 100644 --- a/doc/src/examples/painter.qdoc +++ b/doc/src/examples/painter.qdoc @@ -29,7 +29,7 @@ \example painter \title Painter Example - The Painter example shows how Qt/3D can be used to draw basic + The Painter example shows how Qt3D can be used to draw basic orthographic and perspective objects using QGLPainter. \image painter-screenshot.png diff --git a/doc/src/examples/teapot-qml.qdoc b/doc/src/examples/teapot-qml.qdoc index 0f8d0eaf2..9dfc0ac22 100644 --- a/doc/src/examples/teapot-qml.qdoc +++ b/doc/src/examples/teapot-qml.qdoc @@ -27,16 +27,16 @@ /*! \example tutorials/teapot-qml - \title Teapot Example in QML/3D + \title Teapot Example in QtQuick3D - This example shows to use QML/3D to display a teapot on + This example shows to use QtQuick3D to display a teapot on the screen. The QML is fairly simple: \snippet tutorials/teapot-qml/teapot.qml 1 \image teapot-qml-screenshot.png - The example starts by importing the Qt and Qt/3D QML modules: + The example starts by importing the Qt and Qt3D QML modules: \snippet tutorials/teapot-qml/teapot.qml 2 diff --git a/doc/src/examples/teapot.qdoc b/doc/src/examples/teapot.qdoc index e4a889f44..02310277d 100644 --- a/doc/src/examples/teapot.qdoc +++ b/doc/src/examples/teapot.qdoc @@ -29,9 +29,9 @@ \example teapot \title Teapot Example - The Teapot example shows how Qt/3D can be used to draw a simple + The Teapot example shows how Qt3D can be used to draw a simple teapot object with a perspective camera view in C++. There is - also a \l{Teapot Example in QML/3D}{QML/3D version} of the teapot + also a \l{Teapot Example in QtQuick3D}{QtQuick3D version} of the teapot example. We start by defining a class that inherits from QGLView, which diff --git a/doc/src/images/qt3d-logo.png b/doc/src/images/qt3d-logo.png new file mode 100644 index 000000000..1196826b2 Binary files /dev/null and b/doc/src/images/qt3d-logo.png differ diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index d9d6ded93..abc1b4361 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtQuick3D documentation of the Qt Toolkit. +** This file is part of the QtQtQuick3D documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** No Commercial Usage @@ -27,30 +27,44 @@ /*! \page index.html - \title Quick3D Reference Documentation - \keyword Quick3D Reference Documentation + \title QtQuick3D Reference Documentation + \keyword QtQuick3D Reference Documentation - Quick3D adds 3D content to Qt Quick's cross-platform ability and coding power. + \image qt3d-logo.png + + QtQuick3D adds 3D content to \l{http://qt.nokia.com/qtquick/}{Qt Quick's} cross-platform ability and coding power. Developers of fluid user interfaces can now enhance their applications with 3D content in the same way icons and pixmaps would be used in a 2D application. - OpenGL hardware was designed for 3D acceleration and Quick3D allows applications + QtQuick3D is a product resulting from the \l{http://doc.qt.nokia.com/qt3d-snapshot}{Qt3D project}. Qt3D is a set of powerful + cross-platform C++ API's for 3D programming using OpenGL. + + QtQuick3D is made up of the QML bindings for Qt3D (called QML3D) plus + Qt Creator integration, and other supporting tools. Qt3D may be used to + extend QtQuick3D by creating new user-defined QML3D items using C++. + + OpenGL hardware was designed for 3D acceleration and QtQuick3D allows applications to utilise that 3D hardware fully. - Quick3D is the Qt Quick product for scripting 3D applications in QML. Apps can be + QtQuick3D is the Qt Quick product for scripting 3D applications in QML. Apps can be 2D QML applications with a small amount of simple 3D content; through to complex 3D scenes, containing 3D assets - such as complex 3D models, and shader effects. - In Quick3D scripts are written in QML, and rendered with the power of Qt & C++. + In QtQuick3D scripts are written in QML, and rendered with the power of Qt & C++. - Quick3D is a product resulting from the Qt3D project. Qt3D is a set of powerful - cross-platform C++ API's for 3D programming using OpenGL. Qt3D may be used to - extend Quick3D by creating new user-defined 3D items using C++. - - Qt3D research continues and if the features you're looking for are not in Quick3D + Qt3D research continues and if the features you're looking for are not in QtQuick3D yet you may find them in the \l{http://doc.qt.nokia.com/qt3d-snapshot/index.html}{Qt3D research project}. - See the \l{Tutorials and Examples} for an introduction to using Quick3D and Qt3D. + Check the Qt3D research project for upcoming features like \bold{stereoscopic support}, + which will enable your programs to take advantage of special hardware that displays a different image to each eye. + We are readying QtQuick3D for stereo support and in some places you may see references to it, + however it is \bold{not supported yet}. + + QtQuick3D displays \bold{3D content} that is \bold{ready to be enhanced} by stereoscopic + hardware, but out-of-the-box QtQuick3D works just fine on regular non-stereo displays + and does not require special glasses or displays to use it. + + See the \l{Tutorials and Examples} for an introduction to using QtQuick3D and Qt3D. \raw HTML @@ -92,7 +106,7 @@ diff --git a/doc/src/qt3d-all-classes.qdoc b/doc/src/qt3d-all-classes.qdoc index 864614a40..873c03702 100644 --- a/doc/src/qt3d-all-classes.qdoc +++ b/doc/src/qt3d-all-classes.qdoc @@ -27,15 +27,15 @@ /*! \page qt3d-all-classes.html - \title Qt/3D Classes - \keyword Qt/3D Classes + \title Qt3D Classes + \keyword Qt3D Classes \generatelist classes */ /*! \group qt3d - \title Qt/3D Classes + \title Qt3D Classes \generatelist{related} */ diff --git a/doc/src/qt3d-arrays.qdoc b/doc/src/qt3d-arrays.qdoc index c5ad77056..c792592c9 100644 --- a/doc/src/qt3d-arrays.qdoc +++ b/doc/src/qt3d-arrays.qdoc @@ -27,7 +27,7 @@ /*! \group qt3d::arrays - \title Qt/3D Arrays and Vertex Buffers + \title Qt3D Arrays and Vertex Buffers \keyword Vertex Buffer \generatelist{related} diff --git a/doc/src/qt3d-building.qdoc b/doc/src/qt3d-building.qdoc index 9cf5ffd09..24c623d8f 100644 --- a/doc/src/qt3d-building.qdoc +++ b/doc/src/qt3d-building.qdoc @@ -27,69 +27,118 @@ /*! \page qt3d-building.html - \title Building Qt/3D - \keyword Building Qt/3D + \title Building QtQuick3D + \keyword Building QtQuick3D - \section1 Obtaining Qt/3D sources + \section1 QtQuick3D Binary Packages - The source for Qt/3D is hosted on Gitorious as the git repository - \l{http://qt.gitorious.org/qt-labs/qt3d}{\c{qt-labs/qt3d.git}}. + Typically QtQuick3D is obtained via the QtSDK installer - just ensure the + option for QtQuick3D is checked when running the installer. Alternatively + you can install the latest binary packages - check the + \l{http://qt.nokia.com/downloads}{Qt downloads page}. + + This section is for advanced use, or if you want to contribute to the + development of QtQuick3D. + + \section1 Obtaining QtQuick3D sources + + If you want to work with the latest bleeding edge QtQuick3D features you + can build it from source. + + The source for QtQuick3D is hosted on Gitorious as the git repository + \l{http://qt.gitorious.org/qt-labs/quick3d}{\c{qt-labs/quick3d.git}}. It can be cloned as follows: \code $ mkdir -p $HOME/depot/qt-labs $ cd $HOME/depot/qt-labs - $ git clone git://gitorious.org/qt-labs/qt3d.git + $ git clone git://gitorious.org/qt-labs/quick3d.git \endcode - Once Qt/3D becomes a part of Qt it will be available with Qt binary packages. Until - then it must be built from sources. + \section1 Building QtQuick3D - \section1 Obtaining and building Qt sources for Qt/3D + QtQuick3D requires Qt 4.7. Ensure that the binary package for Qt that you are + using to build QtQuick3D against is a 4.7 package. The QtSDK currently ships + with Qt 4.7 so if you're using the SDK you should be fine. - \bold{Important: A Qt build, compiled from source is required for Qt/3D}. + \section1 Building QtQuick3D Using QtCreator / QtSDK - This is because Qt/3D requires access to source files that do not ship - with an SDK. Until Qt/3D becomes a regular part of Qt, either download an official - Qt 4.7 source package (\l{http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.1.tar.gz}{tar.gz}, \l{http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.1.zip}{zip}), - or a source tarball from our - \l{http://qt.gitorious.org/qt/qt/}{gitorious repository}. + Here is a step-by-step guide to building QtQuick3D using the + \l{http://qt.nokia.com/products/appdev/developer-tools/developer-tools}{QtCreator IDE}. + Read and refer to the command line section below for the full details + of building QtQuick3D. - Configure your Qt 4.7 source tree with the \c{-opengl} option. An example: - \code - mkdir $HOME/build/qt - cd $HOME/build/qt - tar zxf qt-everywhere-opensource-src-4.7.1.tar.gz - ln -s qt* 4.7 - cd qt* - ./configure -opengl - make - \endcode + \bold{Step 1} - Open the QtQuick3D project. + + Choose \c{Open} from the \c{File} menu and navigate to the quick3d.pro project + file \c {$HOME/depot/qt-labs/quick3d/quick3d.pro}. Click \c{Open}. + + \bold{Step 2} - Select Qt, and specify a build directory. + + Now the QtQuick3D project is displayed in the \c{Project} listing. Click the + \c{Projects} button on the left-hand side of the screen, and under the + \c{Build Settings} tab, choose \c{General} from the \c{Debug} category. + Set the Qt build to use, making sure it has OpenGL enabled. Also + specify a build directory, and check the "Shadow Build" box. - The \c{-developer-build} option is recommended to get debug support, - and to ensure that your version of Qt is used and not the system - version of Qt. + \image qt-creator-shadow-build.png - On Windows refer to the - \l{http://doc.qt.nokia.com/4.7/install-win.html}{build documentation} - (but do not use the \c{-opengl} command line option). + Note these screen shots apply to QtCreator v1.3 (beta) on MacOSX, but similar + functionality is available in later QtCreator versions, even if the + screen appears different. - \section1 Obtaining Qt Declarative UI for Qt/3D with QML bindings + \bold{Step 3} - Add the system_3ds switch to qmake - Qt/3D has experimental integration with - \l{http://labs.trolltech.com/page/Projects/Graphics/Kinetic/DeclarativeUI}{Declarative UI} - via QML bindings. To experiment with these bindings, ensure you have a source tarball - \l{http://qt.gitorious.org/qt/kinetic/}{from our Qt Declarative UI repository} - and build as appropriate for your platform. + Only do this step if you have lib3ds installed on your system, as + described above, and you want to use the system lib3ds instead of + the one included with QtQuick3D. - Then simply build Qt/3D as described below using the qmake from the Declarative UI - build tree. Once Qt/3D is build you can experiment with the examples in the - \c{examples/declarative} directory. + Do this in QtCreator from the \c{Projects} mode, under the + \c{Build Steps} category. Add \c{CONFIG+=system_3ds} to the "Additional arguments" + for the "QMake build configuration". - \section1 Building Qt/3D + \image qt-creator-config-3ds.png - Assuming that you have built Qt 4.7 in - \c{$HOME/build/qt/4.7}, you would configure and build Qt/3D as follows: + \bold{Step 4} - Add QtQuick3D libraries to the path + + As shown above you'll need to specify the QtQuick3D libraries so that they can + be found. Do this in QtCreator from the \c{Projects} mode, under the + \c{Build Environment} category. This will also propagate to the + \c{Run Environment}. On MacOSX the name of the environment variable is + \c{DYLD_LIBRARY_PATH}, on Linux it is \c{LD_LIBRARY_PATH}. On Windows, + you'll need to add the \c{bin} directory to the \c{PATH} variable. + + \image qt-creator-lib-path.png + + \bold{Step 5} - Specify the plugin install + + Only do this step if you want to use the QtQuick3D model loading plugins, + as described above. + + Do this in QtCreator from the \c{Projects} mode, under the + \c{Build Steps} category. Use the + drop-down under the steps list-box + to add a \c{Custom Process Step}, and move it below \c{QMake} and \c{Make}. + Set the name appropriately, set the command to \c{/usr/bin/make} and + the arguments to \c{-C plugins install}. Note that the + name you set may not display in the list box until you restart QtCreator. + + \image qt-creator-plugins.png + + In Windows set the command to the full path to your make program, eg: + \c{C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\nmake} and set + the "Working Directory" to the imageformats directory: eg + \c{C:\build\qt-labs\qt3d\plugins\imageformats}. The "Command Arguments" + are now simply \c{install}. + + \bold{Step 6} - Build QtQuick3D + + Click the "Build All" button now to build QtQuick3D. + + + \section1 Building from the Command Line + + On Linux assuming that you have built Qt 4.7 in + \c{$HOME/build/qt/4.7}, you would configure and build QtQuick3D as follows: \code $ mkdir -p $HOME/build/qt-labs/qt3d @@ -101,7 +150,7 @@ \endcode The last line exports the library path so that you can run applications - from Qt/3D, and is needed so those applications can find the Qt/3D libraries. + from QtQuick3D, and is needed so those applications can find the QtQuick3D libraries. The "\c{make install}" step is required to make plug-ins work, particularly the model loading and QML/3D plug-ins. @@ -123,11 +172,11 @@ qmake CONFIG+=old_importer sbs -c armv5_urel cd devices\symbian - createpackage Qt3D_template.pkg release-armv5 - runonphone --sis Qt3D.sis + createpackage QtQuick3D_template.pkg release-armv5 + runonphone --sis QtQuick3D.sis \endcode - Once you have built Qt/3D, you can run the "teapot" example to test + Once you have built QtQuick3D, you can run the "teapot" example to test it as follows (ensure you've exported the library path as above): \code @@ -140,21 +189,21 @@ \image teapot-screenshot.png - Qt/3D has been tested with Qt/X11 and Qt/Embedded under Linux, on MacOSX + QtQuick3D has been tested with Qt/X11 and Qt/Embedded under Linux, on MacOSX and Windows XP. Patches for other platforms are welcome. \section1 Installing plugins - Qt/3D has support for loading 3D model files. This is enabled via + QtQuick3D has support for loading 3D model files. This is enabled via plugins for the various formats. 3DS files are supported using the open source \l{http://lib3ds.org}{lib3ds} library. A copy of version 1.3 of this - library is included with the Qt/3D sources under the \c{3rdparty} + library is included with the QtQuick3D sources under the \c{3rdparty} directory. If you already have lib3ds installed on your system and you wish to use - that instead of the version included with Qt/3D, you can pass the + that instead of the version included with QtQuick3D, you can pass the \c{system_3ds} option to qmake: \code @@ -174,79 +223,6 @@ See the instructions in \c{plugins/sceneformats/3ds/README.txt} for more information on using the system lib3ds. - \section1 Building Qt/3D Using QtCreator - - Here is a step-by-step guide to building Qt/3D using the - \l{http://qt.nokia.com/products/appdev/developer-tools/developer-tools}{QtCreator IDE}. - Read and refer to the above command line section for the full details - of building Qt/3D. - - \bold{Step 1} - Open the Qt/3D project. - - Choose \c{Open} from the \c{File} menu and navigate to the qt3d project - file \c {$HOME/depot/qt-labs/qt3d/opengl.pro}. Click \c{Open}. - - \bold{Step 2} - Select Qt, and specify a build directory. - - Now the Qt/3D project is displayed in the \c{Project} listing. Click the - \c{Projects} button on the left-hand side of the screen, and under the - \c{Build Settings} tab, choose \c{General} from the \c{Debug} category. - Set the Qt build to use, making sure it has OpenGL enabled. Also - specify a build directory, and check the "Shadow Build" box. - - \image qt-creator-shadow-build.png - - Note these screen shots apply to QtCreator v1.3 (beta) on MacOSX, but similar - functionality is available in later QtCreator versions, even if the - screen appears different. - - \bold{Step 3} - Add the system_3ds switch to qmake - - Only do this step if you have lib3ds installed on your system, as - described above, and you want to use the system lib3ds instead of - the one included with Qt/3D. - - Do this in QtCreator from the \c{Projects} mode, under the - \c{Build Steps} category. Add \c{CONFIG+=system_3ds} to the "Additional arguments" - for the "QMake build configuration". - - \image qt-creator-config-3ds.png - - \bold{Step 4} - Add Qt/3D libraries to the path - - As shown above you'll need to specify the Qt/3D libraries so that they can - be found. Do this in QtCreator from the \c{Projects} mode, under the - \c{Build Environment} category. This will also propagate to the - \c{Run Environment}. On MacOSX the name of the environment variable is - \c{DYLD_LIBRARY_PATH}, on Linux it is \c{LD_LIBRARY_PATH}. On Windows, - you'll need to add the \c{bin} directory to the \c{PATH} variable. - - \image qt-creator-lib-path.png - - \bold{Step 5} - Specify the plugin install - - Only do this step if you want to use the Qt/3D model loading plugins, - as described above. - - Do this in QtCreator from the \c{Projects} mode, under the - \c{Build Steps} category. Use the + drop-down under the steps list-box - to add a \c{Custom Process Step}, and move it below \c{QMake} and \c{Make}. - Set the name appropriately, set the command to \c{/usr/bin/make} and - the arguments to \c{-C plugins install}. Note that the - name you set may not display in the list box until you restart QtCreator. - - \image qt-creator-plugins.png - - In Windows set the command to the full path to your make program, eg: - \c{C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\nmake} and set - the "Working Directory" to the imageformats directory: eg - \c{C:\build\qt-labs\qt3d\plugins\imageformats}. The "Command Arguments" - are now simply \c{install}. - - \bold{Step 6} - Build Qt/3D - - Click the "Build All" button now to build Qt/3D. - - \l{index.html}{Return to the main Qt/3D page} or + \l{index.html}{Return to the main QtQuick3D page} or \l{qt3d-examples.html}{Continue to the Tutorials and Examples}. */ diff --git a/doc/src/qt3d-contrib.qdoc b/doc/src/qt3d-contrib.qdoc index 7f297fbfd..c0ee0a0a9 100644 --- a/doc/src/qt3d-contrib.qdoc +++ b/doc/src/qt3d-contrib.qdoc @@ -27,28 +27,28 @@ /*! \page qt3d-contrib.html - \title Contributing to Qt/3D - \keyword Contributing to Qt/3D + \title Contributing to QtQuick3D and Qt3D + \keyword Contributing to Qt3D - Qt/3D is being developed primarily in the Brisbane office of Qt + QtQuick3D and Qt3D are developed primarily in the Brisbane office of Qt Development Frameworks, but anyone is welcome to join the effort with patches, new examples, and major feature development. - Contact Rhys Weatherley in the Brisbane office for more information - on how you can contribute to Qt/3D. + Qt3D research may be a better place to contribute as the QtQuick3D has a strong + product focus. Check the Qt3D \l{http://doc.qt.nokia.com/qt3d-snapshot/qt3d-contrib.html}{contributions page}. - Because Qt/3D may eventually become part of Qt, all contributions - need to conform with the + Jump on the IRC channel at #qt-3d on irc.freenode.net, or join our qt3d + mailing list at \l{http://lists.trolltech.com/mailman/listinfo/qt-3d}. + + All contributions need to conform with the \l{http://qt.gitorious.org/qt/pages/QtContributionGuidelines}{Qt Contribution Model Guidelines}. - The source for Qt/3D is hosted on Gitorious at - \l{http://qt.gitorious.org/qt-labs/qt3d}. + The source for QtQuick3D is hosted on Gitorious at + \l{http://qt.gitorious.org/qt-labs/quick3d}. Bugs can be reported against the "Qt3D" component of the "Qt" project at \l{http://bugreports.qt.nokia.com/}. - The Qt/3D project has an open mailing list, which can be subscribed - to at \l{http://lists.trolltech.com/mailman/listinfo/qt-3d}. - \l{index.html}{Return to the main Qt/3D page}. + \l{index.html}{Return to the main QtQuick3D page}. */ diff --git a/doc/src/qt3d-examples.qdoc b/doc/src/qt3d-examples.qdoc index 6358e8dad..26f3b18f3 100644 --- a/doc/src/qt3d-examples.qdoc +++ b/doc/src/qt3d-examples.qdoc @@ -27,45 +27,38 @@ /*! \page qt3d-examples.html - \title Qt3D Tutorials and Examples - \keyword Qt3D Examples + \title Tutorials and Examples + \keyword Tutorials and Examples - Using C++ to build applications with Qt/3D: + Building 3D applications in QML with QtQuick3D: + + \list + \o \l{Teapot Example in QtQuick3D}{Hello Teapot} in QtQuick3D + \o \l{basket#Basket in QtQuick3D}{Basket} in QtQuick3D + \o \l{Object Effects}{Cube} in QtQuick3D + \o \l{Monkey God in QML}{Monkey God} in QtQuick3D + \o \l{Tea Service Demo in QML}{Tea Service} in QtQuick3D + \o \l{Using GLSL shaders in QtQuick3D} + \endlist + + Using C++ to extend QtQuick3D and to build applications with Qt3D: \list \o \l{Teapot Example}{Hello Teapot} - drawing a basic object in 3D. - \o \l{Applying transformations and materials to objects}{Cube} - applying transformations and materials to objects. + \o \l{Object Effects#Cube in Qt3D}{Cube in C++} - applying transformations and materials to objects. \o \l{basket}{Basket} - animating objects in 3D. \o \l{nesting}{Nesting} - drawing into framebuffer objects. - \o \l{Loading a 3DS model with Qt/3D}{Penguin} - loading a 3DS model with Qt/3D. - \o \l{painter}{Painter} - basic painting operations using QGLPainter. - \o \l{stereo}{Stereo} - using stereoscopic displays. - \o \l{pvcolor}{Per-vertex Color} - building models with QGLBuilder - that have per-vertex color values. + \o \l{Loading a 3DS model with Qt3D}{Penguin} - loading a 3DS model with Qt3D. \o \l{pageflip}{Page Flip} - using shaders to combine textures. \o \l{shapes}{Shapes} - paints all of the basic OpenGL shapes. \o \l{teaservice}{Tea Service} - complex scenes and object picking. \endlist - Using QML to build applications with Qt/3D: - - \list - \o \l{Teapot Example in QML/3D}{Hello Teapot} in QML/3D - \o \l{basket#Basket in QML/3D}{Basket} in QML/3D - \o \l{Applying transformations and materials to objects#Cube in QML/3D}{Cube} in QML/3D - \o \l{QML Stereo Viewing Example}{Stereo} - using stereoscopic displays in QML, and mixing 2D and 3D content. - \o \l{Monkey God in QML}{Monkey God} in QML/3D - \o \l{Tea Service Demo in QML}{Tea Service} in QML/3D - \o \l{Forest Example}{Forest} - creating billboard objects. - \o \l{Using GLSL shaders in QML/3D} - \endlist - Other topics: \list - \o \l{Converting raw GL applications to use QGLPainter} - \o \l{Writing a scene format plug-in for Qt/3D} + \o \l{Scene Format Plugin}{Writing a scene format plug-in for Qt3D} \endlist - \l{index.html}{Return to the main Qt/3D page}. + \l{index.html}{Return to the main Qt3D page}. */ diff --git a/doc/src/qt3d-geometry.qdoc b/doc/src/qt3d-geometry.qdoc index ab7b2dddf..d0ea51d13 100644 --- a/doc/src/qt3d-geometry.qdoc +++ b/doc/src/qt3d-geometry.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::geometry -\title Qt/3D Geometry -\keyword Qt/3D Geometry +\title Qt3D Geometry +\keyword Qt3D Geometry \generatelist{related} */ diff --git a/doc/src/qt3d-graphicsview.qdoc b/doc/src/qt3d-graphicsview.qdoc index a696f7eb0..b918c6f38 100644 --- a/doc/src/qt3d-graphicsview.qdoc +++ b/doc/src/qt3d-graphicsview.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::graphicsview - \title Qt/3D Graphics View Integration - \keyword Qt/3D Graphics View Integration + \title Qt3D Graphics View Integration + \keyword Qt3D Graphics View Integration \generatelist{related} */ diff --git a/doc/src/qt3d-materials.qdoc b/doc/src/qt3d-materials.qdoc index 203b4e18a..0499dff91 100644 --- a/doc/src/qt3d-materials.qdoc +++ b/doc/src/qt3d-materials.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::materials -\title Qt/3D Materials -\keyword Qt/3D Materials +\title Qt3D Materials +\keyword Qt3D Materials \generatelist{related} */ diff --git a/doc/src/qt3d-math.qdoc b/doc/src/qt3d-math.qdoc index bc424903a..a37f798a9 100644 --- a/doc/src/qt3d-math.qdoc +++ b/doc/src/qt3d-math.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::math -\title Qt/3D Math -\keyword Qt/3D Math +\title Qt3D Math +\keyword Qt3D Math \generatelist{related} */ diff --git a/doc/src/qt3d-painting.qdoc b/doc/src/qt3d-painting.qdoc index 6006e745f..c107fc752 100644 --- a/doc/src/qt3d-painting.qdoc +++ b/doc/src/qt3d-painting.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::painting -\title Qt/3D Painting -\keyword Qt/3D Painting +\title Qt3D Painting +\keyword Qt3D Painting Porting between desktop OpenGL and embedded OpenGL/ES has traditionally been difficult. The usual sequence of operations for a drawing request @@ -50,15 +50,11 @@ for the above, but they are all different. OpenGL/ES 2.0 in particular presents unique problems because it lacks a fixed-function pipeline mode to perform common painting operations. -In Qt/3D the QGLPainter class wraps OpenGL to present a consistent +In Qt3D the QGLPainter class wraps OpenGL to present a consistent OpenGL painting API across all platforms. Shaders and fixed-function options are supplied as an instance of QGLAbstractEffect. Several built-in standard effects are provided for drawing with flat colors, material-based lighting, and simple texturing. -The tutorial "\l{Converting raw GL applications to use QGLPainter}" -compares a raw GL application that draws a triangle with its -QGLPainter counterpart. - \generatelist{related} */ diff --git a/doc/src/qt3d-qml3d.qdoc b/doc/src/qt3d-qml3d.qdoc index e80cbf5b2..fbdc82f75 100644 --- a/doc/src/qt3d-qml3d.qdoc +++ b/doc/src/qt3d-qml3d.qdoc @@ -27,29 +27,29 @@ /*! \group qt3d::qml3d -\title QML Support in Qt/3D -\keyword Qt/3D QML +\title QtQuick3D for Scripting 3D Apps in QML +\keyword QtQuick3D QML The following QML elements are provided by the \c{Qt3D} namespace for importing 3D elements into QML applications: \generatelist{related} -See the \l{Teapot Example in QML/3D}{Teapot} example for an introduction -to using these elements in QML. +See the \l{Teapot Example in QtQuick3D}{Teapot} example for an introduction +to using these elements. -QML/3D also provides some \l{Stock Shapes for QML/3D}{stock shapes} +QtQuick3D also provides some \l{Stock Shapes for QtQuick3D}{stock shapes} in the \c{Qt3D.Shapes} namespace as convenience elements. */ /*! \group qt3d::qml3d::shapes -\title Stock Shapes for QML/3D +\title Stock Shapes for QtQuick3D The following QML elements are provided by the \c{Qt3D.Shapes} namespace as convenience elements: \generatelist{related} -See the \l{Applying transformations and materials to objects#Cube in QML/3D}{Cube} example for an introduction to using these convenience shapes in QML. +See the \l{Object Effects}{Cube} example for an introduction to using these convenience shapes in QML. */ diff --git a/doc/src/qt3d-scene.qdoc b/doc/src/qt3d-scene.qdoc index 0aa0cb7c1..9ebe3152b 100644 --- a/doc/src/qt3d-scene.qdoc +++ b/doc/src/qt3d-scene.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::scene -\title Qt/3D Scene Management -\keyword Qt/3D Scene Management +\title Qt3D Scene Management +\keyword Qt3D Scene Management \generatelist{related} */ diff --git a/doc/src/qt3d-textures.qdoc b/doc/src/qt3d-textures.qdoc index e38424379..ba196f273 100644 --- a/doc/src/qt3d-textures.qdoc +++ b/doc/src/qt3d-textures.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::textures - \title Qt/3D Texture Handling - \keyword Qt/3D Texture Handling + \title Qt3D Texture Handling + \keyword Qt3D Texture Handling \generatelist{related} */ diff --git a/doc/src/qt3d-viewing.qdoc b/doc/src/qt3d-viewing.qdoc index 6d3146a9c..c59134681 100644 --- a/doc/src/qt3d-viewing.qdoc +++ b/doc/src/qt3d-viewing.qdoc @@ -27,8 +27,8 @@ /*! \group qt3d::viewing -\title Qt/3D Viewing -\keyword Qt/3D Viewing +\title Qt3D Viewing +\keyword Qt3D Viewing \generatelist{related} */ diff --git a/doc/src/tutorials/converting.qdoc b/doc/src/tutorials/converting.qdoc deleted file mode 100644 index 715f2bf26..000000000 --- a/doc/src/tutorials/converting.qdoc +++ /dev/null @@ -1,172 +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 documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of this -** file. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Converting raw GL applications to use QGLPainter - \example tutorials/converting - - \raw HTML -
- -
- \endraw - In this tutorial, we will show how to convert an existing application - that uses QGLWidget and raw GL function calls to use QGLPainter. - In the process, we will show some of the portability challenges that - are presented by raw GL and how QGLPainter addresses them. - - The application we are going to build does the following during - each paint event: - - \list - \o Clear the window to the background role color from the window's palette. - \o Set up a standard orthographic projection. - \o Draw a green triangle in the upper left corner of the window. - \endlist - - \raw HTML - - \endraw - \image tutorials/converting-screenshot.png - \raw HTML -
- \endraw - - \section1 Widget definition and viewport setup - - We start by defining a class that inherits from QGLWidget: - - \quotefromfile tutorials/converting/converting-rawgl.cpp - \skipuntil class-defn - \printto QT_OPENGL_ES_2 - \skipuntil endif - \printto class-defn - - The only difference for using QGLPainter is the inclusion of - the \c{qglpainter.h} header: - - \snippet tutorials/converting/converting.cpp includes - - Then we override QGLWidget::resizeGL() to set the viewport - every time the window changes size: - - \snippet tutorials/converting/converting-rawgl.cpp set-viewport - - It isn't necessary to set the viewport with QGLPainter because - QGLPainter::begin() will take care of setting the correct viewport - for the drawing surface. - - QGLPainter is a wrapper around QGLContext objects. In this case, - we are creating a painter object for the QGLContext associated - with \c{this} widget. Multiple QGLPainter objects can be created - for the same QGLContext, and they will all refer to the same - shared context state. - - \section1 Painting the scene - - The next step is to start implementing our QGLWidget::paintGL() - override by clearing the window to the background color. - First, for raw GL: - - \snippet tutorials/converting/converting-rawgl.cpp clear-window - - With QGLPainter, clearing to the background color is similar: - - \snippet tutorials/converting/converting.cpp clear-window - - As in \c{resizeGL()}, we create a QGLPainter instance for the current - widget, and then QGLPainter takes care of the platform issues - for us. - - Now we need to set up the projection and modelview matrices for the view: - - \snippet tutorials/converting/converting-rawgl.cpp set-matrices - - Here we see the difficulty of writing portable GL code: the function - for setting up an orthographic projection changes in name from - \c{glOrtho()} for desktop OpenGL to \c{glOrthof()} for - OpenGL/ES 2.0. We should also note that the above won't work with - OpenGL/ES 2.0 which uses shaders instead of fixed function operations - like \c{glLoadIdentity()} and \c{glOrtho()}. The QGLPainter equivalent - is a lot simpler, and will work on all OpenGL platforms, including - OpenGL/ES 2.0: - - \snippet tutorials/converting/converting.cpp set-matrices - - \raw HTML - The OpenGL/ES 2.0 equivalent using shaders is given in the - converting-rawgl.cpp source file. - \endraw - - Finally, we select a color and draw the triangle: - - \snippet tutorials/converting/converting-rawgl.cpp draw - - The QGLPainter equivalent is similar in structure and will also - work on OpenGL/ES 2.0: - - \snippet tutorials/converting/converting.cpp draw-all - - The code first selects a standard drawing effect. All QGLPainter drawing - operations make use of QGLAbstractEffect objects, and there are a number - of built-in effects for common drawing operations. In this case, - we select the QGL::FlatColor effect and set the color. See - QGLPainter::setStandardEffect() and QGLAbstractEffect for more - information on how QGLPainter uses effects. - - Next, the code creates a QVector3DArray instance containing the vertex - position values. The positions are then added to the array with - QVector3DArray::append(). - - QVector3DArray is essentially QArray. QArray - is a highly efficient data structure for building large arrays - of simple vector values. The array starts by appending to - preallocated storage on the stack and then moves the data - to the heap as the array grows in size. - - There is a slight difference to the raw GL example, which used a - static constant array of vertex values. The QArray::fromRawData() - function can be used to load data from static constant arrays. - In this example, we are building the QVector3DArray on the stack - every time the scene is painted. - - Last, we set the vertex array and draw the triangle defined by - the three vertices. It isn't necessary to explictly enable and - disable the vertex array: the effect takes care of that for us - automatically. - - The full \c{paintGL()} function is as follows: - - \snippet tutorials/converting/converting.cpp paintGL - - This code will work on all OpenGL platforms. Under OpenGL/ES 2.0, - QGLPainter will transparently implement the QGL::FlatColor effect - using shaders. On all other platforms, the fixed function pipeline - is used to implement the QGL::FlatColor effect. - - \l{qt3d-examples.html}{Return to the main Tutorials page}. -*/ diff --git a/doc/src/tutorials/penguin.qdoc b/doc/src/tutorials/penguin.qdoc index babdbf724..ae56fe90d 100644 --- a/doc/src/tutorials/penguin.qdoc +++ b/doc/src/tutorials/penguin.qdoc @@ -27,9 +27,9 @@ /*! \example tutorials/penguin - \title Loading a 3DS model with Qt/3D + \title Loading a 3DS model with Qt3D - This tutorial shows how Qt/3D can be used to load a simple + This tutorial shows how Qt3D can be used to load a simple model object in 3D Studio Max (3DS) format with a perspective camera view. diff --git a/doc/src/tutorials/sceneformat.qdoc b/doc/src/tutorials/sceneformat.qdoc index b16b60702..6533ae49b 100644 --- a/doc/src/tutorials/sceneformat.qdoc +++ b/doc/src/tutorials/sceneformat.qdoc @@ -26,13 +26,14 @@ ****************************************************************************/ /*! - \title Writing a scene format plug-in for Qt/3D + \title Writing a scene format plug-in for Qt3D + \keyword Scene Format Plugin \example sceneformats/obj Scene format plugins are used to load external 3D model file formats like \bold 3DS, \bold obj, and so on. In this tutorial we will do a walk-through of the \bold obj scene format plugin to - demonstrate what is required to add a new format to Qt/3D. + demonstrate what is required to add a new format to Qt3D. Models are loaded by QGLAbstractScene::loadScene(), which locates a suitable plug-in for the format, and then asks the plug-in to @@ -87,7 +88,7 @@ \snippet sceneformats/obj/qglobjscene.h 3 The most important function is the override for - QGLAbstractScene::objects(), which allows the rest of Qt/3D + QGLAbstractScene::objects(), which allows the rest of Qt3D to query the full list of objects in the model file. The scene object can also override QGLAbstractScene::object() if it has an efficient method to quickly look up an object by name. @@ -98,11 +99,11 @@ but doesn't have to be. Note: the plug-in does not need to use QGLBuilder and the - other Qt/3D classes to load the model if it doesn't want to. + other Qt3D classes to load the model if it doesn't want to. It can instantiate subclasses of QGLSceneNode that override the draw() method and draws the object using whatever technique the plug-in chooses. It just needs to leave the OpenGL state - in the condition that it found it so that other parts of Qt/3D + in the condition that it found it so that other parts of Qt3D will not be confused. Once you have written a plug-in for your new format, you should diff --git a/doc/src/tutorials/shaders.qdoc b/doc/src/tutorials/shaders.qdoc index 55395e96e..bd62e6ff2 100644 --- a/doc/src/tutorials/shaders.qdoc +++ b/doc/src/tutorials/shaders.qdoc @@ -26,12 +26,12 @@ ****************************************************************************/ /*! - \title Using GLSL shaders in QML/3D + \title Using GLSL shaders in QtQuick3D \example tutorials/shaders In this tutorial, we will show how to apply QML property animations to - GLSL shaders in a QML/3D application. + GLSL shaders in a QtQuick3D application. Starting with a relatively simple shader program, we are going to manipulate various parameters to explain how both the shader and the QML @@ -52,7 +52,7 @@ \endraw - At the highest level, shaders in QML/3D are created using the ShaderProgram + At the highest level, shaders in QtQuick3D are created using the ShaderProgram element. The ShaderProgram element in this example has the id \a program, and applying it to the teapot is as simple as assigning it to the \c effect property of an Item3D derived element. diff --git a/doc/src/tutorials/simpleobject.qdoc b/doc/src/tutorials/simpleobject.qdoc index 07f14c788..42e6b06ce 100644 --- a/doc/src/tutorials/simpleobject.qdoc +++ b/doc/src/tutorials/simpleobject.qdoc @@ -26,13 +26,24 @@ ****************************************************************************/ /*! - \title Applying transformations and materials to objects + \title Applying Transformations and Materials + \keyword Object Effects \example tutorials/cube4 In this tutorial we will apply transformations and materials to a simple cube object to demonstrate how to modify the QGLPainter - state to achieve different effects. We start by declaring a - view class to show our cube on the screen: + state to achieve different effects. + + \section2 Cube in QtQuick3D + + It is quite simple to achieve these effects in QtQuick3D: + + \snippet tutorials/cube4/cube.qml 1 + + \section2 Cube in Qt3D + + In the C++ world we start by declaring a view class to show our cube + on the screen: \snippet tutorials/cube1/cubeview.h 1 @@ -91,11 +102,5 @@ \image tutorials/cube4-screenshot.png - \section2 Cube in QML/3D - - It is quite simple to achieve the same effect in QML: - - \snippet tutorials/cube4/cube.qml 1 - \l{qt3d-examples.html}{Return to the main Tutorials page}. */ diff --git a/src/imports/threed/floatingitem.cpp b/src/imports/threed/floatingitem.cpp deleted file mode 100644 index 7ec19cb09..000000000 --- a/src/imports/threed/floatingitem.cpp +++ /dev/null @@ -1,142 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "floatingitem.h" -#include "floatingitemeffect.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass FloatingItem FloatingItem - \brief The FloatingItem item defines the depth that a 2D element will be placed at in the 3D visual field. - \since 4.8 - \ingroup qt3d::qml3d - - Stereo viewing is enabled in QML using the StereoView element: - - \snippet declarative/stereo/stereo.qml 1 - \dots - \snippet declarative/stereo/stereo.qml 2 - - \bold{Note:} StereoView is not supported with Qt Quick 2.0 as the - standard view classes are already stereo-aware. - - \image stereo-screenshot-qml.png - - 2D items are placed within the 3D visual field using the - FloatingItem element and the \l depth property: - - \snippet declarative/stereo/stereo.qml 5 - - Negative depth values define distances behind the - \i{center of focus} of our scene, and positive depth - values define distances in front of the center of focus. - The center of focus corresponds to where the left and right - eye images coincide at depth 0. Usually the most important - item on the screen is placed at depth 0 so that the user's - attention is immediately drawn to it. Other items then - \i{float above} (positive depth) or \i{appear behind} - (negative depth) the center of focus. - - FloatingItem defines the depth for 2D elements. 3D elements - should be rendered inside a \l Viewport with the camera's - \l{Camera::eyeSeparation}{eyeSeparation} set to a non-zero value: - - \snippet declarative/stereo/stereo.qml 6 - \dots - \snippet declarative/stereo/stereo.qml 7 - - \sa StereoView, Viewport, {QML Stereo Viewing Example} -*/ - -/*! - \internal -*/ -FloatingItem::FloatingItem(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_depth(0.0f) -{ - // The actual stereo adjustment is done with a QGraphicsEffect. - m_effect = new FloatingItemEffect(this); - setGraphicsEffect(m_effect); -} - -/*! - \internal -*/ -FloatingItem::~FloatingItem() -{ -} - -/*! - \qmlproperty real FloatingItem::depth - - This property defines the depth within the 3D field where children - of this item will appear. The default value of zero indicates - that the left and right eye images will co-incide at the center of - focus. Items with a negative depth appear behind the center - of focus and items with a positive depth float above the center - of focus. - - The value indicates the number of pixels that separate the left - and right eye images on a 100 dpi display. The value is corrected - for the dpi of the actual display if it is not 100 dpi. Thus, - a depth of 1 always corresponds to 0.254 millimeters of image - separation at the surface of the display. - - It is assumed that the distance of the viewer from the display - is the same for all displays showing the same application. - For example, a stereoscopic application designed for viewing - on a handheld device should have the same depth cues on - another handheld device with a different dpi, when held at - the same arms-length distance from the viewer. -*/ - -void FloatingItem::setDepth(qreal depth) -{ - if (m_depth != depth) { - m_depth = depth; - emit depthChanged(); - update(); - } -} - -QT_END_NAMESPACE diff --git a/src/imports/threed/floatingitem.h b/src/imports/threed/floatingitem.h deleted file mode 100644 index 2e30075b0..000000000 --- a/src/imports/threed/floatingitem.h +++ /dev/null @@ -1,78 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FLOATINGITEM_H -#define FLOATINGITEM_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class FloatingItemEffect; - -class FloatingItem : public QDeclarativeItem -{ - Q_OBJECT - Q_PROPERTY(qreal depth READ depth WRITE setDepth NOTIFY depthChanged) -public: - FloatingItem(QDeclarativeItem *parent = 0); - ~FloatingItem(); - - qreal depth() const { return m_depth; } - void setDepth(qreal depth); - -Q_SIGNALS: - void depthChanged(); - -private: - qreal m_depth; - FloatingItemEffect *m_effect; -}; - -QML_DECLARE_TYPE(FloatingItem) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/threed/floatingitem_sg.cpp b/src/imports/threed/floatingitem_sg.cpp deleted file mode 100644 index 83d4673a2..000000000 --- a/src/imports/threed/floatingitem_sg.cpp +++ /dev/null @@ -1,113 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "floatingitem_sg.h" -#include "floatingitemnode_sg.h" -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class FloatingItemSGPrivate : public QSGItemPrivate -{ - Q_DECLARE_PUBLIC(FloatingItemSG) -public: - FloatingItemSGPrivate() - : depth(0.0f) - { - } - - TransformNode *createTransformNode(); - - qreal depth; -}; - -FloatingItemSG::FloatingItemSG(QSGItem *parent) - : QSGItem(*new FloatingItemSGPrivate, parent) -{ - setFlag(ItemHasContents); -} - -FloatingItemSG::~FloatingItemSG() -{ -} - -qreal FloatingItemSG::depth() const -{ - Q_D(const FloatingItemSG); - return d->depth; -} - -void FloatingItemSG::setDepth(qreal depth) -{ - Q_D(FloatingItemSG); - if (d->depth != depth) { - d->depth = depth; - emit depthChanged(); - update(); - } -} - -QRectF FloatingItemSG::boundingRect() const -{ - Q_D(const FloatingItemSG); - QRectF bounds = QSGItem::boundingRect(); - qreal depth = qAbs(d->depth); - depth = depth * qApp->desktop()->logicalDpiX() / 100.0f; - return bounds.adjusted(-depth, -depth, depth, depth); -} - -Node *FloatingItemSG::updatePaintNode(Node *node, UpdatePaintNodeData *data) -{ - Q_D(FloatingItemSG); - FloatingItemSGNode *fNode = static_cast(data->transformNode); - fNode->setDepth(d->depth); - return QSGItem::updatePaintNode(node, data); -} - -TransformNode *FloatingItemSGPrivate::createTransformNode() -{ - return new FloatingItemSGNode(QSGContext::current); -} - -QT_END_NAMESPACE diff --git a/src/imports/threed/floatingitem_sg.h b/src/imports/threed/floatingitem_sg.h deleted file mode 100644 index 96dd048e3..000000000 --- a/src/imports/threed/floatingitem_sg.h +++ /dev/null @@ -1,81 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFLOATINGITEM_SG_H -#define QFLOATINGITEM_SG_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class FloatingItemSGPrivate; - -class FloatingItemSG : public QSGItem -{ - Q_OBJECT - Q_DISABLE_COPY(FloatingItemSG) - Q_DECLARE_PRIVATE(FloatingItemSG) - Q_PROPERTY(qreal depth READ depth WRITE setDepth NOTIFY depthChanged) -public: - FloatingItemSG(QSGItem *parent = 0); - ~FloatingItemSG(); - - qreal depth() const; - void setDepth(qreal depth); - - QRectF boundingRect() const; - -Q_SIGNALS: - void depthChanged(); - -protected: - Node *updatePaintNode(Node *, UpdatePaintNodeData *); -}; - -QML_DECLARE_TYPE(FloatingItemSG) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/threed/floatingitemeffect.cpp b/src/imports/threed/floatingitemeffect.cpp deleted file mode 100644 index 1ec4e4c34..000000000 --- a/src/imports/threed/floatingitemeffect.cpp +++ /dev/null @@ -1,127 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "floatingitemeffect.h" -#include "floatingitem.h" -#include "stereoview.h" -#include -#include -#include -#include - -FloatingItemEffect::FloatingItemEffect(FloatingItem *parent) - : QGraphicsEffect(parent) - , m_item(parent) - , m_sourced(0) -{ -} - -FloatingItemEffect::~FloatingItemEffect() -{ -} - -QRectF FloatingItemEffect::boundingRectFor(const QRectF &sourceRect) const -{ - qreal depth = qAbs(m_item->depth()); - depth = depth * qApp->desktop()->logicalDpiX() / 100.0f; - return sourceRect.adjusted(-depth, -depth, depth, depth); -} - -void FloatingItemEffect::draw(QPainter *painter) -{ - // Correct the depth value for the screen's DPI. We treat 100 DPI - // as "normal" and scale the depth value accordingly. This way, - // the same number of millimeters are used on all displays viewed - // at the same viewing distance. A depth of 1 is 0.254 millimeters. - // Note: we should probably correct for viewing distance also. - qreal depth = m_item->depth() * painter->device()->logicalDpiX() / 100.0f; - - // Determine which eye is being rendered by the StereoView. - StereoView *view = StereoView::findView(m_item); - QGL::Eye eye = view ? view->eye() : QGL::NoEye; - if (eye == QGL::NoEye || depth == 0.0f) { - // No eye being rendered or zero depth, so draw source as-is. - drawSource(painter); - } else if (eye == QGL::LeftEye) { - // Modify the effectTransform to adjust the position - // and draw the left eye version of the source. - QGraphicsItemPaintInfo *drawContext = m_sourced->info; - const QTransform *origTransform = drawContext->effectTransform; - QTransform transform(Qt::Uninitialized); - if (!origTransform) { - transform = QTransform::fromTranslate(depth / 2.0f, 0.0f); - } else { - transform = *origTransform; - transform.translate(depth / 2.0f, 0.0f); - } - drawContext->effectTransform = &transform; - drawSource(painter); - drawContext->effectTransform = origTransform; - } else { - // Modify the effectTransform to adjust the position - // and draw the right eye version of the source. - QGraphicsItemPaintInfo *drawContext = m_sourced->info; - const QTransform *origTransform = drawContext->effectTransform; - QTransform transform(Qt::Uninitialized); - if (!origTransform) { - transform = QTransform::fromTranslate(-depth / 2.0f, 0.0f); - } else { - transform = *origTransform; - transform.translate(-depth / 2.0f, 0.0f); - } - drawContext->effectTransform = &transform; - drawSource(painter); - drawContext->effectTransform = origTransform; - } -} - -void FloatingItemEffect::sourceChanged(QGraphicsEffect::ChangeFlags flags) -{ - if (flags & SourceAttached) { - QGraphicsEffectPrivate *ep = - static_cast - (QObjectPrivate::get(this)); - m_sourced = static_cast - (QObjectPrivate::get(ep->source)); - } else if (flags & SourceDetached) { - m_sourced = 0; - } -} diff --git a/src/imports/threed/floatingitemeffect.h b/src/imports/threed/floatingitemeffect.h deleted file mode 100644 index f08028708..000000000 --- a/src/imports/threed/floatingitemeffect.h +++ /dev/null @@ -1,76 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FLOATINGITEMEFFECT_H -#define FLOATINGITEMEFFECT_H - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QGraphicsItemEffectSourcePrivate; -class FloatingItem; - -class FloatingItemEffect : public QGraphicsEffect -{ - Q_OBJECT -public: - FloatingItemEffect(FloatingItem *parent = 0); - ~FloatingItemEffect(); - - QRectF boundingRectFor(const QRectF &sourceRect) const; - -protected: - void draw(QPainter *painter); - void sourceChanged(QGraphicsEffect::ChangeFlags flags); - -private: - FloatingItem *m_item; - QGraphicsItemEffectSourcePrivate *m_sourced; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/threed/floatingitemnode_sg.cpp b/src/imports/threed/floatingitemnode_sg.cpp deleted file mode 100644 index 02446746b..000000000 --- a/src/imports/threed/floatingitemnode_sg.cpp +++ /dev/null @@ -1,98 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "floatingitemnode_sg.h" -#include - -QT_BEGIN_NAMESPACE - -FloatingItemSGNode::FloatingItemSGNode(QSGContext *context) - : m_stereoInfo(context), m_depth(0.0f) -{ - // Preprocessing is required only if the context supports pre-transforms. - if (m_stereoInfo.hasPreTransform()) - setFlag(Node::UsePreprocess, true); -} - -FloatingItemSGNode::~FloatingItemSGNode() -{ -} - -void FloatingItemSGNode::setDepth(qreal depth) -{ - m_depth = depth; -} - -Node::NodeType FloatingItemSGNode::type() const -{ - // If the device-specific rendering context does not inherit - // from QSGStereoContext, then it won't be aware of how to - // update pre-transform nodes. In that case, act like a - // regular transform node and ignore the depth adjustment. - if (m_stereoInfo.hasPreTransform()) - return PreTransformNodeType; - else - return TransformNodeType; -} - -void FloatingItemSGNode::preprocess() -{ - QMatrix4x4 adjustMatrix; - QGL::Eye eye = m_stereoInfo.eye(); - if (eye != QGL::NoEye && m_depth != 0.0f) { - // Correct the depth value for the screen's DPI. We treat 100 DPI - // as "normal" and scale the depth value accordingly. This way, - // the same number of millimeters are used on all displays viewed - // at the same viewing distance. A depth of 1 is 0.254 millimeters. - // Note: we should probably correct for viewing distance also, - // but that is harder to determine. - qreal depth = m_depth * m_stereoInfo.context()->glContext()->device()->logicalDpiX() / 100.0f; - - // Determine the transformation to pre-multiply with the modelview. - if (eye == QGL::LeftEye) - adjustMatrix.translate(depth / 2.0f, 0.0f, 0.0f); - else - adjustMatrix.translate(-depth / 2.0f, 0.0f, 0.0f); - } - setPreMatrix(adjustMatrix); -} - -QT_END_NAMESPACE diff --git a/src/imports/threed/floatingitemnode_sg.h b/src/imports/threed/floatingitemnode_sg.h deleted file mode 100644 index 4de8f7eec..000000000 --- a/src/imports/threed/floatingitemnode_sg.h +++ /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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef FLOATINGITEMNODE_SG_H -#define FLOATINGITEMNODE_SG_H - -#include "qsgpretransformnode.h" -#include "stereoinfo_sg.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QSGContext; - -class FloatingItemSGNode : public QSGPreTransformNode -{ -public: - FloatingItemSGNode(QSGContext *); - ~FloatingItemSGNode(); - - void setDepth(qreal depth); - inline qreal depth() const { return m_depth; } - - NodeType type() const; - void preprocess(); - -private: - QSGStereoInfo m_stereoInfo; - qreal m_depth; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // FLOATINGITEMNODE_SG_H diff --git a/src/imports/threed/qgraphicslookattransform.cpp b/src/imports/threed/qgraphicslookattransform.cpp index 31214af6e..7330830e1 100644 --- a/src/imports/threed/qgraphicslookattransform.cpp +++ b/src/imports/threed/qgraphicslookattransform.cpp @@ -142,8 +142,6 @@ QT_BEGIN_NAMESPACE effect: Effect { texture: "picture.jpg" } } \endcode - - \sa {Forest Example} */ /*! diff --git a/src/imports/threed/stereoinfo_sg.cpp b/src/imports/threed/stereoinfo_sg.cpp deleted file mode 100644 index 6ca2fc8da..000000000 --- a/src/imports/threed/stereoinfo_sg.cpp +++ /dev/null @@ -1,120 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stereoinfo_sg.h" -#include -#include - -QT_BEGIN_NAMESPACE - -QSGStereoInfo::QSGStereoInfo(QSGContext *context) - : m_context(context) - , m_hasStereo(false) - , m_hasPreTransform(false) -{ - QVariant v = m_context->property("hasStereo"); - if (!v.isNull()) - m_hasStereo = v.toBool(); - - v = m_context->property("hasPreTransform"); - if (!v.isNull()) - m_hasPreTransform = v.toBool(); - - const QMetaObject *meta = m_context->metaObject(); - m_eyeProperty = meta->property(meta->indexOfProperty("eye")); -} - -QSGStereoInfo::~QSGStereoInfo() -{ -} - -/*! - \fn QSGContext *QSGStereoInfo::context() const - - Returns the scene graph rendering context that is being tracked - by this information object. - - \internal -*/ - -/*! - \fn bool QSGStereoInfo::hasStereo() const - - Returns true if context() supports stereo rendering; false otherwise. - - \sa eye() - \internal -*/ - -/*! - \fn bool QSGStereoInfo::hasPreTransform() const - - Returns true if context() supports the pre-multiplied transformation - node type QSGPreTransformNode; false otherwise. Pre-multiplied - transformations are used to assist with implementing FloatingItem. - - \internal -*/ - -/*! - Returns the current eye that is being rendered. If context() does - not support stereo, then QGL::NoEye is returned. Otherwise - QGL::LeftEye or QGL::RightEye is returned. - - This function is normally called from a scene graph node's preprocess() - function to adjust the behavior of the node depending upon which - eye is currently being rendered. - - \sa hasStereo() - \internal -*/ -QGL::Eye QSGStereoInfo::eye() const -{ - // The "eye" property is assumed to be of type "int" with values - // 0, 1, and 2, which we cast to NoEye, LeftEye, and RightEye. - QVariant v = m_eyeProperty.read(m_context); - if (v.isNull()) - return QGL::NoEye; - else - return QGL::Eye(v.toInt()); -} - -QT_END_NAMESPACE diff --git a/src/imports/threed/stereoinfo_sg.h b/src/imports/threed/stereoinfo_sg.h deleted file mode 100644 index 74cc60bab..000000000 --- a/src/imports/threed/stereoinfo_sg.h +++ /dev/null @@ -1,80 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef STEREOINFO_SG_H -#define STEREOINFO_SG_H - -#include - -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QSGContext; - -class QSGStereoInfo -{ -public: - explicit QSGStereoInfo(QSGContext *context); - ~QSGStereoInfo(); - - QSGContext *context() const { return m_context; } - - bool hasStereo() const { return m_hasStereo; } - bool hasPreTransform() const { return m_hasPreTransform; } - - QGL::Eye eye() const; - -private: - QSGContext *m_context; - bool m_hasStereo; - bool m_hasPreTransform; - QMetaProperty m_eyeProperty; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/threed/stereoview.cpp b/src/imports/threed/stereoview.cpp deleted file mode 100644 index fc208f435..000000000 --- a/src/imports/threed/stereoview.cpp +++ /dev/null @@ -1,339 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stereoview.h" -#include "stereovieweffect.h" -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \qmlclass StereoView StereoView - \brief The StereoView item defines the layout of a view with left and right stereo eye images. - \since 4.8 - \ingroup qt3d::qml3d - - StereoView provides the logic to double-render the entire - application, firstly from the perspective of the left eye, - and then secondly from the perspective of the right eye. - By default, if the hardware does not support stereo, the - view will be drawn using red/cyan anaglyph filters as - shown in the following example: - - \snippet declarative/stereo/stereo.qml 1 - \dots - \snippet declarative/stereo/stereo.qml 2 - - \image stereo-screenshot-qml.png - - We could change this to double-wide stereo with the - \l layout property: - - \snippet declarative/stereo/stereo.qml 3 - \snippet declarative/stereo/stereo.qml 4 - \dots - \snippet declarative/stereo/stereo.qml 2 - - \image stereo-screenshot-qml2.png - - 2D items are placed within the 3D visual field using the - FloatingItem element and the \l{FloatingItem::depth}{depth} - property: - - \snippet declarative/stereo/stereo.qml 5 - - Negative depth values define distances behind the - \i{center of focus} of our scene, and positive depth - values define distances in front of the center of focus. - The center of focus corresponds to where the left and right - eye images coincide at depth 0. Usually the most important - item on the screen is placed at depth 0 so that the user's - attention is immediately drawn to it. Other items then - \i{float above} (positive depth) or \i{appear behind} - (negative depth) the center of focus. - - As a general rule, children of the StereoView element - should appear in \i{bottom up order}, from the most negative - depth to the most positive. This will ensure that the children - are painted correctly at their respective depths. - - \bold{Note:} StereoView is not supported with Qt Quick 2.0 as the - standard view classes are already stereo-aware. - - \sa FloatingItem, Viewport, {QML Stereo Viewing Example} -*/ - -/*! - \internal -*/ -StereoView::StereoView(QDeclarativeItem *parent) - : QDeclarativeItem(parent) - , m_layout(StereoView::Default) - , m_eye(QGL::NoEye) -{ - // We need paint() to be called to switch to an OpenGL viewport. - setFlag(QGraphicsItem::ItemHasNoContents, false); - - // Create a viewport item that defines the width and height - // of a single eye image. Our item children are parented here. - m_viewport = new QDeclarativeItem(this); - - // Create a QGraphicsEffect for performing the double-render. - m_effect = new StereoViewEffect(this); - setGraphicsEffect(m_effect); -} - -/*! - \internal -*/ -StereoView::~StereoView() -{ -} - -/*! - \qmlproperty enumeration StereoView::layout - - This property defines the layout of the left and right eye - images within this stereo view, and the relative size of - the \l viewport. - - \list - \o \c Default - the stereo layout is determined by the hardware. - If the hardware is incapable of stereo, \c RedCyan will - be used instead. The viewport size is determined by the - hardware type. This is the default setting. - \o \c Hardware - the stereo layout is determined by the - hardware. If the hardware is incapable of stereo, then - stereo rendering will be disabled rather than use \c RedCyan. - The viewport size is determined by the hardware type. - \o \c RedCyan - render the left eye image with a red filter and the - right eye image with a cyan filter, which makes the result - suitable for viewing with red/cyan anaglyph glasses. - The viewport occupies the entire StereoView. - \o \c LeftRight - the left and right eye images are rendered into - the left and right halves of the StereoView, with the - viewport occupying half the width and the full height. - \o \c RightLeft - the left and right eye images are rendered into - the right and left halves of the StereoView, with the - viewport occupying half the width and the full height. - \o \c TopBottom - the left and right eye images are rendered into - the top and bottom halves of the StereoView, with the - viewport occupying the full width and half the height. - \o \c BottomTop - the left and right eye images are rendered into - the bottom and top halves of the StereoView, with the - viewport occupying the full width and half the height. - \o \c StretchedLeftRight - same as LeftRight, but the two eye - halves are stretched to twice their original width. - \o \c StretchedRightLeft - same as RightLeft, but the two eye - halves are stretched to twice their original width. - \o \c StretchedTopBottom - same as TopBottom, but the two eye - halves are stretched to twice their original height. - \o \c StretchedBottomTop - same as BottomTop, but the two eye - halves are stretched to twice their original height. - \o \c Disabled - stereo rendering is disabled, depth values on - FloatingItem elements will be ignored, and the viewport - occupies the entire StereoView. - \endlist -*/ - -void StereoView::setLayout(StereoView::Layout layout) -{ - if (m_layout != layout) { - m_layout = layout; - updateViewportSize(); - emit layoutChanged(); - update(); - } -} - -/*! - \internal -*/ -QDeclarativeListProperty StereoView::stereoViewData() -{ - // Return the "data" property for the viewport, which is - // where we add all of the item children. - return m_viewport->property("data").value< QDeclarativeListProperty >(); -} - -/*! - \qmlproperty Item StereoView::viewport - - This property defines the extent and position of the eye - image viewport. All child items are parented under the viewport, - and should be positioned within it. In the following example, - the viewport will be the left half of the extent of the StereoView; - i.e. (0, 0, 360, 640). - - \code - StereoView { - layout: StereoView.LeftRight - width: 720; height: 640 - Rectangle { - anchors.fill: viewport - ... - } - } - \endcode - - The viewport property also appears as the \c parent property - of the children, so the following is equivalent: - - \code - StereoView { - layout: StereoView.LeftRight - width: 720; height: 640 - Rectangle { - anchors.fill: parent - ... - } - } - \endcode -*/ - -/*! - \internal - Finds the StereoView surrounding a specific \a item, usually - an instance of FloatingItem. -*/ -StereoView *StereoView::findView(QDeclarativeItem *item) -{ - while (item != 0) { - StereoView *view = qobject_cast(item); - if (view) - return view; - item = item->parentItem(); - } - return 0; -} - -/*! - \internal -*/ -void StereoView::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *widget) -{ - if (m_layout != RedCyan && m_layout != Default) - return; - - // Using a red-cyan effect, for which we must have OpenGL rendering. - // Or using the default layout, which is either hardware stereo - // or red-cyan. We need an OpenGL viewport for both. - QPaintEngine *engine = painter->paintEngine(); - if (engine->type() != QPaintEngine::OpenGL && - engine->type() != QPaintEngine::OpenGL2) { - if (widget) { - // Switch the surrounding QGraphicsView to use a QGLWidget as its - // viewport. We cannot do it here during painting, so schedule a - // slot to switch it the next time we reach the event loop. - QGraphicsView *view = - qobject_cast(widget->parentWidget()); - if (view) { - QTimer::singleShot(0, this, SLOT(switchToOpenGL())); - return; - } - } - } -} - -/*! - \internal -*/ -void StereoView::switchToOpenGL() -{ - // If there are multiple StereoView's in the QML, then it is - // possible that another StereoView has already switched to QGLWidget. - QList views = scene()->views(); - if (!views.isEmpty()) { - QGLWidget *glw = qobject_cast(views[0]->viewport()); - if (glw) - return; - bool focused = views[0]->viewport()->hasFocus(); - QGLFormat format = QGLFormat::defaultFormat(); - if (m_layout == Default) - format.setStereo(true); // Request hardware stereo if available. - views[0]->setViewport(new QGLWidget(format, views[0])); - if (focused) - views[0]->viewport()->setFocus(); - } -} - -/*! - \internal -*/ -qreal StereoView::aspectRatioAdjustment() const -{ - switch (m_layout) { - case StretchedLeftRight: case StretchedRightLeft: return 2.0f; - case StretchedTopBottom: case StretchedBottomTop: return 0.5f; - default: return 1.0f; - } -} - -/*! - \internal -*/ -void StereoView::geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry) -{ - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); - updateViewportSize(); -} - -/*! - \internal -*/ -void StereoView::updateViewportSize() -{ - qreal w = width(); - qreal h = height(); - switch (m_layout) { - case LeftRight: case RightLeft: w /= 2.0f; break; - case TopBottom: case BottomTop: h /= 2.0f; break; - default: break; - } - m_viewport->setSize(QSizeF(w, h)); -} - -QT_END_NAMESPACE diff --git a/src/imports/threed/stereoview.h b/src/imports/threed/stereoview.h deleted file mode 100644 index 5e9ef3705..000000000 --- a/src/imports/threed/stereoview.h +++ /dev/null @@ -1,124 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef STEREOVIEW_H -#define STEREOVIEW_H - -#include - -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class StereoViewEffect; - -class StereoView : public QDeclarativeItem -{ - Q_OBJECT - Q_ENUMS(Layout) - Q_PROPERTY(Layout layout READ layout WRITE setLayout NOTIFY layoutChanged) - Q_PROPERTY(QGraphicsObject *viewport READ viewport NOTIFY viewportChanged) - Q_PROPERTY(QDeclarativeListProperty stereoViewData READ stereoViewData DESIGNABLE false) - Q_CLASSINFO("DefaultProperty", "stereoViewData") -public: - StereoView(QDeclarativeItem *parent = 0); - ~StereoView(); - - enum Layout - { - Default, - Hardware, - RedCyan, - LeftRight, - RightLeft, - TopBottom, - BottomTop, - StretchedLeftRight, - StretchedRightLeft, - StretchedTopBottom, - StretchedBottomTop, - Disabled - }; - - StereoView::Layout layout() const { return m_layout; } - void setLayout(StereoView::Layout layout); - - QGraphicsObject *viewport() const { return m_viewport; } - - QGL::Eye eye() const { return m_eye; } - void setEye(QGL::Eye eye) { m_eye = eye; } - - QDeclarativeListProperty stereoViewData(); - - static StereoView *findView(QDeclarativeItem *item); - - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); - - qreal aspectRatioAdjustment() const; - -Q_SIGNALS: - void layoutChanged(); - void viewportChanged(); - -private Q_SLOTS: - void switchToOpenGL(); - -protected: - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - -private: - StereoView::Layout m_layout; - QGL::Eye m_eye; - QDeclarativeItem *m_viewport; - StereoViewEffect *m_effect; - - void updateViewportSize(); -}; - -QML_DECLARE_TYPE(StereoView) - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/threed/stereovieweffect.cpp b/src/imports/threed/stereovieweffect.cpp deleted file mode 100644 index 3670b6a79..000000000 --- a/src/imports/threed/stereovieweffect.cpp +++ /dev/null @@ -1,175 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stereovieweffect.h" -#include -#include -#include - -StereoViewEffect::StereoViewEffect(StereoView *parent) - : QGraphicsEffect(parent) - , m_view(parent) -{ -} - -StereoViewEffect::~StereoViewEffect() -{ -} - -void StereoViewEffect::draw(QPainter *painter) -{ - // Determine if we have an OpenGL rendering surface or not. - QPaintEngine *engine = painter->paintEngine(); - bool isOpenGL = (engine->type() == QPaintEngine::OpenGL || - engine->type() == QPaintEngine::OpenGL2); - - // Determine how to draw the two eye images. - StereoView::Layout layout = m_view->layout(); - if (layout == StereoView::RedCyan) { - // Draw the scene twice with red and cyan filters. - if (isOpenGL) { - m_view->setEye(QGL::LeftEye); - glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); - drawSource(painter); - m_view->setEye(QGL::RightEye); - glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); - drawSource(painter); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - m_view->setEye(QGL::NoEye); - } else { - // No OpenGL, so draw normally. - drawSource(painter); - } - } else if (layout == StereoView::Default || - layout == StereoView::Hardware) { - // Draw the scene into the left and right back buffers. -#if defined(GL_BACK_LEFT) && defined(GL_BACK_RIGHT) - if (isOpenGL && QGLContext::currentContext()->format().stereo()) { - m_view->setEye(QGL::LeftEye); - glDrawBuffer(GL_BACK_LEFT); - drawSource(painter); - m_view->setEye(QGL::RightEye); - glDrawBuffer(GL_BACK_RIGHT); - drawSource(painter); - m_view->setEye(QGL::NoEye); - } else -#endif - if (isOpenGL && layout == StereoView::Default) { - // No hardware stereo, so use red-cyan instead. - m_view->setEye(QGL::LeftEye); - glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); - drawSource(painter); - m_view->setEye(QGL::RightEye); - glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); - drawSource(painter); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - m_view->setEye(QGL::NoEye); - } else { - // No OpenGL or red-cyan not allowed, so draw normally. - drawSource(painter); - } - } else if (layout != StereoView::Disabled) { - // Fetch the original window and viewport from the painter. - // We then use these values to set up an alternative logical - // co-ordinate system that shifts drawing into the left or - // right screen halves. - QRect window = painter->window(); - QRect viewport = painter->viewport(); - QRect leftViewport(viewport); - QRect rightViewport(viewport); - switch (layout) { - case StereoView::LeftRight: default: - window.setWidth(window.width() / 2); - // Fall through. - case StereoView::StretchedLeftRight: - leftViewport.setWidth(viewport.width() / 2); - rightViewport.setX(leftViewport.right() + 1); - rightViewport.setWidth(viewport.width() - leftViewport.width()); - break; - case StereoView::RightLeft: - window.setWidth(window.width() / 2); - // Fall through. - case StereoView::StretchedRightLeft: - rightViewport.setWidth(viewport.width() / 2); - leftViewport.setX(rightViewport.right() + 1); - leftViewport.setWidth(viewport.width() - rightViewport.width()); - break; - case StereoView::TopBottom: - window.setHeight(window.height() / 2); - // Fall through. - case StereoView::StretchedTopBottom: - leftViewport.setHeight(viewport.height() / 2); - rightViewport.setY(leftViewport.bottom() + 1); - rightViewport.setHeight(viewport.height() - leftViewport.height()); - break; - case StereoView::BottomTop: - window.setHeight(window.height() / 2); - // Fall through. - case StereoView::StretchedBottomTop: - rightViewport.setHeight(viewport.height() / 2); - leftViewport.setY(rightViewport.bottom() + 1); - leftViewport.setHeight(viewport.height() - rightViewport.height()); - break; - } - - // Draw the left eye image into one half of the screen. - m_view->setEye(QGL::LeftEye); - painter->save(); - painter->setWindow(window); - painter->setViewport(leftViewport); - painter->setClipRect(window, Qt::IntersectClip); - drawSource(painter); - painter->restore(); - - // Draw the right eye image into the other half of the screen. - m_view->setEye(QGL::RightEye); - painter->save(); - painter->setWindow(window); - painter->setViewport(rightViewport); - painter->setClipRect(window, Qt::IntersectClip); - drawSource(painter); - painter->restore(); - m_view->setEye(QGL::NoEye); - } else { - // Stereo rendering has been explicitly disabled. - drawSource(painter); - } -} diff --git a/src/imports/threed/stereovieweffect.h b/src/imports/threed/stereovieweffect.h deleted file mode 100644 index fab8706be..000000000 --- a/src/imports/threed/stereovieweffect.h +++ /dev/null @@ -1,70 +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$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, 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. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef STEREOVIEWEFFECT_H -#define STEREOVIEWEFFECT_H - -#include -#include "stereoview.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class StereoViewEffect : public QGraphicsEffect -{ - Q_OBJECT -public: - StereoViewEffect(StereoView *parent = 0); - ~StereoViewEffect(); - -protected: - void draw(QPainter *painter); - -private: - StereoView *m_view; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif diff --git a/src/imports/threed/threed.cpp b/src/imports/threed/threed.cpp index d6dd2f72f..321e2a001 100644 --- a/src/imports/threed/threed.cpp +++ b/src/imports/threed/threed.cpp @@ -59,8 +59,6 @@ #include "qgraphicslookattransform.h" #include "shaderprogram.h" #include "qt3dnamespace.h" -#include "floatingitem.h" -#include "stereoview.h" #if defined(QML_VERSION) && QML_VERSION >= 0x020000 #define QT_USE_SCENEGRAPH 1 #include "floatingitem_sg.h" @@ -103,8 +101,6 @@ public: qmlRegisterType(uri,1,0,"ShaderProgram"); qmlRegisterType(uri,1,0,"Viewport"); - qmlRegisterType(uri,1,0,"FloatingItem"); - qmlRegisterType(uri,1,0,"StereoView"); // Needed to make QDeclarativeListProperty work. qmlRegisterType(); @@ -112,7 +108,6 @@ public: #ifdef QT_USE_SCENEGRAPH qmlRegisterType(uri,2,0,"Viewport"); - qmlRegisterType(uri,2,0,"FloatingItem"); #endif } void initializeEngine(QDeclarativeEngine *engine, const char *uri) diff --git a/src/imports/threed/threed.pro b/src/imports/threed/threed.pro index dddcd71c9..de6290df8 100644 --- a/src/imports/threed/threed.pro +++ b/src/imports/threed/threed.pro @@ -24,10 +24,6 @@ SOURCES += \ qt3dnamespace.cpp \ scale3d.cpp \ viewport.cpp \ - floatingitem.cpp \ - floatingitemeffect.cpp \ - stereoview.cpp \ - stereovieweffect.cpp \ qgraphicslookattransform.cpp \ shaderprogram.cpp @@ -35,25 +31,15 @@ HEADERS += \ qt3dnamespace.h \ scale3d.h \ viewport.h \ - floatingitem.h \ - floatingitemeffect.h \ - stereoview.h \ - stereovieweffect.h \ qgraphicslookattransform.h \ shaderprogram.h \ shaderprogram_p.h scenegraph { SOURCES += \ - floatingitem_sg.cpp \ - floatingitemnode_sg.cpp \ - stereoinfo_sg.cpp \ viewport_sg.cpp \ viewportfbonode_sg.cpp HEADERS += \ - floatingitem_sg.h \ - floatingitemnode_sg.h \ - stereoinfo_sg.h \ viewport_sg.h \ viewportfbonode_sg.h } diff --git a/src/imports/threed/viewport.cpp b/src/imports/threed/viewport.cpp index 9d2ecdb11..74cb06eb9 100644 --- a/src/imports/threed/viewport.cpp +++ b/src/imports/threed/viewport.cpp @@ -41,7 +41,6 @@ #include "viewport.h" #include "qdeclarativeeffect.h" -#include "stereoview.h" #include #include @@ -84,7 +83,7 @@ } \endcode - \sa Camera, StereoView + \sa Camera */ QT_BEGIN_NAMESPACE @@ -439,17 +438,8 @@ void Viewport::paint(QPainter *p, const QStyleOptionGraphicsItem * style, QWidge if (!d->itemsInitialized) initializeGL(&painter); - // If this Viewport is surrounded by a StereoView item, - // then fetch the eye to be rendered from it. - StereoView *stereoView = StereoView::findView(this); - qreal adjust; - if (stereoView) { - painter.setEye(stereoView->eye()); - adjust = stereoView->aspectRatioAdjustment(); - } else { - painter.setEye(QGL::NoEye); - adjust = 1.0f; - } + painter.setEye(QGL::NoEye); + qreal adjust = 1.0f; // Modify the GL viewport to only cover the extent of this QDeclarativeItem. QTransform transform = p->combinedTransform(); diff --git a/src/quick3d/quick3d.pro b/src/quick3d/quick3d.pro index 4812aef3c..ec4d699eb 100644 --- a/src/quick3d/quick3d.pro +++ b/src/quick3d/quick3d.pro @@ -39,9 +39,9 @@ DEFINES += QT_BUILD_QT3D_QUICK_LIB !contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL INSTALL_HEADERS = "" -for (hdr, PUBLIC_HEADERS) { +for(hdr, PUBLIC_HEADERS) { found_vdir = $$PWD - for (vdir, VPATH) { + for(vdir, VPATH) { found_vdir = $$vdir exists($$found_vdir/$$hdr):break() } diff --git a/src/threed/graphicsview/qgraphicsbillboardtransform.cpp b/src/threed/graphicsview/qgraphicsbillboardtransform.cpp index 7072e526f..3d4f27ce9 100644 --- a/src/threed/graphicsview/qgraphicsbillboardtransform.cpp +++ b/src/threed/graphicsview/qgraphicsbillboardtransform.cpp @@ -134,8 +134,6 @@ QT_BEGIN_NAMESPACE effect: Effect { texture: "picture.jpg" } } \endcode - - \sa {Forest Example} */ class QGraphicsBillboardTransformPrivate diff --git a/src/threed/scene/qglabstractscene.cpp b/src/threed/scene/qglabstractscene.cpp index 9f18749a0..5573cf246 100644 --- a/src/threed/scene/qglabstractscene.cpp +++ b/src/threed/scene/qglabstractscene.cpp @@ -45,7 +45,7 @@ #include #include -#include +//#include #include #include #include diff --git a/src/threed/threed.pro b/src/threed/threed.pro index 00e8d60c4..d4e908f5f 100644 --- a/src/threed/threed.pro +++ b/src/threed/threed.pro @@ -30,6 +30,7 @@ symbian { } } +include(../private/private.pri) include(threed.pri) PUBLIC_HEADERS = $$HEADERS HEADERS += $$PRIVATE_HEADERS @@ -38,9 +39,9 @@ DEFINES += QT_BUILD_Qt3D_LIB !contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL INSTALL_HEADERS = "" -for (hdr, PUBLIC_HEADERS) { +for(hdr, PUBLIC_HEADERS) { found_vdir = $$PWD - for (vdir, VPATH) { + for(vdir, VPATH) { found_vdir = $$vdir exists($$found_vdir/$$hdr):break() } diff --git a/src/threed/viewing/qglview.cpp b/src/threed/viewing/qglview.cpp index 044aca960..3eb78d8dd 100644 --- a/src/threed/viewing/qglview.cpp +++ b/src/threed/viewing/qglview.cpp @@ -83,6 +83,8 @@ QT_BEGIN_NAMESPACE \section1 Stereo viewing support + Note - Stereo viewing is experimental and unsupported. + If the hardware supports stereo buffers, then each time the scene needs to be painted, QGLView renders it twice: first from the perspective of the left eye, and then from the perspective of the right eye. @@ -162,8 +164,6 @@ QT_BEGIN_NAMESPACE If the application sets the stereo type with setStereoType(), that will be used. Next is the command-line setting, and finally the contents of the environment variable. - - \sa {Stereo Viewing Example} */ /*! -- cgit v1.2.3