/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt3D documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** 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.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \example quick3d/shaders
    \title Shaders Example

    \target Shaders in QML 3D
    \section2 Shaders in QML 3D

    This example demonstrates the use of inline shaders in QML using \l{Qt 3D}.
    It shows how we can animate properties on the shader to produce effects
    in our 3D scene.  To actually learn how to write GLSL shaders you'll
    need to consult the GL SL specification and resources.  Here we assume
    you know the basics of writing shaders and just want to use them in your
    3D QML programs.

    There are several examples combined into a simple tabbed viewer, and here
    we'll look at just the bouncing shader - the others are setup in a similar
    way.  First we create a teapot to have some 3D geometry for our effects to
    display on.  We give it an animated rotation so we can see it more easily
    in 3D as it moves slowly on screen.  Notice how we set an effect onto the
    teapot Item3D using the id of our shader program, defined below:

    \snippet quick3d/shaders/qml/Bouncing.qml 1

    Next we declare our actual ShaderProgram element with the id \c program.
    Then we have a custom property that is added using the \c property
    syntax of QML.  The ShaderProgram knows to take such properties and
    expose them inside the actual GLSL shader program.  We then animate
    this custom property using some NumberAnimations looping infinitely.

    \snippet quick3d/shaders/qml/Bouncing.qml 2

    To create the shader code it is included directly into the QML body
    in double quotes as the value of the vertexShader or fragmentShader
    property as shown here:

    \snippet quick3d/shaders/qml/Bouncing.qml 3

    Notice the qt_Custom uniform which is automatically bound for you.  In a
    similar way if you declare a custom property which is an image then the
    ShaderProgram will bind it for you as a sampler2D so you can access the
    image as a texture.

    \image shaders-screenshot.png

    \l{Qt 3D Tutorials and Examples}{Return to Examples}.
*/
