From 0497f57268e8be7af69d37e24fa356e441c0d5f6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 1 Nov 2015 09:09:25 +0100 Subject: cmake: less linkage boilerplate --- pose-widget/glwidget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pose-widget') diff --git a/pose-widget/glwidget.h b/pose-widget/glwidget.h index fca3502d..8896a3cf 100644 --- a/pose-widget/glwidget.h +++ b/pose-widget/glwidget.h @@ -13,7 +13,7 @@ #include "opentrack/plugin-api.hpp" #include "opentrack/simple-mat.hpp" -#ifdef BUILD_opentrack_pose_widget +#ifdef BUILD_pose_widget # define POSE_WIDGET_EXPORT Q_DECL_EXPORT #else # define POSE_WIDGET_EXPORT Q_DECL_IMPORT -- cgit v1.2.3 From 5a2ddaf39cf5ad86cf43d8a01f51989b5e3afa49 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 1 Nov 2015 09:20:17 +0100 Subject: cmake: export only needed symbols --- cmake/opentrack-macros.cmake | 22 +++++++++++++++------- csv/CMakeLists.txt | 2 +- opentrack-compat/CMakeLists.txt | 2 +- pose-widget/CMakeLists.txt | 2 +- qxt-mini/CMakeLists.txt | 2 +- spline-widget/CMakeLists.txt | 2 +- 6 files changed, 20 insertions(+), 12 deletions(-) (limited to 'pose-widget') diff --git a/cmake/opentrack-macros.cmake b/cmake/opentrack-macros.cmake index 46cf3c61..9be09397 100644 --- a/cmake/opentrack-macros.cmake +++ b/cmake/opentrack-macros.cmake @@ -32,7 +32,7 @@ endfunction() macro(opentrack_library n dir) cmake_parse_arguments(opentrack-foolib - "NO-LIBRARY;STATIC;NO-COMPAT;NO-LINKER-SCRIPT" + "NO-LIBRARY;STATIC;NO-COMPAT;NO-LINKER-SCRIPT;LINKAGE" "LINK;COMPILE;GNU-LINK;GNU-COMPILE" "" ${ARGN} @@ -54,17 +54,25 @@ macro(opentrack_library n dir) endif() target_link_libraries(${n} ${MY_QT_LIBS}) if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE AND NOT opentrack-foolib_NO-LINKER-SCRIPT) - SET_TARGET_PROPERTIES(${n} PROPERTIES + set_target_properties(${n} PROPERTIES LINK_FLAGS "${opentrack-foolib_LINK} ${opentrack-foolib_GNU-LINK} -Wl,--as-needed -Wl,--version-script=\"${CMAKE_SOURCE_DIR}/opentrack-compat/${version-script}-version-script.txt\"" COMPILE_FLAGS "${opentrack-foolib_COMPILE} ${opentrack-foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" ) else() - set(link-flags) - if(MSVC) - set(link-flags "${msvc-subsystem} /DEBUG /OPT:ICF") + set(c-props) + set(l-props) + if(opentrack-foolib_LINKAGE AND CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE) + set(c-props "${opentrack-foolib_COMPILE} ${opentrack-foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden") + set(l-props "${opentrack-foolib_LINK} ${opentrack-foolib_GNU-LINK} -Wl,--as-needed") + else() + if(MSVC) + set(l-props "${msvc-subsystem} /DEBUG /OPT:ICF") + endif() endif() - set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${opentrack-foolib_LINK}" COMPILE_FLAGS "${opentrack-foolib_COMPILE}") - set(link-flags) + set_target_properties(${n} PROPERTIES + LINK_FLAGS "${l-props} ${opentrack-foolib_LINK}" + COMPILE_FLAGS "${c-props} ${opentrack-foolib_COMPILE}" + ) endif() string(REGEX REPLACE "^opentrack-" "" n_ ${n}) string(REPLACE "-" "_" n_ ${n_}) diff --git a/csv/CMakeLists.txt b/csv/CMakeLists.txt index 7e80317c..7bafc7ff 100644 --- a/csv/CMakeLists.txt +++ b/csv/CMakeLists.txt @@ -1 +1 @@ -opentrack_boilerplate(opentrack-csv NO-LINKER-SCRIPT) +opentrack_boilerplate(opentrack-csv NO-LINKER-SCRIPT LINKAGE) diff --git a/opentrack-compat/CMakeLists.txt b/opentrack-compat/CMakeLists.txt index a92f4f31..37d53e6c 100644 --- a/opentrack-compat/CMakeLists.txt +++ b/opentrack-compat/CMakeLists.txt @@ -1,4 +1,4 @@ -opentrack_boilerplate(opentrack-compat NO-COMPAT NO-LINKER-SCRIPT) +opentrack_boilerplate(opentrack-compat NO-COMPAT NO-LINKER-SCRIPT LINKAGE) if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() diff --git a/pose-widget/CMakeLists.txt b/pose-widget/CMakeLists.txt index 66cafef7..e48660d7 100644 --- a/pose-widget/CMakeLists.txt +++ b/pose-widget/CMakeLists.txt @@ -1 +1 @@ -opentrack_boilerplate(opentrack-pose-widget NO-LINKER-SCRIPT) +opentrack_boilerplate(opentrack-pose-widget NO-LINKER-SCRIPT LINKAGE) diff --git a/qxt-mini/CMakeLists.txt b/qxt-mini/CMakeLists.txt index 5de29cd1..a8b8fb1d 100644 --- a/qxt-mini/CMakeLists.txt +++ b/qxt-mini/CMakeLists.txt @@ -1,5 +1,5 @@ if(UNIX OR APPLE) - opentrack_boilerplate(opentrack-qxt-mini NO-LINKER-SCRIPT NO-COMPAT) + opentrack_boilerplate(opentrack-qxt-mini NO-LINKER-SCRIPT NO-COMPAT LINKAGE) if(NOT APPLE) target_link_libraries(opentrack-qxt-mini X11) else() diff --git a/spline-widget/CMakeLists.txt b/spline-widget/CMakeLists.txt index 93958f50..4d951f92 100644 --- a/spline-widget/CMakeLists.txt +++ b/spline-widget/CMakeLists.txt @@ -1 +1 @@ -opentrack_boilerplate(opentrack-spline-widget NO-LINKER-SCRIPT NO-COMPAT) +opentrack_boilerplate(opentrack-spline-widget NO-LINKER-SCRIPT NO-COMPAT LINKAGE) -- cgit v1.2.3 From ca25abbf871fb92518910c3beb51d59182df8fe6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 18 Dec 2015 00:55:29 +0100 Subject: glwidget: use transparent octopus background --- pose-widget/glwidget.cpp | 23 ++++++++++++++--------- pose-widget/images/side1.png | Bin 26449 -> 27564 bytes pose-widget/images/side6.png | Bin 26493 -> 28651 bytes 3 files changed, 14 insertions(+), 9 deletions(-) (limited to 'pose-widget') diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index 3ee480a1..9b350010 100644 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -98,16 +98,18 @@ inline GLWidget::vec3 GLWidget::normal(const vec3& p1, const vec3& p2, const vec void GLWidget::project_quad_texture() { const int sx = width(), sy = height(); - vec2 pt[4]; + const int ow = front.width(), oh = front.height(); const vec3 corners[] = { - vec3(0., 0, 0), - vec3(sx-1, 0, 0), - vec3(0, sy-1, 0), - vec3(sx-1, sy-1, 0.) + vec3(-ow/2., -oh/2, 0), + vec3(ow/2, -oh/2, 0), + vec3(-ow/2, oh/2, 0), + vec3(ow/2, oh/2, 0.) }; + vec2 pt[4]; + vec2 sz((sx-ow)/2, (sy-oh)/2); for (int i = 0; i < 4; i++) - pt[i] = project(vec3(corners[i].x() - sx/2, corners[i].y() - sy/2, 0)) + vec2(sx/2, sy/2); + pt[i] = project(corners[i]) + vec2(sx/2, sy/2); vec3 normal1(0, 0, 1); vec3 normal2; @@ -122,9 +124,7 @@ void GLWidget::project_quad_texture() { QImage& tex = dir < 0 ? back : front; - int ow = tex.width(), oh = tex.height(); - - QImage texture(QSize(sx, sy), QImage::Format_RGB888); + QImage texture(QSize(sx, sy), QImage::Format_RGBA8888); QColor bgColor = palette().color(QPalette::Current, QPalette::Window); texture.fill(bgColor); @@ -199,6 +199,10 @@ void GLWidget::project_quad_texture() { const unsigned char r___ = orig[orig_pos___ + 2]; const unsigned char g___ = orig[orig_pos___ + 1]; const unsigned char b___ = orig[orig_pos___ + 0]; + + const unsigned char a1 = orig[orig_pos + 3]; + const unsigned char a2 = orig[orig_pos_ + 3]; + const unsigned char a3 = orig[orig_pos__ + 3]; const int pos = y * dest_pitch + x * dest_depth; @@ -207,6 +211,7 @@ void GLWidget::project_quad_texture() { dest[pos + 0] = (r * ax + r__ * ax_) * ay + (r___ * ax + r_ * ax_) * ay_; dest[pos + 1] = (g * ax + g__ * ax_) * ay + (g___ * ax + g_ * ax_) * ay_; dest[pos + 2] = (b * ax + b__ * ax_) * ay + (b___ * ax + b_ * ax_) * ay_; + dest[pos + 3] = (a1 + a2 + a3)/3; break; } diff --git a/pose-widget/images/side1.png b/pose-widget/images/side1.png index d7467943..5fb72d64 100644 Binary files a/pose-widget/images/side1.png and b/pose-widget/images/side1.png differ diff --git a/pose-widget/images/side6.png b/pose-widget/images/side6.png index eaa80d7e..3b3bda10 100644 Binary files a/pose-widget/images/side6.png and b/pose-widget/images/side6.png differ -- cgit v1.2.3 From f502b3823222c204110484bc2d27c40775ff4b36 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 18 Dec 2015 03:55:37 +0100 Subject: pose-widget: also bilinear interpolation of alpha value --- pose-widget/glwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pose-widget') diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index 9b350010..1b30e585 100644 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -203,6 +203,7 @@ void GLWidget::project_quad_texture() { const unsigned char a1 = orig[orig_pos + 3]; const unsigned char a2 = orig[orig_pos_ + 3]; const unsigned char a3 = orig[orig_pos__ + 3]; + const unsigned char a4 = orig[orig_pos___ + 3]; const int pos = y * dest_pitch + x * dest_depth; @@ -211,7 +212,7 @@ void GLWidget::project_quad_texture() { dest[pos + 0] = (r * ax + r__ * ax_) * ay + (r___ * ax + r_ * ax_) * ay_; dest[pos + 1] = (g * ax + g__ * ax_) * ay + (g___ * ax + g_ * ax_) * ay_; dest[pos + 2] = (b * ax + b__ * ax_) * ay + (b___ * ax + b_ * ax_) * ay_; - dest[pos + 3] = (a1 + a2 + a3)/3; + dest[pos + 3] = (a1 * ax + a3 * ax_) * ay + (a4 * ax + a2 * ax_) * ay_; break; } -- cgit v1.2.3