/****************************************************************************
**
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \example proceduraltexture
    \ingroup quick3d-examples
    \title Qt Quick 3D - Procedural Texture Example
    \brief Demonstrates how to provide custom texture data from C++.
    \image proceduraltexture-example.jpg

    This example makes use of QQuick3DTextureData and \l{Texture::textureData}{the
    textureData property} of Texture to provide texture data generated from C++
    instead of loading it from a static asset.

    First we define a C++ class for our texture data. We make it a subclass
    of QQuick3DTextureData. This is not stricly necessary, since there are no
    virtual functions, but it is much more convenient to have everything in
    one class. We define the properties we are going to use, and add
    \l QML_NAMED_ELEMENT to make it available from QML:

    \snippet proceduraltexture/gradienttexture.h class definition
    \dots

    We add a function to update the texture. It uses \l QQuick3DTextureData::setSize,
    and \l QQuick3DTextureData::setFormat to configure the texture, and
    \l QQuick3DTextureData::setTextureData to set the image data:
    \snippet proceduraltexture/gradienttexture.cpp updateTexture

    The function \c generateTexture creates a QByteArray of the correct size, and
    fills it with image data:
    \snippet proceduraltexture/gradienttexture.cpp generateTexture

    We call \c updateTexture each time a property is changed:
    \snippet proceduraltexture/gradienttexture.cpp property

    Finally, we can use our new texture from QML:
    \snippet proceduraltexture/main.qml model

*/
