diff options
Diffstat (limited to 'works')
| -rw-r--r-- | works/teapot/.dockerignore | 1 | ||||
| -rw-r--r-- | works/teapot/.github/workflows/ci.yaml | 30 | ||||
| -rw-r--r-- | works/teapot/.gitignore | 1 | ||||
| -rw-r--r-- | works/teapot/CMakeLists.txt | 35 | ||||
| -rw-r--r-- | works/teapot/README.md | 1 | ||||
| -rw-r--r-- | works/teapot/debian/control | 8 | ||||
| -rw-r--r-- | works/teapot/main.cpp | 20 | ||||
| -rw-r--r-- | works/teapot/main.qml | 270 | ||||
| -rw-r--r-- | works/teapot/qml.qrc | 6 | ||||
| -rwxr-xr-x | works/teapot/script/build-deb.bash | 12 | ||||
| -rw-r--r-- | works/teapot/script/install-deps.bash | 3 | ||||
| -rw-r--r-- | works/teapot/teapot.mesh | bin | 0 -> 42656 bytes | |||
| -rw-r--r-- | works/teapot/view3d.pro | 14 | 
13 files changed, 401 insertions, 0 deletions
diff --git a/works/teapot/.dockerignore b/works/teapot/.dockerignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/works/teapot/.dockerignore @@ -0,0 +1 @@ +build
\ No newline at end of file diff --git a/works/teapot/.github/workflows/ci.yaml b/works/teapot/.github/workflows/ci.yaml new file mode 100644 index 0000000..426fdb9 --- /dev/null +++ b/works/teapot/.github/workflows/ci.yaml @@ -0,0 +1,30 @@ +name: CI + +on: +  push: +    branches: [main] +  pull_request: +    branches: [main] + +jobs: +  build: +    name: Build +    runs-on: ubuntu-latest +    defaults: +      run: +        shell: bash + +    steps: +      - uses: actions/checkout@v3 + +      - name: Install Build Dependencies +        run: ./script/install-deps.bash   + +      - name: Build Deb Package +        run: ./script/build-deb.bash + +      - name: Upload Artifact +        uses: actions/upload-artifact@v3 +        with: +          name: deb-package +          path: build/package.deb diff --git a/works/teapot/.gitignore b/works/teapot/.gitignore new file mode 100644 index 0000000..c795b05 --- /dev/null +++ b/works/teapot/.gitignore @@ -0,0 +1 @@ +build
\ No newline at end of file diff --git a/works/teapot/CMakeLists.txt b/works/teapot/CMakeLists.txt new file mode 100644 index 0000000..0bbff29 --- /dev/null +++ b/works/teapot/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +cmake_minimum_required(VERSION 3.16) +project(crupest-teapot LANGUAGES CXX) + +set(CMAKE_AUTOMOC ON) + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Quick3D) + +qt_add_executable(crupest-teapot +    main.cpp +) + +set_target_properties(crupest-teapot PROPERTIES +    WIN32_EXECUTABLE TRUE +    MACOSX_BUNDLE TRUE +) + +target_link_libraries(crupest-teapot PUBLIC +    Qt::Core +    Qt::Gui +    Qt::Quick +    Qt::Quick3D +) + +qt_add_qml_module(crupest-teapot +    URI Example +    VERSION 1.0 +    QML_FILES main.qml +    RESOURCES teapot.mesh +    NO_RESOURCE_TARGET_PATH +) + +install(TARGETS crupest-teapot) diff --git a/works/teapot/README.md b/works/teapot/README.md new file mode 100644 index 0000000..c684667 --- /dev/null +++ b/works/teapot/README.md @@ -0,0 +1 @@ +From https://github.com/qt/qtquick3d/tree/dev/examples/quick3d/view3d
\ No newline at end of file diff --git a/works/teapot/debian/control b/works/teapot/debian/control new file mode 100644 index 0000000..20aad59 --- /dev/null +++ b/works/teapot/debian/control @@ -0,0 +1,8 @@ +Package: crupest-teapot +Version: 1.0-1 +Section: utils +Priority: optional +Architecture: all +Maintainer: crupest <crupest@outlook.com> +Description: This is a test application for packaging +Depends: libqt63dquick6,qml6-module-qtqml,qml6-module-qtqml-workerscript,qml6-module-qtquick,qml6-module-qtquick-templates,qml6-module-qtquick-controls,qml6-module-quick3d diff --git a/works/teapot/main.cpp b/works/teapot/main.cpp new file mode 100644 index 0000000..804f8ff --- /dev/null +++ b/works/teapot/main.cpp @@ -0,0 +1,20 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QtQuick3D/qquick3d.h> + +int main(int argc, char *argv[]) +{ +    QGuiApplication app(argc, argv); +    QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat()); +    qputenv("QT_QUICK_CONTROLS_STYLE", "Basic"); + +    QQmlApplicationEngine engine; +    engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); +    if (engine.rootObjects().isEmpty()) +        return -1; + +    return app.exec(); +} diff --git a/works/teapot/main.qml b/works/teapot/main.qml new file mode 100644 index 0000000..8f61137 --- /dev/null +++ b/works/teapot/main.qml @@ -0,0 +1,270 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick3D +import QtQuick.Controls + +Window { +    id: window +    width: 1280 +    height: 720 +    visible: true +    title: "View3Ds with Different Cameras" +    color: "#848895" + +    // The root scene +    //! [rootnode] +    Node { +        id: standAloneScene +        //! [rootnode] + +        DirectionalLight { +            ambientColor: Qt.rgba(0.5, 0.5, 0.5, 1.0) +            brightness: 1.0 +            eulerRotation.x: -25 +        } + +        Model { +            source: "#Cube" +            y: -104 +            scale: Qt.vector3d(3, 3, 0.1) +            eulerRotation.x: -90 +            materials: [ +                DefaultMaterial { +                    diffuseColor: Qt.rgba(0.8, 0.8, 0.8, 1.0) +                } +            ] +        } + +        Model { +            source: "teapot.mesh" +            y: -100 +            scale: Qt.vector3d(50, 50, 50) +            materials: [ +                PrincipledMaterial { +                    baseColor: "#41cd52" +                    metalness: 0.0 +                    roughness: 0.1 +                    opacity: 1.0 +                } +            ] + +            PropertyAnimation on eulerRotation.y { +                loops: Animation.Infinite +                duration: 5000 +                to: 0 +                from: -360 +            } +        } + +        //! [cameras start] +        // The predefined cameras. They have to be part of the scene, i.e. inside the root node. +        // Animated perspective camera +        Node { +            PerspectiveCamera { +                id: cameraPerspectiveOne +                z: 600 +            } + +            PropertyAnimation on eulerRotation.x { +                loops: Animation.Infinite +                duration: 5000 +                to: -360 +                from: 0 +            } +        } + +        // Stationary perspective camera +        PerspectiveCamera { +            id: cameraPerspectiveTwo +            z: 600 +        } +        //! [cameras start] + +        // Second animated perspective camera +        Node { +            PerspectiveCamera { +                id: cameraPerspectiveThree +                x: 500 +                eulerRotation.y: 90 +            } +            PropertyAnimation on eulerRotation.y { +                loops: Animation.Infinite +                duration: 5000 +                to: 0 +                from: -360 +            } +        } + +        // Stationary orthographic camera viewing from the top +        OrthographicCamera { +            id: cameraOrthographicTop +            y: 600 +            eulerRotation.x: -90 +        } + +        // Stationary orthographic camera viewing from the front +        OrthographicCamera { +            id: cameraOrthographicFront +            z: 600 +        } + +        //! [cameras end] +        // Stationary orthographic camera viewing from left +        OrthographicCamera { +            id: cameraOrthographicLeft +            x: -600 +            eulerRotation.y: -90 +        } +    } +    //! [cameras end] + +    //! [views] +    // The views +    Rectangle { +        id: topLeft +        anchors.top: parent.top +        anchors.left: parent.left +        width: parent.width * 0.5 +        height: parent.height * 0.5 +        color: "#848895" +        border.color: "black" + +        View3D { +            id: topLeftView +            anchors.fill: parent +            importScene: standAloneScene +            camera: cameraOrthographicFront +        } + +        Label { +            text: "Front" +            anchors.top: parent.top +            anchors.left: parent.left +            anchors.margins: 10 +            color: "#222840" +            font.pointSize: 14 +        } +    } +    //! [views] + +    Rectangle { +        id: topRight +        anchors.top: parent.top +        anchors.right: parent.right +        width: parent.width * 0.5 +        height: parent.height * 0.5 +        color: "transparent" +        border.color: "black" + +        Label { +            text: "Perspective" +            anchors.top: parent.top +            anchors.right: parent.right +            anchors.margins: 10 +            color: "#222840" +            font.pointSize: 14 +        } + +        View3D { +            id: topRightView +            anchors.top: parent.top +            anchors.right: parent.right +            anchors.left: parent.left +            anchors.bottom: parent.bottom; +            camera: cameraPerspectiveOne +            importScene: standAloneScene +            renderMode: View3D.Underlay + +            environment: SceneEnvironment { +                clearColor: window.color +                backgroundMode: SceneEnvironment.Color +            } +        } + +        Row { +            id: controlsContainer +            anchors.bottom: parent.bottom +            anchors.horizontalCenter: parent.horizontalCenter +            spacing: 10 +            padding: 10 + +            //! [buttons] +            RoundButton { +                text: "Camera 1" +                highlighted: topRightView.camera == cameraPerspectiveOne +                onClicked: { +                    topRightView.camera = cameraPerspectiveOne +                } +            } +            //! [buttons] +            RoundButton { +                text: "Camera 2" +                highlighted: topRightView.camera == cameraPerspectiveTwo +                onClicked: { +                    topRightView.camera = cameraPerspectiveTwo +                } +            } +            RoundButton { +                text: "Camera 3" +                highlighted: topRightView.camera == cameraPerspectiveThree +                onClicked: { +                    topRightView.camera = cameraPerspectiveThree +                } +            } +        } +    } + +    Rectangle { +        id: bottomLeft +        anchors.bottom: parent.bottom +        anchors.left: parent.left +        width: parent.width * 0.5 +        height: parent.height * 0.5 +        color: "#848895" +        border.color: "black" + +        View3D { +            id: bottomLeftView +            anchors.fill: parent +            importScene: standAloneScene +            camera: cameraOrthographicTop +        } + +        Label { +            text: "Top" +            anchors.top: parent.top +            anchors.left: parent.left +            anchors.margins: 10 +            color: "#222840" +            font.pointSize: 14 +        } +    } + +    Rectangle { +        id: bottomRight +        anchors.bottom: parent.bottom +        anchors.right: parent.right +        width: parent.width * 0.5 +        height: parent.height * 0.5 +        color: "#848895" +        border.color: "black" + +        View3D { +            id: bottomRightView +            anchors.fill: parent +            importScene: standAloneScene +            camera: cameraOrthographicLeft +        } + +        Label { +            text: "Left" +            anchors.top: parent.top +            anchors.right: parent.right +            anchors.margins: 10 +            color: "#222840" +            font.pointSize: 14 +        } +    } +} diff --git a/works/teapot/qml.qrc b/works/teapot/qml.qrc new file mode 100644 index 0000000..b1f4acf --- /dev/null +++ b/works/teapot/qml.qrc @@ -0,0 +1,6 @@ +<RCC> +    <qresource prefix="/"> +        <file>main.qml</file> +        <file>teapot.mesh</file> +    </qresource> +</RCC> diff --git a/works/teapot/script/build-deb.bash b/works/teapot/script/build-deb.bash new file mode 100755 index 0000000..954d026 --- /dev/null +++ b/works/teapot/script/build-deb.bash @@ -0,0 +1,12 @@ +set -e + +mkdir -p build +pushd build +cmake .. "-DCMAKE_BUILD_TYPE=RelWithDebInfo" +make +mkdir -p package +cmake --install . --prefix ./package/ +mkdir -p package/DEBIAN +cp ../debian/control ./package/DEBIAN/control +dpkg-deb --root-owner-group --build package +popd diff --git a/works/teapot/script/install-deps.bash b/works/teapot/script/install-deps.bash new file mode 100644 index 0000000..813b884 --- /dev/null +++ b/works/teapot/script/install-deps.bash @@ -0,0 +1,3 @@ +set -e +sudo apt-get update +sudo apt-get install -y build-essential cmake g++ libgl1-mesa-dev qt6-base-dev qt6-declarative-dev qt6-quick3d-dev qt6-quick3d-dev-tools libqt6shadertools6-dev diff --git a/works/teapot/teapot.mesh b/works/teapot/teapot.mesh Binary files differnew file mode 100644 index 0000000..75ff317 --- /dev/null +++ b/works/teapot/teapot.mesh diff --git a/works/teapot/view3d.pro b/works/teapot/view3d.pro new file mode 100644 index 0000000..61455a1 --- /dev/null +++ b/works/teapot/view3d.pro @@ -0,0 +1,14 @@ +QT += quick quick3d + +target.path = $$[QT_INSTALL_EXAMPLES]/quick3d/view3d + +INSTALLS += target + +SOURCES += \ +    main.cpp + +RESOURCES += \ +    qml.qrc + +OTHER_FILES += \ +    doc/src/*.*  | 
