summaryrefslogtreecommitdiffstats
path: root/doc/src/examples
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/examples')
-rw-r--r--doc/src/examples/basket.qdoc80
-rw-r--r--doc/src/examples/nesting.qdoc134
-rw-r--r--doc/src/examples/teapot-qml.qdoc73
-rw-r--r--doc/src/examples/teapot.qdoc101
4 files changed, 0 insertions, 388 deletions
diff --git a/doc/src/examples/basket.qdoc b/doc/src/examples/basket.qdoc
deleted file mode 100644
index 92a429a3..00000000
--- a/doc/src/examples/basket.qdoc
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** This file is part of the QtQuick3D documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms
-** and conditions contained in a signed written agreement between you
-** and Nokia.
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example quick3d/basket
- \title Basket Example
-
- \section2 Basket in QtQuick3D
-
- 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 quick3d/basket/qml/basket.qml 1
-
- We then add an \l Item3D object to load the basket model and
- apply the desired texture to it:
-
- \snippet quick3d/basket/qml/basket.qml 2
-
- And then we apply an animation to the rotation component of
- the item's transform property:
-
- \snippet quick3d/basket/qml/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{qt3d/teapot}{Hello Teapot} example. In this case, we create
- the basket object and add a texture to it as follows:
-
- \snippet qt3d/basket/basketview.cpp 1
-
- For this animation, we want to spin the basket around its Y axis,
- once every 2 seconds. We first declare an \c angle property in the
- class declaration (calling \c{update()} will force the view to
- redraw whenever the angle changes):
-
- \snippet qt3d/basket/basketview.h 1
-
- Then we create a QPropertyAnimation object that will update
- \c angle every time through the event loop with a new value
- between 0 and 360 degrees:
-
- \snippet qt3d/basket/basketview.cpp 2
-
- Now all we have to do is draw the basket using the \c angle
- property every time \c{paintGL()} is called:
-
- \snippet qt3d/basket/basketview.cpp 3
-
- \image basket-screenshot.png
-
- \l{qt3d-examples.html}{Return to Examples}.
-*/
diff --git a/doc/src/examples/nesting.qdoc b/doc/src/examples/nesting.qdoc
deleted file mode 100644
index b4438bb8..00000000
--- a/doc/src/examples/nesting.qdoc
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** This file is part of the QtQuick3D documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms
-** and conditions contained in a signed written agreement between you
-** and Nokia.
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example qt3d/nesting
- \title Drawing into framebuffer objects
-
- 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{Object Effects}{Cube} - applying transformations and materials to objects.
- \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{Object Effects}{Cube} example,
- and the other cube will display a nested scene containing a
- rotating teapot.
-
- \image nesting-screenshot.png
-
- As with the other examples, we start by creating the geometric objects
- we need in the constructor (we will share the cube geometry between
- the two cubes we will be drawing):
-
- \snippet qt3d/nesting/cubeview.cpp 1
-
- We also need three QPropertyAnimation objects to drive our
- animations; rotation angle for the teapot, rotation angle for
- the cube; orbit angle of the two cubes around each other:
-
- \snippet qt3d/nesting/cubeview.cpp 2
-
- The final step in the constructor is to create a camera for
- the nested scene we will be drawing into the framebuffer object.
- This is in addition to the default QGLView::camera() object that
- provides the camera for the main scene.
-
- \snippet qt3d/nesting/cubeview.cpp 3
-
- To draw the nested scene, we of course need a framebuffer object,
- which we create in the \c{initializeGL()} method:
-
- \snippet qt3d/nesting/cubeview.cpp 4
-
- Note that we also set the framebuffer object on an instance of
- QGLFramebufferObjectSurface. We will use this fact later when
- we render the nested scene.
-
- For the other cube, we need a regular texture. And we'll also
- turn on blending to make our cubes transparent:
-
- \snippet qt3d/nesting/cubeview.cpp 5
-
- Now it is time to paint the scene in \c{paintGL()}. The first
- thing we want to do is draw the teapot into the framebuffer object.
- To do that, we need to establish a nested drawing state:
-
- \snippet qt3d/nesting/cubeview.cpp 6
-
- In the code above, we first push the main scene's modelview and
- projection matrices. And then we push a new drawing surface onto
- the painter's surface stack. Everything we draw from now on will
- be written to \c{fboSurface} and thus the framebuffer object.
- To do that, we set the inner camera position, adjust the painter
- state, clear the framebuffer object, and draw the teapot:
-
- \snippet qt3d/nesting/cubeview.cpp 7
-
- Now that the nested scene has been drawn to the framebuffer object,
- we pop the surface and matrix stacks to return to the main scene:
-
- \snippet qt3d/nesting/cubeview.cpp 8
-
- Because our cubes are transparent, we need to make sure we draw
- the objects in the scene from back to front. Otherwise the result
- will not look correct. To do this, we check which of the cube
- mid-points is furtherest away from the camera and draw that cube first
- (the more negative the z value, the further away it is):
-
- \snippet qt3d/nesting/cubeview.cpp 9
-
- Drawing the first cube with the simple texture is very similar to
- the \l{Object Effects}{Cube} example:
-
- \snippet qt3d/nesting/cubeview.cpp 10
-
- The main interesting wrinkle is that we draw the cube twice,
- once with front faces culled, and the second time with back
- faces culled. This effectively causes the cube to be drawn
- back to front for proper blending.
-
- The second cube is drawn in a similar way except that we bind
- the framebuffer object's texture to the state instead of a static
- texture:
-
- \snippet qt3d/nesting/cubeview.cpp 11
-
- Face culling is a simple way to draw transparent objects, but it
- really only works on non-intersecting convex objects like our cubes.
- For concave objects (like the teapot) or objects that intersect,
- we would need to break the objects up into smaller convex pieces
- and then order the pieces from back to front.
-
- \l{qt3d-examples.html}{Return to Examples}.
-*/
diff --git a/doc/src/examples/teapot-qml.qdoc b/doc/src/examples/teapot-qml.qdoc
deleted file mode 100644
index 5374edb7..00000000
--- a/doc/src/examples/teapot-qml.qdoc
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** This file is part of the QtQuick3D documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms
-** and conditions contained in a signed written agreement between you
-** and Nokia.
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example quick3d/teapot_qml
- \title Teapot Example in QtQuick3D
-
- This example shows to use QtQuick3D to display a teapot on
- the screen. The QML is fairly simple:
-
- \snippet quick3d/teapot_qml/qml/teapot.qml 1
-
- \image teapot-qml-screenshot.png
-
- The example starts by importing the Qt and Qt3D QML modules:
-
- \snippet quick3d/teapot_qml/qml/teapot.qml 2
-
- Then we create a viewport of size 640x480 to display the teapot:
-
- \snippet quick3d/teapot_qml/qml/teapot.qml 3
-
- And now we create a \l Item3D to display the teapot with a
- default lit material effect:
-
- \snippet quick3d/teapot_qml/qml/teapot.qml 4
-
- The teapot data itself is loaded from \c{teapot.bez}, which contains
- Bezier patch data that describes the geometry of the teapot.
-
- Let's make the teapot a little more interesting by adding a
- material to simulate bone china:
-
- \snippet quick3d/teapot_bounce_qml/qml/teapot-bounce.qml 1
- \snippet quick3d/teapot_bounce_qml/qml/teapot-bounce.qml 2
-
- \image teapot-china-screenshot.png
-
- To make the teapot even more interesting, we can cause it to
- bounce up and down using a QML animation item:
-
- \snippet quick3d/teapot_bounce_qml/qml/teapot-bounce.qml 3
-
- This QML teapot example can be compared with the \l{qt3d/teapot}{C++ version}.
- Using QML is briefer than C++, and easier to modify to adjust
- materials and add new features like animations.
-
- \l{qt3d-examples.html}{Return to Examples}.
-*/
diff --git a/doc/src/examples/teapot.qdoc b/doc/src/examples/teapot.qdoc
deleted file mode 100644
index d85fca48..00000000
--- a/doc/src/examples/teapot.qdoc
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation ([email protected])
-**
-** This file is part of the QtQuick3D documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms
-** and conditions contained in a signed written agreement between you
-** and Nokia.
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \example qt3d/teapot
- \title Teapot Example
-
- 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 QtQuick3D}{QtQuick3D version} of the teapot
- example.
-
- We start by defining a class that inherits from QGLView, which
- provides some basic scene setup logic and 3D camera navigation:
-
- \snippet qt3d/teapot/teapotview.h class-defn
- \dots
- \quotefromfile qt3d/teapot/main.cpp
- \skipuntil [main]
- \printto [main-args]
- \skipuntil [main-args-end]
- \printto [main]
-
- When the application starts up, we set up some scene parameters
- in the \c{initializeGL()} function:
-
- \quotefromfile qt3d/teapot/teapotview.cpp
- \skipuntil [initialize]
- \printto [build-geometry]
-
- The first line of the function selects a standard rendering
- effect that lights material colors with the default OpenGL
- two-sided lighting algorithm and the default light.
-
- The \c{teapot} member variable is an instance of QGLSceneNode,
- which we create using QGLBuilder during \c{initializeGL()}:
-
- \quotefromfile qt3d/teapot/teapotview.cpp
- \skipuntil [build-geometry]
- \printto [initialize]
-
- The QGLTeapot class represents the geometry for the teapot,
- which is added to the builder with the \c{<<} operator.
-
- We then call QGLBuilder::finalizedSceneNode() to finalize the
- object, prepare it to be uploaded to the GL server as a
- vertex buffer, and hand over ownership of the scene node.
-
- We have to take care to clean up our scene after we're done with it
- and here that is done in the destructor:
-
- \snippet qt3d/teapot/teapotview.cpp destructor
-
- Finally, we paint the teapot every time the window is refreshed:
-
- \snippet qt3d/teapot/teapotview.cpp paint
-
- The QGLView class has in-built support for camera navigation
- using the mouse and keyboard. By clicking and dragging the mouse,
- the teapot can be rotated into any position. The image on the
- left shows the view in its startup default position, and the
- image on the right shows the view after rotation using the mouse:
-
- \raw HTML
- <center><table><tr><td>
- \endraw
- \image teapot-screenshot.png
- \raw HTML
- </td><td>
- \endraw
- \image teapot-rotated.png
- \raw HTML
- </td></tr></table></center>
- \endraw
-
- \l{qt3d-examples.html}{Return to Examples}.
-*/