Commit 933d86bc authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

Merge remote-tracking branch 'origin/dev' into wip/cmake

Change-Id: Ic21c91af44068a7189374ced540510f909d8e631
parents 59fe3273 cf226dd5
.tag export-subst
.gitattributes export-ignore
.gitignore export-ignore
[submodule "src/3rdparty/assimp/src"]
path = src/3rdparty/assimp/src
url = https://github.com/assimp/assimp.git
url = ../qtquick3d-assimp.git
$Format:%H$
dependencies:
../qtbase:
ref: 0c29ebe374caad7e29c6a3d35c72c4eddaacc6af
ref: 8652c79df0a47264a2d525424484e15744e2462b
required: true
../qtdeclarative:
ref: ee019a22ae9b6358a9827cfa005c7eec0b90b2a5
ref: d5dc3c4cbdc4455143626d7a3e0f9a9a211515a9
required: true
......@@ -48,49 +48,46 @@
**
****************************************************************************/
import QtQuick 2.0
import QtQuick3D 1.0
import QtQuick 2.14
import QtQuick3D 1.14
View3D {
//! [background]
environment: SceneEnvironment {
clearColor: "tan"
clearColor: "#848895"
backgroundMode: SceneEnvironment.Color
}
//! [background]
Light {
DirectionalLight {
brightness: 200
}
Camera {
PerspectiveCamera {
z: -500
}
Model {
id: cube1
source: "#Cube"
rotation: Qt.vector3d(45, 45, 22.5)
materials: DefaultMaterial {
diffuseColor: "blue"
diffuseColor: "#a8171a"
}
}
Model {
id: cone1
y: 100
source: "#Cone"
materials: DefaultMaterial {
diffuseColor: "salmon"
diffuseColor: "#17a81a"
}
}
Model {
id: cylinder1
x: -300
source: "#Cylinder"
x: -200
source: "#Sphere"
materials: DefaultMaterial {
diffuseColor: "green"
diffuseColor: "#09102b"
}
}
}
......@@ -48,51 +48,53 @@
**
****************************************************************************/
import QtQuick 2.0
import QtQuick3D 1.0
import QtQuick 2.14
import QtQuick3D 1.14
import QtQuick3D.Materials 1.14
View3D {
//! [foreground]
environment: SceneEnvironment {
backgroundMode: SceneEnvironment.Transparent
}
//! [foreground]
Node {
id: orbiter
NumberAnimation {
target: orbiter
property: "rotation.y"
duration: 5000
from: 0
to: 360
loops: -1
loops: Animation.Infinite
running: true
}
Light {
DirectionalLight {
}
Camera {
z: -350
PerspectiveCamera {
z: -500
}
}
Model {
id: cube1
source: "#Cube"
x: -200
materials: DefaultMaterial {
diffuseColor: "yellow"
materials: AluminumMaterial {
bump_amount: 5.0
}
}
Model {
id: cone1
y: -100
rotation.x: 45
source: "#Cone"
materials: DefaultMaterial {
diffuseColor: "pink"
}
materials: CopperMaterial {}
SequentialAnimation {
NumberAnimation {
......@@ -114,17 +116,12 @@ View3D {
running: true
loops: -1
}
}
Model {
id: cylinder1
x: 200
source: "#Cylinder"
materials: DefaultMaterial {
diffuseColor: "grey"
}
source: "#Sphere"
materials: SteelMilledConcentricMaterial {}
}
}
......@@ -4,6 +4,10 @@ target.path = $$[QT_INSTALL_EXAMPLES]/quick3d/blendmodes
INSTALLS += target
SOURCES += \
main.cpp
main.cpp
RESOURCES += qml.qrc
RESOURCES += \
qml.qrc
OTHER_FILES += \
doc/src/*.*
/****************************************************************************
**
** Copyright (C) 2019 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 blendmodes
\ingroup quick3d-examples
\title Qt Quick 3D - Blend Modes Example
\brief Demonstrates the use of different blend modes.
\image blendmodes-example.png
This example demonstrates a number of blend modes that can be used in a Qt Quick 3D application.
Blending is done between two \l {View3D}s using \l {QtGraphicalEffects}.
\section1 Creating Views
We create two views. The first view is the background view, and may have a
non-transparent \l {SceneEnvironment::backgroundMode}{background mode} and
\l {SceneEnvironment::clearColor}{clear color} set.
\snippet blendmodes/BackgroundView.qml background
The second view is the foreground view, and it must have transparent
\l {SceneEnvironment::backgroundMode}{background mode}.
\snippet blendmodes/ForegroundView.qml foreground
\section1 Blending
As the blending is done with \l {QtGraphicalEffects}, we need to import it into our
\c {main.qml}.
\snippet blendmodes/main.qml extra import
The foreground view is blended on top of the background view using the
\l {QtGraphicalEffects::Blend}{Blend} type.
\snippet blendmodes/main.qml blending
*/
......@@ -48,41 +48,49 @@
**
****************************************************************************/
import QtQuick 2.11
import QtQuick.Window 2.11
import QtGraphicalEffects 1.0
import QtQuick 2.14
import QtQuick.Window 2.14
//! [extra import]
import QtGraphicalEffects 1.14
//! [extra import]
Window {
visible: true
width: 640
height: 480
width: 1280
height: 720
title: qsTr("Blend Modes Example")
color: "#6b7080"
Item {
id: controlArea
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 100
anchors.margins: 20
width: 160
ListView {
id: modeList
anchors.fill: parent
model: modeModel
delegate: Item {
height: 20
width: 100
height: 26
width: 140
Text {
anchors.fill: parent
anchors.leftMargin: 10
anchors.rightMargin: 10
text: mode
font.pixelSize: 20
}
MouseArea {
anchors.fill: parent
onClicked: modeList.currentIndex = index
onClicked: modeList.currentIndex = index;
}
}
highlight: Rectangle {
color: "lightgreen"
color: "#53586b"
radius: 4
}
focus: true
}
......@@ -165,6 +173,7 @@ Window {
anchors.right: parent.right
anchors.left: controlArea.right
//! [blending]
BackgroundView {
id: background
anchors.fill: parent
......@@ -185,9 +194,9 @@ Window {
sourceItem: foreground
hideSource: true
}
// Take the blend mode from the selection in the list
mode: modeModel.get(modeList.currentIndex).mode
}
//! [blending]
}
}
......@@ -48,37 +48,33 @@
**
****************************************************************************/
import QtQuick 2.12
import QtQuick3D 1.0
import QtQuick 2.14
import QtQuick3D 1.14
import QtQuick3D.Materials 1.14
Node {
id: weirdShape
property alias color: weirdShapeMaterial.diffuseColor
property CustomMaterial customMaterial
property real xRotation: Math.random() * (360 - (-360)) + -360;
property real yRotation: Math.random() * (360 - (-360)) + -360;
property real zRotation: Math.random() * (360 - (-360)) + -360;
property real xRotation: Math.random() * (360 - (-360)) + -360
property real yRotation: Math.random() * (360 - (-360)) + -360
property real zRotation: Math.random() * (360 - (-360)) + -360
Model {
source: "weirdShape.mesh"
scale: Qt.vector3d(100, 100, 100)
scale: Qt.vector3d(150, 150, 150)
rotation: Qt.vector3d(90, 0, 0)
SequentialAnimation on rotation {
loops: Animation.Infinite
PropertyAnimation {
duration: Math.random() * (10000 - 1) + 1
to: Qt.vector3d(xRotation - 360, yRotation - 360, zRotation - 360);
to: Qt.vector3d(xRotation - 360, yRotation - 360, zRotation - 360)
from: Qt.vector3d(xRotation, yRotation, zRotation)
}
}
materials: [weirdShapeMaterial]
DefaultMaterial {
id: weirdShapeMaterial
diffuseColor: "purple"
}
materials: [ customMaterial ]
}
}
QT += quick quick3d-private
target.path = $$[QT_INSTALL_EXAMPLES]/quick3d/materials
target.path = $$[QT_INSTALL_EXAMPLES]/quick3d/custommaterial
INSTALLS += target
SOURCES += \
......@@ -10,3 +9,6 @@ SOURCES += \
RESOURCES += \
qml.qrc \
materials.qrc
OTHER_FILES += \
doc/src/*.*
/****************************************************************************
**
** Copyright (C) 2019 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 custommaterial
\ingroup quick3d-examples
\title Qt Quick 3D - Custom Materials Example
\brief Demonstrates the use of some Material Library materials.
\image custommaterial-example.png
This example demonstrates using four different
\l {Qt Quick 3D Materials QML Types}{Material Library} custom materials in an application.
\section1 Setting the Scene Environment
We want to use a \l {SceneEnvironment::lightProbe}{light probe}, as we're going to use some
reflective materials. We need to enable light probe and adjust its settings to get the result
we want.
\snippet custommaterial/main.qml environment
\section1 Material Library Custom Materials
\section2 Bumpy Aluminum
We're applying \l AluminumMaterial for the \c WeirdShape model we have created in
\c {WeirdShape.qml}. We'll adjust its bumpiness to make it look battered or cast, instead of
smooth and polished.
\snippet custommaterial/main.qml bumpy aluminum
\section2 Copper
Next we apply unmodified \l CopperMaterial for another \c {WeirdShape}.
\snippet custommaterial/main.qml copper
\section2 Frosted Glass
We'll apply \l FrostedGlassSinglePassMaterial for one of the spheres, and adjust its
roughness, reflectivity, index of refraction, and color a little bit.
\snippet custommaterial/main.qml frosted glass
\section2 Plastic
For the other sphere we'll apply \l {PlasticStructuredRedMaterial}, and adjust its
index of refraction and bumpiness a bit.
\snippet custommaterial/main.qml plastic
*/
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQuick3D/private/qquick3dviewport_p.h>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QSurfaceFormat::setDefaultFormat(QQuick3DViewport::idealSurfaceFormat(4));
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** 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.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.14
import QtQuick.Window 2.14
import QtQuick3D 1.14
import QtQuick3D.Materials 1.14
Window {
width: 1280
height: 720
visible: true
title: "Custom Materials Example"
View3D {
anchors.fill: parent