// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \example scenegraph/customrendernode
    \title Scene Graph - Custom QSGRenderNode
    \examplecategory {Graphics & Multimedia}
    \ingroup qtquickexamples
    \brief Shows how to use QSGRenderNode to implement custom rendering in the Qt Quick scenegraph.

    The custom render node example shows how to implement an item that is rendered using
    a custom QSGRenderNode.

    \image customrendernode-example.gif

    QSGRenderNode allows direct access to the Render Hardware Interface (RHI)
    within the scenegraph. This example demonstrates how to create QSGRenderNode
    based render node and manage it with a custom item. The render node creates
    an RHI pipeline, updates vertex and uniform buffers, and renders into the
    RHI command buffer.

    In practice this is a portable, cross-platform approach to perform custom
    rendering inline with the scenegraph's own rendering, without resorting to a
    native 3D API such as OpenGL, Metal, or Vulkan. Rather, the application uses
    Qt's graphics and shader abstraction layer.

    \note This example demonstrates advanced, low-level functionality performing
    portable, cross-platform 3D rendering, while relying on APIs with limited
    compatibility guarantee from the Qt Gui module.  To be able to use the QRhi
    APIs, the application links to \c{Qt::GuiPrivate} and includes
    \c{<rhi/qrhi.h>}.

    QSGRenderNode is the enabler for one of the three ways to integrate custom
    2D/3D rendering into a Qt Quick scene. The other two options are to perform
    the rendering \c before or \c after the Qt Quick scene's own rendering,
    or to generate a whole separate render pass targeting a dedicated render
    target (a texture) and then have an item in the scene display the texture.
    The QSGRenderNode-based approach is similar to the former, in the sense
    that no additional render passes or render targets are involved, and allows
    injecting custom rendering commands "inline" with the Qt Quick scene's
    own rendering.

    \sa {Scene Graph - RHI Under QML}, {Scene Graph - RHI Texture Item}
*/
