Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonEvmenenko committed Feb 3, 2024
0 parents commit d03955f
Show file tree
Hide file tree
Showing 16 changed files with 557 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*

*_qmlcache.qrc
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.16)
project(rgbd_viewer LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)

find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Quick3D)

qt_add_executable(rgbd_viewer
src/main.cpp
)

set_target_properties(rgbd_viewer PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)

target_link_libraries(rgbd_viewer PUBLIC
Qt::Core
Qt::Gui
Qt::Quick
Qt::Quick3D
)

target_include_directories(rgbd_viewer PRIVATE src)

qt_add_qml_module(rgbd_viewer
URI TexturedSurfaceGeometry
VERSION 1.0
QML_FILES
src/qml/Main.qml
src/qml/Viewer.qml
src/qml/ImageDialog.qml
src/qml/CustomButton.qml
src/qml/CustomDialog.qml
SOURCES
src/surfacegeometry.cpp src/surfacegeometry.h
IMPORTS
QtQuick3D
)

file(COPY img icons DESTINATION ${CMAKE_BINARY_DIR})
Binary file added icons/gear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/questionmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/depth.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/depth1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/texture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/texture1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQuick3D/qquick3d.h>

int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);

QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat());

QQmlApplicationEngine engine;
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
&app, []() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.loadFromModule("TexturedSurfaceGeometry", "Main");

return app.exec();
}
14 changes: 14 additions & 0 deletions src/qml/CustomButton.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import QtQuick
import QtQuick.Controls

RoundButton {
id: button

icon.color: button.hovered ? "black" : "lightgray"
icon.width: button.pressed ? 36 : 32
icon.height: button.pressed ? 36 : 32

background: Rectangle {
color: "transparent"
}
}
9 changes: 9 additions & 0 deletions src/qml/CustomDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import QtQuick
import QtQuick.Controls

Dialog {
modal: true
closePolicy: Popup.CloseOnEscape
x: (parent.width - width) / 2
y: (parent.height - height) / 2
}
5 changes: 5 additions & 0 deletions src/qml/ImageDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import QtQuick.Dialogs

FileDialog {
nameFilters: ["Image Files (*.jpg *.jpeg *.png)"]
}
126 changes: 126 additions & 0 deletions src/qml/Main.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import QtQuick3D

ApplicationWindow {
id: window
width: 1280
height: 720
visible: true
title: "RGBD Viewer"

ImageDialog {
id: textureImagePathDialog
onAccepted: {
viewer.textureImagePath = selectedFile
texturePath.text = selectedFile
}
}

ImageDialog {
id: depthImagePathDialog
onAccepted: {
viewer.depthImagePath = selectedFile
depthPath.text = selectedFile
}
}

Viewer {
id: viewer
textureImagePath: "file:img/texture.jpg"
depthImagePath: "file:img/depth.jpg"
}

CustomButton {
id: settingsButton

anchors.horizontalCenter: parent.right
anchors.verticalCenter: parent.bottom
anchors.horizontalCenterOffset: -40
anchors.verticalCenterOffset: -40

icon.source: "file:icons/gear.png"

onClicked: settingsDialog.open()
}

CustomButton {
id: helpButton

anchors.horizontalCenter: parent.right
anchors.verticalCenter: parent.bottom
anchors.horizontalCenterOffset: -40
anchors.verticalCenterOffset: -90

icon.source: "file:icons/questionmark.png"

onClicked: helpDialog.open()
}

CustomDialog {
id: settingsDialog
title: "Settings"
standardButtons: Dialog.Close
width: 400

GridLayout {
id: mainLayout
anchors.left: parent.left
anchors.right: parent.right
columns: 3
uniformCellWidths: false

Label {
text: "Texture Image"
}

TextField {
id: texturePath
placeholderText: "Texture File Path"
Layout.fillWidth: true
readOnly: true
}

Button {
text: "Browse..."
onPressed: textureImagePathDialog.open()
}

Label {
text: "Depth Image"
}

TextField {
id: depthPath
placeholderText: "Depth File Path"
Layout.fillWidth: true
readOnly: true
}

Button {
text: "Browse..."
onPressed: depthImagePathDialog.open()
}
}
}

CustomDialog {
id: helpDialog
title: "Help"
standardButtons: Dialog.Ok

Text {
anchors.left: parent.left
anchors.right: parent.right

text: [
"• Use [Left Mouse Button] to rotate the model in 3D space\n",
"• Use [Mouse Wheel] to zoom in and out on the model\n",
"• Use [SHIFT] + [Mouse Wheel] to change the depth map scale\n",
"• The model will start rotating automatically after 5s of inactivity"
].join("")
}
}
}
Loading

0 comments on commit d03955f

Please sign in to comment.