<?xml version="1.0" encoding="UTF-8" ?>
<plugin id="tuto16_scene_qt3d">
    <requirement id="sight::module::service" />
    <requirement id="sight::module::ui::qt" />
    <requirement id="sight::module::io::vtk" />
    <requirement id="sight::module::io::session" />

    <extension implements="sight::service::extension::config">
        <id>Tuto16SceneQt3D_Sightdata_SrvCfg</id>
        <desc>Sight data</desc>
        <config>
            <dialog extension=".sight" description="Sight data" policy="default" />
            <password policy="default" encryption="default" />
        </config>
    </extension>

    <extension implements="sight::service::extension::config">
        <id>Tuto16SceneQt3D_vtk_SrvCfg</id>
        <desc>VTK</desc>
        <config>
            <windowTitle>Open VTK file</windowTitle>
        </config>
    </extension>

    <extension implements="sight::app::extension::config">
        <id>Tuto16SceneQt3D_AppCfg</id>
        <config>
            <!-- ******************************* Objects declaration ****************************** -->

            <object uid="mesh" type="sight::data::mesh" />
            <object uid="material" type="sight::data::material" />

            <!-- ******************************* UI declaration *********************************** -->

            <service uid="mainView" type="sight::module::ui::frame">
                <gui>
                    <frame>
                        <name>tuto16_scene_qt3d</name>
                        <icon>tuto16_scene_qt3d/tuto.ico</icon>
                        <minSize width="1080" height="720" />
                    </frame>
                    <menubar />
                </gui>
                <registry>
                    <menubar sid="menuBarView" start="true" />
                    <view sid="genericSceneSrv" start="true" />
                </registry>
            </service>

            <service uid="menuBarView" type="sight::module::ui::menubar">
                <gui>
                    <layout>
                        <menu name="File" />
                    </layout>
                </gui>
                <registry>
                    <menu sid="menuFileView" start="true" />
                </registry>
            </service>

            <service uid="menuFileView" type="sight::module::ui::menu">
                <gui>
                    <layout>
                        <menuItem name="Open mesh" shortcut="Ctrl+O" />
                        <separator />
                        <menuItem name="Quit" specialAction="QUIT" shortcut="Ctrl+Q" />
                    </layout>
                </gui>
                <registry>
                    <menuItem sid="meshReaderAct" start="true" />
                    <menuItem sid="quitAct" start="true" />
                </registry>
            </service>

            <!-- ******************************* Begin Generic scene ******************************* -->

            <service uid="genericSceneSrv" type="sight::viz::qt3d::render">
                <scene>
                    <background color="#2d2d2d" />

                    <adaptor uid="meshAdp" />
                    <adaptor uid="materialAdp" />
                </scene>
            </service>

            <service uid="materialAdp" type="sight::module::viz::qt3d::adaptor::material" auto_connect="true">
                <inout key="material" uid="material" />
                <config materialName="mat" />
            </service>

            <service uid="meshAdp" type="sight::module::viz::qt3d::adaptor::mesh" auto_connect="true">
                <inout key="mesh" uid="mesh" />
                <config autoresetcamera="true" visible="true" materialName="mat" />
            </service>

            <!-- ******************************* Actions ****************************************** -->

            <service uid="meshReaderAct" type="sight::module::ui::io::selector">
                <inout key="data" uid="mesh" />
                <type mode="reader" />
                <config id="Tuto16SceneQt3D_Sightdata_SrvCfg" service="sight::module::io::session::reader" />
                <config id="Tuto16SceneQt3D_vtk_SrvCfg" service="sight::module::io::vtk::mesh_reader" />
            </service>

            <service uid="quitAct" type="sight::module::ui::quit" />

            <!-- ******************************* Start services ***************************************** -->

            <start uid="mainView" />
            <start uid="materialAdp" />
            <start uid="meshAdp" />
        </config>
    </extension>
</plugin>
