/****************************************************************************
**
** 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 submeshes
    \ingroup quick3d-examples
    \title Qt Quick 3D - Sub-mesh Example
    \brief Demonstrates how assign materials to sub-meshes.
    \image submeshes-example.png

    This example demonstrates how material and sub-meshes are mapped.

    \section1 Sub-meshes and materials

    When a \l Model is built up of two or more meshes, then those meshes are referred to as sub-meshes.
    Each sub-mesh can have its own material, but it's not required to provide more then one material
    per model.
    If there are more sub-meshes then there are materials, then the last material in the
    \l {Model::materials}{materials} list is used for all remeining sub-meshes. When a model is
    provided with one material per sub-mesh, then those are mapped on-to-one, meaning the first
    material in the list is applied to the first sub-mesh, the second material to the second sub-mesh,
    and so forth. How the sub-meshes are ordered in a model depends on how the model was created and
    exported by the 3D modeling tool used to create it.

    The following example shows two distored cubes where each side of the cube is a sub-mesh of its
    own.

    If we look at the cube on the left, we can see that there's one side colored \b red while the
    rest of the sides are \b green, the reason for this is of course that the material only has two
    materials, namely one red, and one green. In our model the first sub-mesh happens to be the "top"
    side of the distored cube, and since the red material is the placed first in the material list,
    it gets a red color as expected. The second material in the list is the \b green material which
    is mapped to the second sub-mesh, which is the "fron" side of the distored cube, and since it's
    the last material in the list, it will also be the material used for all the remaining sides of the distored cube.

    \image submeshes-example1.png

    \snippet submeshes/qml/main.qml DistortedCube Left

    Looking at the cube to the right we can see that it has been give some more colors, this is of
    of course because we now provided one material for each of the six sub-meshes, each with a different
    color.

    \image submeshes-example2.png

    \snippet submeshes/qml/DistortedCube.qml DistortedCube Right
*/


