<?xml version="1.0" encoding="UTF-8"?>

<plugin id="Tuto16SceneQt3D" version="@PROJECT_VERSION@" >

    <requirement id="servicesReg" />
    <requirement id="guiQt" />
    <requirement id="visuQt3DQt" />

    <extension implements="::fwServices::registry::ServiceConfig" >
        <id>Tuto16SceneQt3D_jsonReader_SrvCfg</id>
        <desc>JSON</desc>
        <config>
            <patcher />
            <windowTitle>Open JSON file</windowTitle>
        </config>
    </extension>

    <extension implements="::fwServices::registry::ServiceConfig" >
        <id>Tuto16SceneQt3D_vtk_SrvCfg</id>
        <desc>VTK</desc>
        <config>
            <windowTitle>Open VTK file</windowTitle>
        </config>
    </extension>

    <extension implements="::fwServices::registry::AppConfig" >
        <id>Tuto16SceneQt3D_AppCfg</id>
        <config>

            <!-- ******************************* Objects declaration ****************************** -->

            <object uid="mesh" type="::fwData::Mesh" />
            <object uid="material" type="::fwData::Material" />

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

            <service uid="mainView" type="::gui::frame::SDefaultFrame" >
                <gui>
                    <frame>
                        <name>Tuto16SceneQt3D</name>
                        <icon>Tuto16SceneQt3D-0.1/tuto.ico</icon>
                        <minSize width="1080" height="720" />
                    </frame>
                    <menuBar/>
                </gui>
                <registry>
                    <menuBar sid="menuBarView" start="yes" />
                    <view sid="genericSceneSrv" start="yes" />
                </registry>
            </service>

            <service uid="menuBarView" type="::gui::aspect::SDefaultMenuBar" >
                <gui>
                    <layout>
                        <menu name="File" />
                    </layout>
                </gui>
                <registry>
                    <menu sid="menuFileView" start="yes" />
                </registry>
            </service>

            <service uid="menuFileView" type="::gui::aspect::SDefaultMenu" >
                <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="yes" />
                    <menuItem sid="quitAct" start="yes" />
                </registry>
            </service>

            <!-- ******************************* Begin Generic Scene ******************************* -->

            <service uid="genericSceneSrv" type="::fwRenderQt3D::SRender" >
                <scene>
                    <background color="#2d2d2d" />

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

            <service uid="materialAdp" type="::visuQt3DAdaptor::SMaterial" autoConnect="yes">
                <inout key="material" uid="material" />
                <config materialName="mat"/>
            </service>

            <service uid="meshAdp" type="::visuQt3DAdaptor::SMesh" autoConnect="yes">
                <inout key="mesh" uid="mesh" />
                <config autoresetcamera="true" visible="true"  materialName="mat"/>
            </service>

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

            <service uid="meshReaderAct" type="::uiIO::editor::SIOSelector" >
                <inout key="data" uid="mesh" />
                <type mode="reader" />
                <config id="Tuto16SceneQt3D_jsonReader_SrvCfg" service="::ioAtoms::SReader" />
                <config id="Tuto16SceneQt3D_vtk_SrvCfg" service="::ioVTK::SMeshReader" />
            </service>

            <service uid="quitAct" type="::gui::action::SQuit" />

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

            <start uid="mainView" />
            <start uid="materialAdp" />
            <start uid="meshAdp" />

        </config>
    </extension>
</plugin>
