diff --git a/examples/render/01-viewer/CMakeLists.txt b/examples/render/01-viewer/CMakeLists.txt index 9af5039e5..04f06cfc4 100644 --- a/examples/render/01-viewer/CMakeLists.txt +++ b/examples/render/01-viewer/CMakeLists.txt @@ -22,9 +22,9 @@ cmake_minimum_required(VERSION 3.24) -if (VCLIB_RENDER_BACKEND STREQUAL "bgfx") - add_subdirectory(bgfx) +if (TARGET vclib-3rd-qt) + add_subdirectory(qt) endif() -if (VCLIB_RENDER_BACKEND STREQUAL "opengl2") - add_subdirectory(opengl2) +if (TARGET vclib-3rd-glfw) + add_subdirectory(glfw) endif() diff --git a/examples/render/01-viewer/bgfx/CMakeLists.txt b/examples/render/01-viewer/bgfx/CMakeLists.txt deleted file mode 100644 index 04f06cfc4..000000000 --- a/examples/render/01-viewer/bgfx/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -if (TARGET vclib-3rd-qt) - add_subdirectory(qt) -endif() -if (TARGET vclib-3rd-glfw) - add_subdirectory(glfw) -endif() diff --git a/examples/render/01-viewer/bgfx/glfw/CMakeLists.txt b/examples/render/01-viewer/glfw/CMakeLists.txt similarity index 100% rename from examples/render/01-viewer/bgfx/glfw/CMakeLists.txt rename to examples/render/01-viewer/glfw/CMakeLists.txt diff --git a/examples/render/01-viewer/bgfx/glfw/main.cpp b/examples/render/01-viewer/glfw/main.cpp similarity index 100% rename from examples/render/01-viewer/bgfx/glfw/main.cpp rename to examples/render/01-viewer/glfw/main.cpp diff --git a/examples/render/01-viewer/opengl2/CMakeLists.txt b/examples/render/01-viewer/opengl2/CMakeLists.txt deleted file mode 100644 index b7584a946..000000000 --- a/examples/render/01-viewer/opengl2/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -if (TARGET vclib-3rd-glfw) - add_subdirectory(glfw) -endif() -if (TARGET vclib-3rd-qt) - add_subdirectory(qt) -endif() diff --git a/examples/render/01-viewer/opengl2/glfw/CMakeLists.txt b/examples/render/01-viewer/opengl2/glfw/CMakeLists.txt deleted file mode 100644 index da5a1e9f2..000000000 --- a/examples/render/01-viewer/opengl2/glfw/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -set(EXAMPLE_NAME 01-viewer-glfw) -project(vclib-render-example-${EXAMPLE_NAME}) - -### Build settings -set(CMAKE_CXX_STANDARD 20) - -set(SOURCES - main.cpp) - -# will create a target called 'vclib-render-example-${EXAMPLE_NAME}' -vclib_add_example(${EXAMPLE_NAME} - VCLIB_MODULE render - SOURCES ${SOURCES}) diff --git a/examples/render/01-viewer/opengl2/qt/CMakeLists.txt b/examples/render/01-viewer/opengl2/qt/CMakeLists.txt deleted file mode 100644 index 5de12d58c..000000000 --- a/examples/render/01-viewer/opengl2/qt/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -set(EXAMPLE_NAME 01-viewer-qt) -project(vclib-render-example-${EXAMPLE_NAME}) - -### Build settings -set(CMAKE_CXX_STANDARD 20) - -set(SOURCES - main.cpp) - -# will create a target called 'vclib-render-example-${EXAMPLE_NAME}' -vclib_add_example(${EXAMPLE_NAME} - VCLIB_MODULE render - SOURCES ${SOURCES}) diff --git a/examples/render/01-viewer/opengl2/qt/main.cpp b/examples/render/01-viewer/opengl2/qt/main.cpp deleted file mode 100644 index da713e642..000000000 --- a/examples/render/01-viewer/opengl2/qt/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - * VCLib * - * Visual Computing Library * - * * - * Copyright(C) 2021-2025 * - * Visual Computing Lab * - * ISTI - Italian National Research Council * - * * - * All rights reserved. * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the Mozilla Public License Version 2.0 as published * - * by the Mozilla Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * Mozilla Public License Version 2.0 * - * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * - ****************************************************************************/ - -#include "get_drawable_mesh.h" - -#include -#include - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - - vcl::qt::ViewerWidget tw("Viewer Qt"); - - // load and set up a drawable mesh - vcl::DrawableMesh drawable = getDrawableMesh(); - - // add the drawable mesh to the scene - // the viewer will own **a copy** of the drawable mesh - tw.pushDrawableObject(drawable); - - tw.fitScene(); - - tw.show(); - - return app.exec(); -} diff --git a/examples/render/01-viewer/bgfx/qt/CMakeLists.txt b/examples/render/01-viewer/qt/CMakeLists.txt similarity index 100% rename from examples/render/01-viewer/bgfx/qt/CMakeLists.txt rename to examples/render/01-viewer/qt/CMakeLists.txt diff --git a/examples/render/01-viewer/bgfx/qt/main.cpp b/examples/render/01-viewer/qt/main.cpp similarity index 90% rename from examples/render/01-viewer/bgfx/qt/main.cpp rename to examples/render/01-viewer/qt/main.cpp index da713e642..7b7174a24 100644 --- a/examples/render/01-viewer/bgfx/qt/main.cpp +++ b/examples/render/01-viewer/qt/main.cpp @@ -34,6 +34,14 @@ int main(int argc, char** argv) // load and set up a drawable mesh vcl::DrawableMesh drawable = getDrawableMesh(); + drawable.color() = vcl::Color::Yellow; + drawable.updateBuffers(); + + auto mrs = drawable.renderSettings(); + mrs.setSurfaceColorPerMesh(); + mrs.setSurfaceShadingFlat(); + drawable.setRenderSettings(mrs); + // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh tw.pushDrawableObject(drawable); diff --git a/examples/render/02-mesh-viewer/CMakeLists.txt b/examples/render/02-mesh-viewer/CMakeLists.txt index 9af5039e5..f681b4a69 100644 --- a/examples/render/02-mesh-viewer/CMakeLists.txt +++ b/examples/render/02-mesh-viewer/CMakeLists.txt @@ -22,9 +22,8 @@ cmake_minimum_required(VERSION 3.24) -if (VCLIB_RENDER_BACKEND STREQUAL "bgfx") - add_subdirectory(bgfx) -endif() -if (VCLIB_RENDER_BACKEND STREQUAL "opengl2") - add_subdirectory(opengl2) +if (TARGET vclib-3rd-qt) + add_subdirectory(qt) endif() + + diff --git a/examples/render/02-mesh-viewer/bgfx/CMakeLists.txt b/examples/render/02-mesh-viewer/bgfx/CMakeLists.txt deleted file mode 100644 index f681b4a69..000000000 --- a/examples/render/02-mesh-viewer/bgfx/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -if (TARGET vclib-3rd-qt) - add_subdirectory(qt) -endif() - - diff --git a/examples/render/02-mesh-viewer/opengl2/CMakeLists.txt b/examples/render/02-mesh-viewer/opengl2/CMakeLists.txt deleted file mode 100644 index f681b4a69..000000000 --- a/examples/render/02-mesh-viewer/opengl2/CMakeLists.txt +++ /dev/null @@ -1,29 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -if (TARGET vclib-3rd-qt) - add_subdirectory(qt) -endif() - - diff --git a/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt b/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt deleted file mode 100644 index 89e7e449d..000000000 --- a/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -set(EXAMPLE_NAME 02-mesh-viewer-qt) -project(vclib-render-example-${EXAMPLE_NAME}) - -### Build settings -set(CMAKE_CXX_STANDARD 20) - -set(SOURCES - main.cpp) - -# will create a target called 'vclib-render-example-${EXAMPLE_NAME}' -vclib_add_example(${EXAMPLE_NAME} - VCLIB_MODULE render - SOURCES ${SOURCES}) diff --git a/examples/render/02-mesh-viewer/opengl2/qt/main.cpp b/examples/render/02-mesh-viewer/opengl2/qt/main.cpp deleted file mode 100644 index c27528d11..000000000 --- a/examples/render/02-mesh-viewer/opengl2/qt/main.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * VCLib * - * Visual Computing Library * - * * - * Copyright(C) 2021-2025 * - * Visual Computing Lab * - * ISTI - Italian National Research Council * - * * - * All rights reserved. * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the Mozilla Public License Version 2.0 as published * - * by the Mozilla Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * Mozilla Public License Version 2.0 * - * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * - ****************************************************************************/ - -#include "get_drawable_mesh.h" - -#include - -#include - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - - vcl::qt::MeshViewer mv; - - // load and set up a drawable mesh - auto m = getDrawableMesh("TextureDouble.ply"); - - m.enablePerFaceColor(); - for (auto& f : m.faces()) { - if (f.index() % 3 == 0) - f.color() = vcl::Color::Red; - else if (f.index() % 3 == 1) - f.color() = vcl::Color::Green; - else - f.color() = vcl::Color::Blue; - } - m.updateBuffers(); - - auto v = std::make_shared(); - v->pushBack(m); - - mv.setDrawableObjectVector(v); - - mv.show(); - mv.showMaximized(); - - return app.exec(); -} diff --git a/examples/render/02-mesh-viewer/bgfx/qt/CMakeLists.txt b/examples/render/02-mesh-viewer/qt/CMakeLists.txt similarity index 100% rename from examples/render/02-mesh-viewer/bgfx/qt/CMakeLists.txt rename to examples/render/02-mesh-viewer/qt/CMakeLists.txt diff --git a/examples/render/02-mesh-viewer/bgfx/qt/main.cpp b/examples/render/02-mesh-viewer/qt/main.cpp similarity index 100% rename from examples/render/02-mesh-viewer/bgfx/qt/main.cpp rename to examples/render/02-mesh-viewer/qt/main.cpp diff --git a/examples/render/03-viewer-with-text/CMakeLists.txt b/examples/render/03-viewer-with-text/CMakeLists.txt index 1f7b4fa77..35cda9898 100644 --- a/examples/render/03-viewer-with-text/CMakeLists.txt +++ b/examples/render/03-viewer-with-text/CMakeLists.txt @@ -23,5 +23,10 @@ cmake_minimum_required(VERSION 3.24) if (VCLIB_RENDER_BACKEND STREQUAL "bgfx") - add_subdirectory(bgfx) + if (TARGET vclib-3rd-qt) + add_subdirectory(qt) + endif() + if (TARGET vclib-3rd-glfw) + add_subdirectory(glfw) + endif() endif() diff --git a/examples/render/03-viewer-with-text/bgfx/CMakeLists.txt b/examples/render/03-viewer-with-text/bgfx/CMakeLists.txt deleted file mode 100644 index 04f06cfc4..000000000 --- a/examples/render/03-viewer-with-text/bgfx/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -#***************************************************************************** -#* VCLib * -#* Visual Computing Library * -#* * -#* Copyright(C) 2021-2025 * -#* Visual Computing Lab * -#* ISTI - Italian National Research Council * -#* * -#* All rights reserved. * -#* * -#* This program is free software; you can redistribute it and/or modify * -#* it under the terms of the Mozilla Public License Version 2.0 as published * -#* by the Mozilla Foundation; either version 2 of the License, or * -#* (at your option) any later version. * -#* * -#* This program is distributed in the hope that it will be useful, * -#* but WITHOUT ANY WARRANTY; without even the implied warranty of * -#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -#* Mozilla Public License Version 2.0 * -#* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * -#****************************************************************************/ - -cmake_minimum_required(VERSION 3.24) - -if (TARGET vclib-3rd-qt) - add_subdirectory(qt) -endif() -if (TARGET vclib-3rd-glfw) - add_subdirectory(glfw) -endif() diff --git a/examples/render/03-viewer-with-text/bgfx/glfw/CMakeLists.txt b/examples/render/03-viewer-with-text/glfw/CMakeLists.txt similarity index 100% rename from examples/render/03-viewer-with-text/bgfx/glfw/CMakeLists.txt rename to examples/render/03-viewer-with-text/glfw/CMakeLists.txt diff --git a/examples/render/03-viewer-with-text/bgfx/glfw/main.cpp b/examples/render/03-viewer-with-text/glfw/main.cpp similarity index 100% rename from examples/render/03-viewer-with-text/bgfx/glfw/main.cpp rename to examples/render/03-viewer-with-text/glfw/main.cpp diff --git a/examples/render/03-viewer-with-text/bgfx/qt/CMakeLists.txt b/examples/render/03-viewer-with-text/qt/CMakeLists.txt similarity index 100% rename from examples/render/03-viewer-with-text/bgfx/qt/CMakeLists.txt rename to examples/render/03-viewer-with-text/qt/CMakeLists.txt diff --git a/examples/render/03-viewer-with-text/bgfx/qt/main.cpp b/examples/render/03-viewer-with-text/qt/main.cpp similarity index 100% rename from examples/render/03-viewer-with-text/bgfx/qt/main.cpp rename to examples/render/03-viewer-with-text/qt/main.cpp