/****************************************************************************
**
** Copyright (C) 2021 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 instancing
    \ingroup quick3d-examples
    \title Qt Quick 3D - Instanced Rendering Example
    \brief Demonstrates how to do instanced rendering in Qt Quick 3D.
    \image instancing.jpg

    This example shows how do instanced rendering using the basic QML API.

    The spaceship and asteroid models were created using the Blender 3D modeling tool, and imported with \l{Balsam Asset Import Tool}{balsam}.

    \section1 Random instancing

    We use \l {RandomInstancing} to make a random table that defines our asteroid field:

    \snippet instancing/main.qml randomInstancing

    Position and rotation are allowed to vary freely. Scaling is set to be uniform in all directions
    and colors are grayscale. This is done by setting the
    \l{InstanceRange::proportional}{proportional} attribute.

    The spaceships are placed manually using \l{InstanceList}:
    \snippet instancing/main.qml manualInstancing
    The properties of \l InstanceListEntry are bindable: here we animate the red ship so it crosses the path of the camera.

    Finally we apply the instancing tables to the objects:
    \snippet instancing/main.qml objects

    By animating the rotation of the asteroid model, all of the instances will rotate without having
    to change the contents of the instance table. Since the asteroid instances have random
    rotations, all the asteroids will rotate around different axes.
*/
