archivage initial

This commit is contained in:
ccolin 2020-03-08 21:29:11 +01:00
commit 8281c6f6db
20 changed files with 1747 additions and 0 deletions

633
Makefile Normal file
View File

@ -0,0 +1,633 @@
#############################################################################
# Makefile for building: tp4
# Generated by qmake (3.1) (Qt 5.13.2)
# Project: tp4.pro
# Template: app
# Command: /usr/lib/qt5/bin/qmake -o Makefile tp4.pro
#############################################################################
MAKEFILE = Makefile
EQ = =
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -g -std=gnu++1y -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I. -I /usr/include/qt5 -I /usr/include/qt5/QtWidgets -I /usr/include/qt5/QtGui -I /usr/include/qt5/QtCore -I. -I /usr/include/libdrm -I. -I/usr/lib/qt5/mkspecs/linux-g++
QMAKE = /usr/lib/qt5/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall
QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = tp41.0.0
DISTDIR = /home/papush/m1/pg/tp4/tp4/.tmp/tp41.0.0
LINK = g++
LFLAGS = -Wl,-rpath,/usr/lib
LIBS = $(SUBLIBS) /usr/lib/libQt5Widgets.so /usr/lib/libQt5Gui.so /usr/lib/libQt5Core.so -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp \
princ.cpp \
glarea.cpp \
cylinder.cpp \
scene.cpp \
settingsdialog.cpp \
propslider.cpp qrc_tp4.cpp \
moc_princ.cpp \
moc_glarea.cpp \
moc_settingsdialog.cpp \
moc_propslider.cpp
OBJECTS = main.o \
princ.o \
glarea.o \
cylinder.o \
scene.o \
settingsdialog.o \
propslider.o \
qrc_tp4.o \
moc_princ.o \
moc_glarea.o \
moc_settingsdialog.o \
moc_propslider.o
DIST = /usr/lib/qt5/mkspecs/features/spec_pre.prf \
/usr/lib/qt5/mkspecs/common/unix.conf \
/usr/lib/qt5/mkspecs/common/linux.conf \
/usr/lib/qt5/mkspecs/common/sanitize.conf \
/usr/lib/qt5/mkspecs/common/gcc-base.conf \
/usr/lib/qt5/mkspecs/common/gcc-base-unix.conf \
/usr/lib/qt5/mkspecs/common/g++-base.conf \
/usr/lib/qt5/mkspecs/common/g++-unix.conf \
/usr/lib/qt5/mkspecs/qconfig.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3danimation.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3danimation_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dcore.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dcore_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dextras.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dextras_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dinput.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dinput_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dlogic.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dlogic_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquick.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquick_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickanimation.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickanimation_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickextras.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickextras_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickinput.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickinput_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickrender.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickrender_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickscene2d.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickscene2d_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3drender.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3drender_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_concurrent.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_core.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_core_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_dbus.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_gui.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_gui_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_input_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_network.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_network_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_opengl.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_packetprotocol_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_printsupport.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qml.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qml_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmldebug_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmltest.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmltest_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quick.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quick_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickshapes_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickwidgets_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_service_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_sql.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_sql_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_testlib.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_widgets.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xml.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xml_private.pri \
/usr/lib/qt5/mkspecs/features/qt_functions.prf \
/usr/lib/qt5/mkspecs/features/qt_config.prf \
/usr/lib/qt5/mkspecs/linux-g++/qmake.conf \
/usr/lib/qt5/mkspecs/features/spec_post.prf \
.qmake.stash \
/usr/lib/qt5/mkspecs/features/exclusive_builds.prf \
/usr/lib/qt5/mkspecs/features/toolchain.prf \
/usr/lib/qt5/mkspecs/features/default_pre.prf \
/usr/lib/qt5/mkspecs/features/resolve_config.prf \
/usr/lib/qt5/mkspecs/features/default_post.prf \
/usr/lib/qt5/mkspecs/features/warn_on.prf \
/usr/lib/qt5/mkspecs/features/qt.prf \
/usr/lib/qt5/mkspecs/features/resources.prf \
/usr/lib/qt5/mkspecs/features/moc.prf \
/usr/lib/qt5/mkspecs/features/unix/opengl.prf \
/usr/lib/qt5/mkspecs/features/uic.prf \
/usr/lib/qt5/mkspecs/features/unix/thread.prf \
/usr/lib/qt5/mkspecs/features/qmake_use.prf \
/usr/lib/qt5/mkspecs/features/file_copies.prf \
/usr/lib/qt5/mkspecs/features/testcase_targets.prf \
/usr/lib/qt5/mkspecs/features/exceptions.prf \
/usr/lib/qt5/mkspecs/features/yacc.prf \
/usr/lib/qt5/mkspecs/features/lex.prf \
tp4.pro princ.h \
glarea.h \
scene.h \
cylinder.h \
settingsdialog.h \
propslider.h main.cpp \
princ.cpp \
glarea.cpp \
cylinder.cpp \
scene.cpp \
settingsdialog.cpp \
propslider.cpp
QMAKE_TARGET = tp4
DESTDIR =
TARGET = tp4
first: all
####### Build rules
tp4: ui_princ.h ui_settingsdialog.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: tp4.pro /usr/lib/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/qt5/mkspecs/features/spec_pre.prf \
/usr/lib/qt5/mkspecs/common/unix.conf \
/usr/lib/qt5/mkspecs/common/linux.conf \
/usr/lib/qt5/mkspecs/common/sanitize.conf \
/usr/lib/qt5/mkspecs/common/gcc-base.conf \
/usr/lib/qt5/mkspecs/common/gcc-base-unix.conf \
/usr/lib/qt5/mkspecs/common/g++-base.conf \
/usr/lib/qt5/mkspecs/common/g++-unix.conf \
/usr/lib/qt5/mkspecs/qconfig.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3danimation.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3danimation_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dcore.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dcore_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dextras.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dextras_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dinput.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dinput_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dlogic.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dlogic_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquick.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquick_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickanimation.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickanimation_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickextras.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickextras_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickinput.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickinput_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickrender.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickrender_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickscene2d.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickscene2d_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3drender.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_3drender_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_concurrent.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_core.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_core_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_dbus.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_dbus_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_glx_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_gui.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_gui_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_input_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_network.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_network_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_opengl.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_opengl_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_openglextensions.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_packetprotocol_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_printsupport.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qml.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qml_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmldebug_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmltest.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_qmltest_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quick.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quick_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickshapes_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickwidgets.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_quickwidgets_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_service_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_sql.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_sql_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_testlib.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_testlib_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_widgets.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_widgets_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xml.pri \
/usr/lib/qt5/mkspecs/modules/qt_lib_xml_private.pri \
/usr/lib/qt5/mkspecs/features/qt_functions.prf \
/usr/lib/qt5/mkspecs/features/qt_config.prf \
/usr/lib/qt5/mkspecs/linux-g++/qmake.conf \
/usr/lib/qt5/mkspecs/features/spec_post.prf \
.qmake.stash \
/usr/lib/qt5/mkspecs/features/exclusive_builds.prf \
/usr/lib/qt5/mkspecs/features/toolchain.prf \
/usr/lib/qt5/mkspecs/features/default_pre.prf \
/usr/lib/qt5/mkspecs/features/resolve_config.prf \
/usr/lib/qt5/mkspecs/features/default_post.prf \
/usr/lib/qt5/mkspecs/features/warn_on.prf \
/usr/lib/qt5/mkspecs/features/qt.prf \
/usr/lib/qt5/mkspecs/features/resources.prf \
/usr/lib/qt5/mkspecs/features/moc.prf \
/usr/lib/qt5/mkspecs/features/unix/opengl.prf \
/usr/lib/qt5/mkspecs/features/uic.prf \
/usr/lib/qt5/mkspecs/features/unix/thread.prf \
/usr/lib/qt5/mkspecs/features/qmake_use.prf \
/usr/lib/qt5/mkspecs/features/file_copies.prf \
/usr/lib/qt5/mkspecs/features/testcase_targets.prf \
/usr/lib/qt5/mkspecs/features/exceptions.prf \
/usr/lib/qt5/mkspecs/features/yacc.prf \
/usr/lib/qt5/mkspecs/features/lex.prf \
tp4.pro \
tp4.qrc
$(QMAKE) -o Makefile tp4.pro
/usr/lib/qt5/mkspecs/features/spec_pre.prf:
/usr/lib/qt5/mkspecs/common/unix.conf:
/usr/lib/qt5/mkspecs/common/linux.conf:
/usr/lib/qt5/mkspecs/common/sanitize.conf:
/usr/lib/qt5/mkspecs/common/gcc-base.conf:
/usr/lib/qt5/mkspecs/common/gcc-base-unix.conf:
/usr/lib/qt5/mkspecs/common/g++-base.conf:
/usr/lib/qt5/mkspecs/common/g++-unix.conf:
/usr/lib/qt5/mkspecs/qconfig.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3danimation.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3danimation_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dcore.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dcore_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dextras.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dextras_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dinput.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dinput_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dlogic.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dlogic_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquick.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquick_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickanimation.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickanimation_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickextras.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickextras_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickinput.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickinput_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickrender.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickrender_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickscene2d.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3dquickscene2d_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3drender.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_3drender_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_concurrent.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_core.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_core_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_dbus.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_edid_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_egl_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_fb_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_glx_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_gui.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_gui_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_input_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_kms_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_network.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_network_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_opengl.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_packetprotocol_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_printsupport.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_qml.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_qml_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_qmldebug_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_qmldevtools_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_qmltest.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_qmltest_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_quick.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_quick_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_quickparticles_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_quickshapes_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_quickwidgets.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_quickwidgets_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_service_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_sql.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_sql_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_testlib.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_theme_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_widgets.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_xml.pri:
/usr/lib/qt5/mkspecs/modules/qt_lib_xml_private.pri:
/usr/lib/qt5/mkspecs/features/qt_functions.prf:
/usr/lib/qt5/mkspecs/features/qt_config.prf:
/usr/lib/qt5/mkspecs/linux-g++/qmake.conf:
/usr/lib/qt5/mkspecs/features/spec_post.prf:
.qmake.stash:
/usr/lib/qt5/mkspecs/features/exclusive_builds.prf:
/usr/lib/qt5/mkspecs/features/toolchain.prf:
/usr/lib/qt5/mkspecs/features/default_pre.prf:
/usr/lib/qt5/mkspecs/features/resolve_config.prf:
/usr/lib/qt5/mkspecs/features/default_post.prf:
/usr/lib/qt5/mkspecs/features/warn_on.prf:
/usr/lib/qt5/mkspecs/features/qt.prf:
/usr/lib/qt5/mkspecs/features/resources.prf:
/usr/lib/qt5/mkspecs/features/moc.prf:
/usr/lib/qt5/mkspecs/features/unix/opengl.prf:
/usr/lib/qt5/mkspecs/features/uic.prf:
/usr/lib/qt5/mkspecs/features/unix/thread.prf:
/usr/lib/qt5/mkspecs/features/qmake_use.prf:
/usr/lib/qt5/mkspecs/features/file_copies.prf:
/usr/lib/qt5/mkspecs/features/testcase_targets.prf:
/usr/lib/qt5/mkspecs/features/exceptions.prf:
/usr/lib/qt5/mkspecs/features/yacc.prf:
/usr/lib/qt5/mkspecs/features/lex.prf:
tp4.pro:
tp4.qrc:
qmake: FORCE
@$(QMAKE) -o Makefile tp4.pro
qmake_all: FORCE
all: Makefile tp4
dist: distdir FORCE
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
distdir: FORCE
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents tp4.qrc $(DISTDIR)/
$(COPY_FILE) --parents /usr/lib/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/
$(COPY_FILE) --parents princ.h glarea.h scene.h cylinder.h settingsdialog.h propslider.h $(DISTDIR)/
$(COPY_FILE) --parents main.cpp princ.cpp glarea.cpp cylinder.cpp scene.cpp settingsdialog.cpp propslider.cpp $(DISTDIR)/
$(COPY_FILE) --parents princ.ui settingsdialog.ui $(DISTDIR)/
clean: compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) .qmake.stash
-$(DEL_FILE) Makefile
####### Sub-libraries
mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all
check: first
benchmark: first
compiler_rcc_make_all: qrc_tp4.cpp
compiler_rcc_clean:
-$(DEL_FILE) qrc_tp4.cpp
qrc_tp4.cpp: tp4.qrc \
/usr/lib/qt5/bin/rcc \
basic.vsh \
basic.fsh
/usr/lib/qt5/bin/rcc -name tp4 tp4.qrc -o qrc_tp4.cpp
compiler_moc_predefs_make_all: moc_predefs.h
compiler_moc_predefs_clean:
-$(DEL_FILE) moc_predefs.h
moc_predefs.h: /usr/lib/qt5/mkspecs/features/data/dummy.cpp
g++ -pipe -g -std=gnu++1y -Wall -W -dM -E -o moc_predefs.h /usr/lib/qt5/mkspecs/features/data/dummy.cpp
compiler_moc_header_make_all: moc_princ.cpp moc_glarea.cpp moc_settingsdialog.cpp moc_propslider.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_princ.cpp moc_glarea.cpp moc_settingsdialog.cpp moc_propslider.cpp
moc_princ.cpp: princ.h \
ui_princ.h \
glarea.h \
scene.h \
cylinder.h \
settingsdialog.h \
ui_settingsdialog.h \
propslider.h \
moc_predefs.h \
/usr/lib/qt5/bin/moc
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/papush/m1/pg/tp4/tp4/moc_predefs.h -I/usr/lib/qt5/mkspecs/linux-g++ -I/home/papush/m1/pg/tp4/tp4 -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I/usr/include/c++/9.2.0 -I/usr/include/c++/9.2.0/x86_64-unknown-linux-gnu -I/usr/include/c++/9.2.0/backward -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include-fixed -I/usr/include princ.h -o moc_princ.cpp
moc_glarea.cpp: glarea.h \
scene.h \
cylinder.h \
moc_predefs.h \
/usr/lib/qt5/bin/moc
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/papush/m1/pg/tp4/tp4/moc_predefs.h -I/usr/lib/qt5/mkspecs/linux-g++ -I/home/papush/m1/pg/tp4/tp4 -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I/usr/include/c++/9.2.0 -I/usr/include/c++/9.2.0/x86_64-unknown-linux-gnu -I/usr/include/c++/9.2.0/backward -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include-fixed -I/usr/include glarea.h -o moc_glarea.cpp
moc_settingsdialog.cpp: settingsdialog.h \
ui_settingsdialog.h \
propslider.h \
glarea.h \
scene.h \
cylinder.h \
moc_predefs.h \
/usr/lib/qt5/bin/moc
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/papush/m1/pg/tp4/tp4/moc_predefs.h -I/usr/lib/qt5/mkspecs/linux-g++ -I/home/papush/m1/pg/tp4/tp4 -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I/usr/include/c++/9.2.0 -I/usr/include/c++/9.2.0/x86_64-unknown-linux-gnu -I/usr/include/c++/9.2.0/backward -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include-fixed -I/usr/include settingsdialog.h -o moc_settingsdialog.cpp
moc_propslider.cpp: propslider.h \
moc_predefs.h \
/usr/lib/qt5/bin/moc
/usr/lib/qt5/bin/moc $(DEFINES) --include /home/papush/m1/pg/tp4/tp4/moc_predefs.h -I/usr/lib/qt5/mkspecs/linux-g++ -I/home/papush/m1/pg/tp4/tp4 -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I/usr/include/c++/9.2.0 -I/usr/include/c++/9.2.0/x86_64-unknown-linux-gnu -I/usr/include/c++/9.2.0/backward -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include-fixed -I/usr/include propslider.h -o moc_propslider.cpp
compiler_moc_objc_header_make_all:
compiler_moc_objc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_princ.h ui_settingsdialog.h
compiler_uic_clean:
-$(DEL_FILE) ui_princ.h ui_settingsdialog.h
ui_princ.h: princ.ui \
/usr/lib/qt5/bin/uic \
glarea.h \
scene.h \
cylinder.h
/usr/lib/qt5/bin/uic princ.ui -o ui_princ.h
ui_settingsdialog.h: settingsdialog.ui \
/usr/lib/qt5/bin/uic \
propslider.h
/usr/lib/qt5/bin/uic settingsdialog.ui -o ui_settingsdialog.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_rcc_clean compiler_moc_predefs_clean compiler_moc_header_clean compiler_uic_clean
####### Compile
main.o: main.cpp princ.h \
ui_princ.h \
glarea.h \
scene.h \
cylinder.h \
settingsdialog.h \
ui_settingsdialog.h \
propslider.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
princ.o: princ.cpp princ.h \
ui_princ.h \
glarea.h \
scene.h \
cylinder.h \
settingsdialog.h \
ui_settingsdialog.h \
propslider.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o princ.o princ.cpp
glarea.o: glarea.cpp glarea.h \
scene.h \
cylinder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o glarea.o glarea.cpp
cylinder.o: cylinder.cpp cylinder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cylinder.o cylinder.cpp
scene.o: scene.cpp scene.h \
cylinder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o scene.o scene.cpp
settingsdialog.o: settingsdialog.cpp settingsdialog.h \
ui_settingsdialog.h \
propslider.h \
glarea.h \
scene.h \
cylinder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o settingsdialog.o settingsdialog.cpp
propslider.o: propslider.cpp propslider.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o propslider.o propslider.cpp
qrc_tp4.o: qrc_tp4.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_tp4.o qrc_tp4.cpp
moc_princ.o: moc_princ.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_princ.o moc_princ.cpp
moc_glarea.o: moc_glarea.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_glarea.o moc_glarea.cpp
moc_settingsdialog.o: moc_settingsdialog.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_settingsdialog.o moc_settingsdialog.cpp
moc_propslider.o: moc_propslider.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_propslider.o moc_propslider.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

5
basic.fsh Normal file
View File

@ -0,0 +1,5 @@
varying lowp vec4 col;
void main() {
gl_FragColor = col;
}

9
basic.vsh Normal file
View File

@ -0,0 +1,9 @@
attribute highp vec4 posAttr;
attribute lowp vec4 colAttr;
varying lowp vec4 col;
uniform highp mat4 matrix;
void main() {
col = colAttr;
gl_Position = matrix * posAttr;
}

100
cylinder.cpp Normal file
View File

@ -0,0 +1,100 @@
#include <cylinder.h>
#include <QDebug>
using namespace std;
static void push_vertex(vector<GLfloat> &verts,
GLfloat x, GLfloat y, GLfloat z,
Color c) {
verts.push_back(x);
verts.push_back(y);
verts.push_back(z);
verts.push_back(c.r);
verts.push_back(c.g);
verts.push_back(c.b);
}
Cylinder::Cylinder(float ep, float r, unsigned nb_fac, Color c)
:ep(ep),
r(r),
nb_fac(nb_fac),
c(c),
angle(2*M_PI/nb_fac),
face_size(nb_fac * 3),
side_size((nb_fac+1) * 2)
{
vector<GLfloat> verts((2*face_size + side_size) * 3 * 2);
build_faces(verts);
build_side(verts);
vbo.create();
qDebug() << "verts.size() " << verts.size()
<< "nb_fac:" << nb_fac
<< "face_size:" << face_size
<< "side_size:" << side_size;
vbo.bind();
vbo.allocate(verts.data(), verts.size() * sizeof (GLfloat));
vbo.release();
}
void Cylinder::build_face(float z, vector<GLfloat> &verts)
{
Color color(c);
for (unsigned j = 0; j < nb_fac; j++) {
push_vertex(verts, 0, 0, z, color);
push_vertex(verts, cos(angle*j) * r, sin(angle*j) * r, z, color);
push_vertex(verts, cos(angle*(j+1)) * r, sin(angle*(j+1)) * r, z, color);
if (j % (nb_fac/4) == 0) {
if (j % (nb_fac/2) == 0) {
color.r *= .8;
color.g *= .8;
color.b *= .8;
}
else {
color = c;
}
}
}
}
void Cylinder::build_faces(vector<GLfloat> &verts)
{
build_face(-ep/2, verts);
build_face(ep/2, verts);
}
void Cylinder::build_side(vector<GLfloat> &verts)
{
Color color(c.r*.7, c.g*.7, c.b*.7);
for (unsigned i = 0; i < nb_fac+1; i++) {
push_vertex(verts, cos(angle*i) * r, sin(angle*i) * r, -ep/2, color);
push_vertex(verts, cos(angle*i) * r, sin(angle*i) * r, ep/2, color);
}
}
void Cylinder::draw(QOpenGLFunctions &f, int pos, int col)
{
vbo.bind();
f.glEnableVertexAttribArray(pos);
f.glVertexAttribPointer(pos, 3, GL_FLOAT, GL_FALSE,
3 * sizeof (GLfloat),
nullptr);
f.glEnableVertexAttribArray(col);
f.glVertexAttribPointer(col, 3, GL_FLOAT, GL_FALSE,
3 * sizeof (GLfloat),
(void *) (3 * sizeof (GLfloat)));
f.glDrawArrays(GL_TRIANGLES, 0, face_size);
f.glDrawArrays(GL_TRIANGLES, face_size, face_size);
f.glDrawArrays(GL_QUAD_STRIP,
face_size * 2,
side_size);
f.glDisableVertexAttribArray(pos);
f.glDisableVertexAttribArray(col);
vbo.release();
}

43
cylinder.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef CYLINDER_HPP
#define CYLINDER_HPP
#include <GL/glu.h>
#include <math.h>
#include <array>
#include <QOpenGLFunctions>
#include <QOpenGLBuffer>
#include <vector>
struct Color
{
float r;
float g;
float b;
Color(float r, float g, float b) :r(r), g(g), b(b) {};
};
struct Cylinder
{
float ep;
float r;
unsigned nb_fac;
Color c;
float angle;
size_t face_size;
size_t side_size;
QOpenGLBuffer vbo;
Cylinder(float ep, float r, unsigned nb_fac, Color c);
void build_face(float z, std::vector<GLfloat> &verts);
void build_faces(std::vector<GLfloat> &verts);
void build_side(std::vector<GLfloat> &verts);
void draw(QOpenGLFunctions &f, int pos, int col);
};
#endif

182
glarea.cpp Normal file
View File

@ -0,0 +1,182 @@
// CC-BY Edouard.Thiel@univ-amu.fr - 22/01/2019
#include "glarea.h"
#include <QDebug>
#include <QSurfaceFormat>
#include <QMatrix4x4>
#include <stdio.h>
static const QString vertexShaderFile = ":/basic.vsh";
static const QString fragmentShaderFile = ":/basic.fsh";
GLArea::GLArea(QWidget *parent) :
QOpenGLWidget(parent)
{
qDebug() << "init GLArea" ;
QSurfaceFormat sf;
sf.setDepthBufferSize(24);
sf.setSamples(16);
setFormat(sf);
qDebug() << "Depth is"<< format().depthBufferSize();
setEnabled(true); // Événements clavier et souris.
setFocusPolicy(Qt::StrongFocus); // Accepte focus.
setFocus(); // Donne le focus.
timer = new QTimer(this);
timer->setInterval(16); // ms
connect(timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
}
GLArea::~GLArea()
{
qDebug() << "destroy GLArea";
delete timer;
// Contrairement aux méthodes virtuelles initializeGL, resizeGL et repaintGL,
// dans le destructeur le contexte GL n'est pas automatiquement rendu courant.
makeCurrent();
// ici destructions de ressources GL
doneCurrent();
}
void GLArea::initializeGL()
{
qDebug() << __FUNCTION__ ;
initializeOpenGLFunctions();
glEnable(GL_DEPTH_TEST);
// Shaders.
program = new QOpenGLShaderProgram(this);
program->addShaderFromSourceFile
(QOpenGLShader::Vertex, vertexShaderFile);
program->addShaderFromSourceFile
(QOpenGLShader::Fragment, fragmentShaderFile);
if (!program->link()) {
qWarning("Failed to compile and link shader program:");
qWarning() << program->log();
}
// Récupère identifiants de "variables" dans les shaders.
posAttr = program->attributeLocation("posAttr");
colAttr = program->attributeLocation("colAttr");
matrix_uniform = program->uniformLocation("matrix");
}
void GLArea::resizeGL(int w, int h)
{
qDebug() << __FUNCTION__ << w << h;
// C'est fait par défaut
glViewport(0, 0, w, h);
ratio = (double) w / h;
// doProjection();
}
void GLArea::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
program->bind(); // active le shader program
QMatrix4x4 matrix;
GLfloat hr = focal_length;
GLfloat wr = hr * ratio;
matrix.frustum(-wr, wr, -hr, hr, near_clip, far_clip);
matrix.translate(0, 0, -distance);
matrix.rotate(angle, 0, 1, 0);
matrix.rotate(horiz_angle, 0,
cos(vert_angle * 2*M_PI /360),
sin(vert_angle * 2*M_PI /360));
matrix.rotate(vert_angle, 1, 0, 0);
program->setUniformValue(matrix_uniform, matrix);
scene.draw((QOpenGLFunctions&) (*this), program, matrix_uniform,
anim * 360, matrix, posAttr, colAttr);
program->release();
}
void GLArea::keyPressEvent(QKeyEvent *ev)
{
QString text = ev->text();
switch(ev->key()) {
case Qt::Key_A:
timer->isActive() ? timer->stop() : timer->start();
break;
case Qt::Key_Z:
setDistance(distance + (text == "z" ? -distance_step : distance_step));
break;
case Qt::Key_R:
setFocalLength(focal_length + (text == "r" ? -focal_length_step : focal_length_step));
break;
case Qt::Key_N:
setNearClip(near_clip + (text == "n" ? -near_clip_step : near_clip_step));
break;
case Qt::Key_F:
setFarClip(far_clip + (text == "f" ? -far_clip_step : far_clip_step));
break;
case Qt::Key_Space:
setAngle(angle + angle_step);
update();
break;
}
}
void GLArea::mousePressEvent(QMouseEvent *ev)
{
mouse_last[0] = ev->x() / (float) width();
mouse_last[1] = ev->y() / (float) height();
}
void GLArea::mouseMoveEvent(QMouseEvent *ev)
{
float x = ev->x() / (float) width();
float y = ev->y() / (float) height();
float dx = x - mouse_last[0];
float dy = y - mouse_last[1];
horiz_angle += dx * 200;
vert_angle += dy * 200;
if (vert_angle > 90) vert_angle = 90;
if (vert_angle < -90) vert_angle = -90;
mouse_last[0] = x;
mouse_last[1] = y;
update();
}
void GLArea::wheelEvent(QWheelEvent *ev)
{
setDistance(distance - ev->angleDelta().y() / 1000.);
update();
}
void GLArea::onTimeout()
{
anim += 0.0001;
if (anim > 1) anim--;
update();
}
#define SET_VALUE(orig, signal) \
qDebug() << "GLArea, setting " #orig " from" << orig << "to" << value; \
if (value > orig##_max) value = orig##_max;\
if (value < orig##_min) value = orig##_min;\
if (value != orig) {\
orig = value;\
emit signal(orig);\
update();\
}
void GLArea::setDistance(double value) { SET_VALUE(distance, distanceChanged); }
void GLArea::setFocalLength(double value) { SET_VALUE(focal_length, focalLengthChanged); }
void GLArea::setNearClip(double value) { SET_VALUE(near_clip, nearClipChanged); }
void GLArea::setFarClip(double value) { SET_VALUE(far_clip, farClipChanged); }
void GLArea::setAngle(double value)
{
while (value > angle_max) value -= angle_max;
while (value < angle_min) value += angle_min;
SET_VALUE(angle, angleChanged);
}
#undef SET_VALUE

102
glarea.h Normal file
View File

@ -0,0 +1,102 @@
// CC-BY Edouard.Thiel@univ-amu.fr - 22/01/2019
#ifndef GLAREA_H
#define GLAREA_H
#include <QKeyEvent>
#include <QTimer>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
#include <scene.h>
class GLArea : public QOpenGLWidget,
protected QOpenGLFunctions
{
Q_OBJECT
public:
explicit GLArea(QWidget *parent = 0);
~GLArea();
static constexpr double distance_min = 0;
static constexpr double distance_max = 5;
static constexpr double distance_step = .1;
static constexpr double focal_length_min = 0;
static constexpr double focal_length_max = .2;
static constexpr double focal_length_step = .005;
static constexpr double near_clip_min = 0;
static constexpr double near_clip_max = 1;
static constexpr double near_clip_step = .05;
static constexpr double far_clip_min = 2;
static constexpr double far_clip_max = 7;
static constexpr double far_clip_step = .1;
static constexpr double angle_min = 0;
static constexpr double angle_max = 360;
static constexpr double angle_step = 1;
double getDistance() const { return distance; }
double getFocalLength() const { return focal_length; }
double getNearClip() const { return near_clip; }
double getFarClip() const { return far_clip; }
double getAngle() const { return angle; }
public slots:
void setDistance(double d);
void setFocalLength(double f);
void setNearClip(double n);
void setFarClip(double f);
void setAngle(double a);
signals:
void distanceChanged(double d);
void focalLengthChanged(double f);
void nearClipChanged(double n);
void farClipChanged(double f);
void angleChanged(double a);
protected slots:
void onTimeout();
protected:
void initializeGL() override;
void doProjection();
void resizeGL(int w, int h) override;
void paintGL() override;
void keyPressEvent(QKeyEvent *ev) override;
void mousePressEvent(QMouseEvent *ev) override;
void mouseMoveEvent(QMouseEvent *ev) override;
void wheelEvent(QWheelEvent *ev) override;
private:
QTimer *timer = nullptr;
double anim = 0;
double ratio = 1;
// Pour utiliser les shaders
QOpenGLShaderProgram *program;
int posAttr;
int colAttr;
int matrix_uniform;
Scene scene;
float mouse_last[2] = {0, 0};
double horiz_angle = 0;
double vert_angle = 0;
double distance = 3;
double focal_length = .1;
double near_clip = .1;
double far_clip = 5;
double angle = 0;
};
#endif // GLAREA_H

13
main.cpp Normal file
View File

@ -0,0 +1,13 @@
// CC-BY Edouard.Thiel@univ-amu.fr - 22/01/2019
#include "princ.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Princ w;
w.show();
return a.exec();
}

16
princ.cpp Normal file
View File

@ -0,0 +1,16 @@
// CC-BY Edouard.Thiel@univ-amu.fr - 22/01/2019
#include "princ.h"
#include <QDebug>
Princ::Princ(QWidget *parent) :
QMainWindow(parent)
{
setupUi(this);
diag.setGLArea(glarea);
}
void Princ::showDiag()
{
diag.show();
}

22
princ.h Normal file
View File

@ -0,0 +1,22 @@
// CC-BY Edouard.Thiel@univ-amu.fr - 22/01/2019
#ifndef PRINC_H
#define PRINC_H
#include "ui_princ.h"
#include "settingsdialog.h"
class Princ : public QMainWindow, private Ui::Princ
{
Q_OBJECT
SettingsDialog diag;
protected slots:
void showDiag();
public:
explicit Princ(QWidget *parent = 0);
};
#endif // PRINC_H

110
princ.ui Normal file
View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Princ</class>
<widget class="QMainWindow" name="Princ">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>292</height>
</rect>
</property>
<property name="windowTitle">
<string>Princ</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btn_diag">
<property name="text">
<string>Réglages</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_quit">
<property name="text">
<string>Quit</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="GLArea" name="glarea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>20</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>GLArea</class>
<extends>QOpenGLWidget</extends>
<header>glarea.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>btn_quit</sender>
<signal>clicked()</signal>
<receiver>Princ</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>393</x>
<y>53</y>
</hint>
<hint type="destinationlabel">
<x>353</x>
<y>73</y>
</hint>
</hints>
</connection>
<connection>
<sender>btn_diag</sender>
<signal>clicked()</signal>
<receiver>Princ</receiver>
<slot>showDiag()</slot>
<hints>
<hint type="sourcelabel">
<x>101</x>
<y>45</y>
</hint>
<hint type="destinationlabel">
<x>538</x>
<y>167</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>showDiag()</slot>
</slots>
</ui>

63
propslider.cpp Normal file
View File

@ -0,0 +1,63 @@
#include "propslider.h"
#include <QDebug>
PropSlider::PropSlider(QWidget *parent)
:QSlider(parent),
mapped_value(mapValue())
{
connect(this, SIGNAL(valueChanged(int)),
this, SLOT(setValue(int)));
}
int PropSlider::mapValue() const
{
return (value - min) * maximum() / (max - min);
}
double PropSlider::unmapValue() const
{
return (double) mapped_value * (max - min) / maximum() + min;
}
void PropSlider::setMinimum(double min)
{
this->min = min;
}
void PropSlider::setMaximum(double max)
{
this->max = max;
((QSlider *) this)->setMaximum((max-min) / step);
}
void PropSlider::setStep(double step)
{
this->step = step;
setMaximum(max);
}
void PropSlider::setValue(double value)
{
qDebug() << "PropSlider, setting from double" << value;
this->value = value;
((QSlider *) this)->setValue(mapValue());
}
void PropSlider::setValue(int mapped_value) {
qDebug() << "PropSlider, setting from int" << mapped_value;
if (mapValue() != mapped_value) {
qDebug() << "Mapped value changed, transmitting to GLArea";
this->mapped_value = mapped_value;
this->value = unmapValue();
emit valueChanged(this->value);
}
}

42
propslider.h Normal file
View File

@ -0,0 +1,42 @@
#ifndef PROPSLIDER_H
#define PROPSLIDER_H
#include <QSlider>
/*
Widget qui traduit les valeurs entières renvoyées par un QSlider en
double pour contrôler une propriété en fonction dun minimum, dun
maximum et dun pas.
*/
class PropSlider : public QSlider {
Q_OBJECT
double min = 0;
double max = 1;
double step = .1;
double value = .5;
int mapped_value;
int mapValue() const;
double unmapValue() const;
public:
PropSlider(QWidget *parent=nullptr);
void setMinimum(double min);
void setMaximum(double max);
void setStep(double step);
signals:
void valueChanged(double value);
public slots:
void setValue(double value);
private slots:
// Connecté au QSlider
void setValue(int mapped_value);
};
#endif

91
scene.cpp Normal file
View File

@ -0,0 +1,91 @@
#include "scene.h"
#include <GL/glu.h>
#include <stack>
using namespace std;
Scene::Scene()
:volant(.2, .55, 8, Color(.522, .816, 1)),
axe_volant(.6, .06, 6, Color(.522*.5, .816*.5, 1.5)),
manivelle(.2, .115, 8, Color(.078, .718, .078)),
axe_manivelle(.35, .06, 6, Color(.078*.5, .718*.5, .078*.5)),
bague_bielle(.2, .14, 8, Color(.078, .718, .078)),
bague_piston(.2, .115, 8, Color(.69, .11, .69)),
axe_bielle_piston(.36, .06, 6, Color(.69*.5, .11*.5, .69*.5)),
bielle(1.5, .05, 6, Color(.173, .824, .173)),
piston(1.1, .065, 6, Color(.847, .318, .847)),
cylindre(1.2, .15, 8, Color(.702, .424, .286)) {}
void Scene::draw(QOpenGLFunctions &f, QOpenGLShaderProgram *prog, int mat_uni,
float alpha, QMatrix4x4 &matrix, int pos, int col)
{
float gh = .45;
float xh = gh*cos(alpha);
float yh = gh*sin(alpha);
QMatrix4x4 m, m2;
/* Volant */
m = matrix;
matrix.rotate(alpha*360/(2*M_PI), 0, 0, 1);
prog->setUniformValue(mat_uni, matrix);
volant.draw(f, pos, col);
m2 = matrix;
matrix.translate(0, 0, -axe_volant.ep/2 + .125);
prog->setUniformValue(mat_uni, matrix);
axe_volant.draw(f, pos, col);
matrix = m2;
matrix.translate(gh, 0, axe_manivelle.ep/2);
prog->setUniformValue(mat_uni, matrix);
axe_manivelle.draw(f, pos, col);
matrix = m;
/* Manivelle */
m = matrix;
matrix.translate(xh, yh, volant.ep/2+manivelle.ep/2);
prog->setUniformValue(mat_uni, matrix);
manivelle.draw(f, pos, col);
matrix = m;
float hj = bielle.ep;
float xj = xh - sqrtf(hj*hj - powf(gh*sin(alpha), 2));
float b = atanf(yh / (xj-xh < 0 ? xj-xh : -xj+xh));
m = matrix;
matrix.translate(xj, 0, volant.ep/2+manivelle.ep/2);
prog->setUniformValue(mat_uni, matrix);
bague_bielle.draw(f, pos, col);
/* Bielle */
m2 = matrix;
matrix.rotate(90, 0, 1, 0);
matrix.rotate(b*360/(2*M_PI), 1, 0, 0);
matrix.translate(0, 0, bielle.ep/2);
prog->setUniformValue(mat_uni, matrix);
bielle.draw(f, pos, col);
matrix = m2;
/* Piston */
m2 = matrix;
matrix.translate(0, 0, axe_bielle_piston.ep/2);
prog->setUniformValue(mat_uni, matrix);
axe_bielle_piston.draw(f, pos, col);
matrix.translate(0, 0, axe_bielle_piston.ep/2 - .15);
prog->setUniformValue(mat_uni, matrix);
bague_piston.draw(f, pos, col);
matrix.rotate(90, 0, 1, 0);
matrix.translate(0, 0, -piston.ep/2);
prog->setUniformValue(mat_uni, matrix);
piston.draw(f, pos, col);
matrix = m2;
matrix = m;
/* Cylindre */
m = matrix;
matrix.translate(-gh-bielle.ep - piston.ep + .3, 0, volant.ep/2
+ bague_bielle.ep
+ bague_piston.ep/2);
matrix.rotate(90, 0, 1, 0);
prog->setUniformValue(mat_uni, matrix);
cylindre.draw(f, pos, col);
matrix = m;
}

31
scene.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef SCENE_H
#define SCENE_H
#include <QMatrix4x4>
#include <cylinder.h>
#include <QOpenGLFunctions>
#include <QOpenGLShaderProgram>
class Scene
{
public:
Scene();
void draw(QOpenGLFunctions &f, QOpenGLShaderProgram *prog, int mat_uni,
float alpha, QMatrix4x4 &matrix, int vertices, int colors);
private:
Cylinder volant;
Cylinder axe_volant;
Cylinder manivelle;
Cylinder axe_manivelle;
Cylinder bague_bielle;
Cylinder bague_piston;
Cylinder axe_bielle_piston;
Cylinder bielle;
Cylinder piston;
Cylinder cylindre;
};
#endif

63
settingsdialog.cpp Normal file
View File

@ -0,0 +1,63 @@
#include "settingsdialog.h"
SettingsDialog::SettingsDialog(QWidget *parent)
:QDialog(parent)
{
setupUi(this);
}
void SettingsDialog::setGLArea(GLArea *area) {
glarea = area;
// Paramétrage des PropSliders
sli_distance->setMinimum(GLArea::distance_min);
sli_distance->setStep(GLArea::distance_step);
sli_distance->setMaximum(GLArea::distance_max);
sli_distance->setValue(glarea->getDistance());
sli_focal_length->setMinimum(GLArea::focal_length_min);
sli_focal_length->setStep(GLArea::focal_length_step);
sli_focal_length->setMaximum(GLArea::focal_length_max);
sli_focal_length->setValue(glarea->getFocalLength());
sli_near_clip->setMinimum(GLArea::near_clip_min);
sli_near_clip->setStep(GLArea::near_clip_step);
sli_near_clip->setMaximum(GLArea::near_clip_max);
sli_near_clip->setValue(glarea->getNearClip());
sli_far_clip->setMinimum(GLArea::far_clip_min);
sli_far_clip->setStep(GLArea::far_clip_step);
sli_far_clip->setMaximum(GLArea::far_clip_max);
sli_far_clip->setValue(glarea->getFarClip());
sli_angle->setMinimum(GLArea::angle_min);
sli_angle->setStep(GLArea::angle_step);
sli_angle->setMaximum(GLArea::angle_max);
sli_angle->setValue(glarea->getAngle());
// GLArea -> PropSlider
connect(glarea, SIGNAL(distanceChanged(double)),
sli_distance, SLOT(setValue(double)));
connect(glarea, SIGNAL(focalLengthChanged(double)),
sli_focal_length, SLOT(setValue(double)));
connect(glarea, SIGNAL(nearClipChanged(double)),
sli_near_clip, SLOT(setValue(double)));
connect(glarea, SIGNAL(farClipChanged(double)),
sli_far_clip, SLOT(setValue(double)));
connect(glarea, SIGNAL(angleChanged(double)),
sli_angle, SLOT(setValue(double)));
// PropSlider -> GLArea
connect(sli_distance, SIGNAL(valueChanged(double)),
glarea, SLOT(setDistance(double)));
connect(sli_focal_length, SIGNAL(valueChanged(double)),
glarea, SLOT(setFocalLength(double)));
connect(sli_near_clip, SIGNAL(valueChanged(double)),
glarea, SLOT(setNearClip(double)));
connect(sli_far_clip, SIGNAL(valueChanged(double)),
glarea, SLOT(setFarClip(double)));
connect(sli_angle, SIGNAL(valueChanged(double)),
glarea, SLOT(setAngle(double)));
}

34
settingsdialog.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
#include "ui_settingsdialog.h"
#include "glarea.h"
class SettingsDialog : public QDialog, private Ui::SettingsDialog
{
Q_OBJECT
GLArea *glarea;
// static void setupSlider(const Property<double> &p, QSlider *s);
// static int rawToSlider(const Property<double> &p);
// static double sliderToRaw(const Property<double> &p, int value);
public:
explicit SettingsDialog(QWidget *parent = nullptr);
void setGLArea(GLArea *area);
// public slots:
// void setDistance(double raw_value);
// void setFocalLength(double raw_value);
// void setNearClip(double raw_value);
// void setFarClip(double raw_value);
// void setAngle(double raw_value);
// protected slots:
// void onSliderDistance(int value);
// void onSliderFocalLength(int value);
// void onSliderNearClip(int value);
// void onSliderFarClip(int value);
// void onSliderAngle(int value);
};
#endif // SETTINGSDIALOG_H

152
settingsdialog.ui Normal file
View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialog</class>
<widget class="QDialog" name="SettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="PropSlider" name="sli_distance">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbl_distance">
<property name="text">
<string>Distance (zZ)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="PropSlider" name="sli_focal_length">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lbl_focal_length">
<property name="text">
<string>Focale (rR)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="PropSlider" name="sli_near_clip">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lbl_near_clip">
<property name="text">
<string>Coupe avant (nN)</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="PropSlider" name="sli_far_clip">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="lbl_far_clip">
<property name="text">
<string>Coupe arrière (fF)</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="PropSlider" name="sli_angle">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="lbl_angle">
<property name="text">
<string>Angle (spc)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PropSlider</class>
<extends>QSlider</extends>
<header>propslider.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SettingsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>227</x>
<y>281</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SettingsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>295</x>
<y>287</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>onSliderDistance(int)</slot>
<slot>onSliderFocalLength(int)</slot>
<slot>onSliderNearClip(int)</slot>
<slot>onSliderFarClip(int)</slot>
<slot>onSliderAngle(int)</slot>
</slots>
</ui>

30
tp4.pro Normal file
View File

@ -0,0 +1,30 @@
QT += core gui
CONFIG += c++14 debug
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = tp4
TEMPLATE = app
SOURCES += main.cpp\
princ.cpp \
glarea.cpp \
cylinder.cpp \
scene.cpp \
settingsdialog.cpp \
propslider.cpp
HEADERS += princ.h \
glarea.h \
scene.h \
cylinder.h \
settingsdialog.h \
propslider.h
FORMS += princ.ui \
settingsdialog.ui
RESOURCES += \
tp4.qrc

6
tp4.qrc Normal file
View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>basic.fsh</file>
<file>basic.vsh</file>
</qresource>
</RCC>