diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-01-29 12:08:00 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-02-01 12:51:23 +0000 |
commit | 0e04f0d4dad213e323d11f4814581c8afc2b7e9d (patch) | |
tree | 0be19e577f689e9d0bb23730728b24ad5a1e8728 /examples | |
parent | fa1cc116705dfef96afb17bef995f9000c2355be (diff) |
Studio3D: add scenegraph node and renderer object
Not functional yet, although the implementation is mostly complete.
The API is obviously not there, for now we'll just have a source property
to allow testing the internals.
Change-Id: I6b189aa30a0bc486edb041879e094641e0e51ffc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'examples')
12 files changed, 108 insertions, 3 deletions
diff --git a/examples/3dstudioruntime2/simpleqml/main.cpp b/examples/3dstudioruntime2/simpleqml/main.cpp index a177995..975a5aa 100644 --- a/examples/3dstudioruntime2/simpleqml/main.cpp +++ b/examples/3dstudioruntime2/simpleqml/main.cpp @@ -50,13 +50,14 @@ #include <QtGui/QGuiApplication> #include <QtQuick/QQuickView> +#include <Q3DSEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQuickView viewer; - + viewer.setFormat(Q3DSEngine::surfaceFormat()); viewer.setSource(QUrl("qrc:/main.qml")); viewer.setTitle(QStringLiteral("Qt 3D Studio Example")); diff --git a/examples/3dstudioruntime2/simpleqml/main.qml b/examples/3dstudioruntime2/simpleqml/main.qml index 03cfaba..c021490 100644 --- a/examples/3dstudioruntime2/simpleqml/main.qml +++ b/examples/3dstudioruntime2/simpleqml/main.qml @@ -50,11 +50,36 @@ import QtQuick 2.0 import QtStudio3D 2.0 +import QtQuick.Window 2.3 Rectangle { + id: root color: "lightGray" Studio3D { - anchors.margins: 10 + id: s3d + anchors.margins: 40 + anchors.fill: parent + source: "qrc:/presentation/barrel.uip" + } + + Window { + id: w + visible: true + width: 500 + height: 500 + Item { + id: wroot + anchors.fill: parent + } + title: "Second window" + } + + MouseArea { + anchors.fill: parent + onClicked: if (s3d.parent === wroot) s3d.parent = root; else s3d.parent = wroot + Text { + text: "Click to move to other window" + } } } diff --git a/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip b/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip new file mode 100644 index 0000000..50981d3 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/barrel.uip @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP version="3" > + <Project > + <ProjectSettings author="" company="" presentationWidth="800" presentationHeight="480" maintainAspect="False" /> + <Graph > + <Scene id="Scene" > + <Layer id="Layer" > + <Camera id="Camera" /> + <Light id="Light" /> + <Model id="Barrel" > + <Material id="Material" > + <Image id="Material_diffusemap" /> + <Image id="Material_normalmap" /> + <Image id="Material_emissivemap" /> + <Image id="Material_specularmap" /> + </Material> + </Model> + <Text id="Text" /> + </Layer> + </Scene> + </Graph> + <Logic > + <State name="Master Slide" component="#Scene" > + <Add ref="#Layer" /> + <Add ref="#Camera" /> + <Add ref="#Light" /> + <State id="Scene-Slide1" name="Slide1" playmode="Looping" > + <Add ref="#Barrel" name="Barrel" position="0 -42 -483" rotation="90 0 0" scale="100 100 100" sourcepath=".\barrel\meshes\Barrel.mesh#1" > + <AnimationTrack property="opacity" type="EaseInOut" /> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 90 100 100 5 64 100 100 10 90 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 5 -302 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 5 0 100 100 10 0 100 100</AnimationTrack> + </Add> + <Add ref="#Material" bumpamount="0" diffusemap="#Material_diffusemap" emissivemap="#Material_emissivemap" fresnelPower="25" normalmap="#Material_normalmap" specularamount="4" specularmap="#Material_specularmap" specularmodel="Default" specularroughness="0.001" > + <AnimationTrack property="bumpamount" type="EaseInOut" >0 0 100 100 5 1 100 100</AnimationTrack> + </Add> + <Add ref="#Material_diffusemap" sourcepath=".\maps\barrel_barrel_Diffuse.png" /> + <Add ref="#Material_normalmap" sourcepath=".\maps\barrel_barrel_Normal.png" /> + <Add ref="#Material_emissivemap" sourcepath=".\maps\barrel_barrel_Emissive.png" /> + <Add ref="#Material_specularmap" sourcepath=".\maps\barrel_barrel_Specular.png" /> + <Add ref="#Text" name="Text" font="Arimo-Regular" position="-486.418 297.128 50.5569" textcolor="0 1 0" textstring="Barrel!" tracking="0" > + <AnimationTrack property="opacity" type="EaseInOut" >0 100 100 100 5.009 43.75 100 100 10 100 100 100</AnimationTrack> + <AnimationTrack property="rotation.x" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="rotation.y" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 360 100 100</AnimationTrack> + <AnimationTrack property="rotation.z" type="EaseInOut" >0 0 100 100 4.997 0 100 100 5.009 0 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="textcolor.x" type="EaseInOut" >0 0 100 100 5.009 0.501961 100 100 10 0 100 100</AnimationTrack> + <AnimationTrack property="textcolor.y" type="EaseInOut" >0 1 100 100 5.009 0.235294 100 100 10 1 100 100</AnimationTrack> + <AnimationTrack property="textcolor.z" type="EaseInOut" >0 0 100 100 5.009 0.333333 100 100 10 0 100 100</AnimationTrack> + </Add> + </State> + </State> + </Logic> + </Project> +</UIP> diff --git a/examples/3dstudioruntime2/simpleqml/presentation/barrel/barrel.import b/examples/3dstudioruntime2/simpleqml/presentation/barrel/barrel.import new file mode 100644 index 0000000..cf56bb4 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/barrel/barrel.import @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<UIP Version="1" > + <Project Revision="1" > + <Graph > + <Group id="__import__root__" > + <Model id="Barrel" name="Barrel" orientation="Right Handed" position="0 0 -0" rotation="-90 -0 0" rotationorder="XYZr" scale="100 100 100" sourcepath=".\meshes\Barrel.mesh#1" > + <Material id="Barrel_0001" name="Barrel" blendmode="Normal" diffuse="0.64 0.64 0.64" emissivepower="0" opacity="100" specularamount="0" specularroughness="9.60784" /> + </Model> + </Group> + </Graph> + <Import SrcFile="..\..\..\barrel.fbx" ImageDir="Images" MeshDir="Meshes" > + <Mesh > + <Source >Barrel</Source> + <Dest >.\meshes\Barrel.mesh</Dest> + </Mesh> + </Import> + </Project> +</UIP> diff --git a/examples/3dstudioruntime2/simpleqml/presentation/barrel/meshes/Barrel.mesh b/examples/3dstudioruntime2/simpleqml/presentation/barrel/meshes/Barrel.mesh Binary files differnew file mode 100644 index 0000000..3f0a923 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/barrel/meshes/Barrel.mesh diff --git a/examples/3dstudioruntime2/simpleqml/presentation/fonts/Arimo-Regular.ttf b/examples/3dstudioruntime2/simpleqml/presentation/fonts/Arimo-Regular.ttf Binary files differnew file mode 100644 index 0000000..720d419 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/fonts/Arimo-Regular.ttf diff --git a/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Diffuse.png b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Diffuse.png Binary files differnew file mode 100644 index 0000000..426f129 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Diffuse.png diff --git a/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Emissive.png b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Emissive.png Binary files differnew file mode 100644 index 0000000..b6be9f3 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Emissive.png diff --git a/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Normal.png b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Normal.png Binary files differnew file mode 100644 index 0000000..4e16c47 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Normal.png diff --git a/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Specular.png b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Specular.png Binary files differnew file mode 100644 index 0000000..1882559 --- /dev/null +++ b/examples/3dstudioruntime2/simpleqml/presentation/maps/barrel_barrel_Specular.png diff --git a/examples/3dstudioruntime2/simpleqml/simpleqml.pro b/examples/3dstudioruntime2/simpleqml/simpleqml.pro index 5a74e88..208fdae 100644 --- a/examples/3dstudioruntime2/simpleqml/simpleqml.pro +++ b/examples/3dstudioruntime2/simpleqml/simpleqml.pro @@ -1,6 +1,6 @@ TEMPLATE = app -QT += qml quick +QT += qml quick 3dstudioruntime2 SOURCES += \ main.cpp diff --git a/examples/3dstudioruntime2/simpleqml/simpleqml.qrc b/examples/3dstudioruntime2/simpleqml/simpleqml.qrc index 5f6483a..72ae099 100644 --- a/examples/3dstudioruntime2/simpleqml/simpleqml.qrc +++ b/examples/3dstudioruntime2/simpleqml/simpleqml.qrc @@ -1,5 +1,12 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> + <file>presentation/barrel.uip</file> + <file>presentation/barrel/meshes/Barrel.mesh</file> + <file>presentation/fonts/Arimo-Regular.ttf</file> + <file>presentation/maps/barrel_barrel_Diffuse.png</file> + <file>presentation/maps/barrel_barrel_Emissive.png</file> + <file>presentation/maps/barrel_barrel_Normal.png</file> + <file>presentation/maps/barrel_barrel_Specular.png</file> </qresource> </RCC> |