From 3f7e7dee064d5070d99446c00431822e4a7fa2b9 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Wed, 8 Jan 2025 15:56:48 +0100 Subject: [PATCH] [render] all render examples use generic getDrawableMesh function implemented in common --- examples/render/01-viewer/bgfx/glfw/main.cpp | 2 +- examples/render/01-viewer/bgfx/qt/main.cpp | 2 +- .../render/01-viewer/opengl2/glfw/main.cpp | 16 +--- examples/render/01-viewer/opengl2/qt/main.cpp | 16 +--- .../02-mesh-viewer/bgfx/qt/CMakeLists.txt | 5 +- .../render/02-mesh-viewer/bgfx/qt/common.h | 77 ------------------- .../render/02-mesh-viewer/bgfx/qt/main.cpp | 19 ++++- .../02-mesh-viewer/opengl2/qt/CMakeLists.txt | 5 +- .../render/02-mesh-viewer/opengl2/qt/common.h | 77 ------------------- .../render/02-mesh-viewer/opengl2/qt/main.cpp | 19 ++++- .../bgfx/glfw/CMakeLists.txt | 5 +- .../03-viewer-with-text/bgfx/glfw/common.h | 63 --------------- .../03-viewer-with-text/bgfx/glfw/main.cpp | 8 +- .../bgfx/qt/CMakeLists.txt | 5 +- .../03-viewer-with-text/bgfx/qt/common.h | 63 --------------- .../03-viewer-with-text/bgfx/qt/main.cpp | 11 +-- examples/render/910-viewer-imgui/main.cpp | 2 +- examples/render/common/get_drawable_mesh.h | 9 ++- 18 files changed, 54 insertions(+), 350 deletions(-) delete mode 100644 examples/render/02-mesh-viewer/bgfx/qt/common.h delete mode 100644 examples/render/02-mesh-viewer/opengl2/qt/common.h delete mode 100644 examples/render/03-viewer-with-text/bgfx/glfw/common.h delete mode 100644 examples/render/03-viewer-with-text/bgfx/qt/common.h diff --git a/examples/render/01-viewer/bgfx/glfw/main.cpp b/examples/render/01-viewer/bgfx/glfw/main.cpp index 1ce82a2b8..1e6f72fe2 100644 --- a/examples/render/01-viewer/bgfx/glfw/main.cpp +++ b/examples/render/01-viewer/bgfx/glfw/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char** argv) vcl::glfw::ViewerWindow tw("Viewer GLFW"); // load and set up a drawable mesh - vcl::DrawableMesh drawable = getDrawableMesh(); + vcl::DrawableMesh drawable = getDrawableMesh(); // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh diff --git a/examples/render/01-viewer/bgfx/qt/main.cpp b/examples/render/01-viewer/bgfx/qt/main.cpp index c315a8334..da713e642 100644 --- a/examples/render/01-viewer/bgfx/qt/main.cpp +++ b/examples/render/01-viewer/bgfx/qt/main.cpp @@ -32,7 +32,7 @@ int main(int argc, char** argv) vcl::qt::ViewerWidget tw("Viewer Qt"); // load and set up a drawable mesh - vcl::DrawableMesh drawable = getDrawableMesh(); + vcl::DrawableMesh drawable = getDrawableMesh(); // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh diff --git a/examples/render/01-viewer/opengl2/glfw/main.cpp b/examples/render/01-viewer/opengl2/glfw/main.cpp index 5d79c7908..9dbeb57be 100644 --- a/examples/render/01-viewer/opengl2/glfw/main.cpp +++ b/examples/render/01-viewer/opengl2/glfw/main.cpp @@ -29,7 +29,7 @@ int main(int argc, char** argv) vcl::glfw::ViewerWindow tw("Viewer GLFW"); // load and set up a drawable mesh - vcl::DrawableMesh drawable = getDrawableMesh(); + vcl::DrawableMesh drawable = getDrawableMesh(); drawable.color() = vcl::Color::Yellow; drawable.updateBuffers(); @@ -47,19 +47,5 @@ int main(int argc, char** argv) tw.show(); - // vcl::glfw::ViewerWindow tw2("Viewer GLFW"); - - // // load and set up a drawable mesh - // vcl::DrawableMesh drawable2 = - // getDrawableMesh("greek_helmet.obj"); - - // // add the drawable mesh to the scene - // // the viewer will own **a copy** of the drawable mesh - // tw2.pushDrawableObject(drawable2); - - // tw2.fitScene(); - - // tw2.show(); - return 0; } diff --git a/examples/render/01-viewer/opengl2/qt/main.cpp b/examples/render/01-viewer/opengl2/qt/main.cpp index cce0a1102..da713e642 100644 --- a/examples/render/01-viewer/opengl2/qt/main.cpp +++ b/examples/render/01-viewer/opengl2/qt/main.cpp @@ -32,7 +32,7 @@ int main(int argc, char** argv) vcl::qt::ViewerWidget tw("Viewer Qt"); // load and set up a drawable mesh - vcl::DrawableMesh drawable = getDrawableMesh(); + vcl::DrawableMesh drawable = getDrawableMesh(); // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh @@ -42,19 +42,5 @@ int main(int argc, char** argv) tw.show(); - // vcl::qt::ViewerWidget tw2("Viewer Qt"); - - // // load and set up a drawable mesh - // vcl::DrawableMesh drawable2 = - // getDrawableMesh("greek_helmet.obj"); - - // // add the drawable mesh to the scene - // // the viewer will own **a copy** of the drawable mesh - // tw2.pushDrawableObject(drawable2); - - // tw2.fitScene(); - - // tw2.show(); - return app.exec(); } diff --git a/examples/render/02-mesh-viewer/bgfx/qt/CMakeLists.txt b/examples/render/02-mesh-viewer/bgfx/qt/CMakeLists.txt index 7eb46b1f0..89e7e449d 100644 --- a/examples/render/02-mesh-viewer/bgfx/qt/CMakeLists.txt +++ b/examples/render/02-mesh-viewer/bgfx/qt/CMakeLists.txt @@ -28,13 +28,10 @@ project(vclib-render-example-${EXAMPLE_NAME}) ### Build settings set(CMAKE_CXX_STANDARD 20) -set(HEADERS - common.h) - set(SOURCES main.cpp) # will create a target called 'vclib-render-example-${EXAMPLE_NAME}' vclib_add_example(${EXAMPLE_NAME} VCLIB_MODULE render - SOURCES ${HEADERS} ${SOURCES}) + SOURCES ${SOURCES}) diff --git a/examples/render/02-mesh-viewer/bgfx/qt/common.h b/examples/render/02-mesh-viewer/bgfx/qt/common.h deleted file mode 100644 index 9ee5a9535..000000000 --- a/examples/render/02-mesh-viewer/bgfx/qt/common.h +++ /dev/null @@ -1,77 +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. * - ****************************************************************************/ - -#ifndef COMMON_H -#define COMMON_H - -#include -#include -#include -#include - -#include - -template -vcl::DrawableMesh getDrawableMesh() -{ - vcl::LoadSettings s; - s.loadTextureImages = true; - // load a mesh: - // MeshType m = - // vcl::load("/home/alessandro/tmp/chimera/chimera.ply"); - // MeshType m = vcl::load(VCLIB_EXAMPLE_MESHES_PATH - // "/greek_helmet.obj"); MeshType m = - // vcl::load(VCLIB_EXAMPLE_MESHES_PATH - // "/bunny_textured.ply"); - // MeshType m = vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/bimba.obj"); - MeshType m = - vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/TextureDouble.ply", s); - vcl::updatePerVertexAndFaceNormals(m); - - // enable the vertex color of the mesh and set it to gray - m.enablePerVertexColor(); - vcl::setPerVertexColor(m, vcl::Color::Gray); - 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; - } - - // create a MeshRenderSettings object, that allows to set the rendering - // options of the mesh - // default is what we want: color per vertex, smooth shading, no wireframe - vcl::MeshRenderSettings settings(m); - - // create a DrawableMesh object from the mesh - vcl::DrawableMesh drawable(m); - - // set the settings to the drawable mesh - drawable.setRenderSettings(settings); - - return drawable; -} - -#endif // COMMON_H diff --git a/examples/render/02-mesh-viewer/bgfx/qt/main.cpp b/examples/render/02-mesh-viewer/bgfx/qt/main.cpp index 101b3d048..c27528d11 100644 --- a/examples/render/02-mesh-viewer/bgfx/qt/main.cpp +++ b/examples/render/02-mesh-viewer/bgfx/qt/main.cpp @@ -20,11 +20,11 @@ * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * ****************************************************************************/ -#include +#include "get_drawable_mesh.h" #include -#include "common.h" +#include int main(int argc, char** argv) { @@ -33,10 +33,21 @@ int main(int argc, char** argv) vcl::qt::MeshViewer mv; // load and set up a drawable mesh - auto drawable = getDrawableMesh(); + 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(drawable); + v->pushBack(m); mv.setDrawableObjectVector(v); diff --git a/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt b/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt index 7eb46b1f0..89e7e449d 100644 --- a/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt +++ b/examples/render/02-mesh-viewer/opengl2/qt/CMakeLists.txt @@ -28,13 +28,10 @@ project(vclib-render-example-${EXAMPLE_NAME}) ### Build settings set(CMAKE_CXX_STANDARD 20) -set(HEADERS - common.h) - set(SOURCES main.cpp) # will create a target called 'vclib-render-example-${EXAMPLE_NAME}' vclib_add_example(${EXAMPLE_NAME} VCLIB_MODULE render - SOURCES ${HEADERS} ${SOURCES}) + SOURCES ${SOURCES}) diff --git a/examples/render/02-mesh-viewer/opengl2/qt/common.h b/examples/render/02-mesh-viewer/opengl2/qt/common.h deleted file mode 100644 index 9ee5a9535..000000000 --- a/examples/render/02-mesh-viewer/opengl2/qt/common.h +++ /dev/null @@ -1,77 +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. * - ****************************************************************************/ - -#ifndef COMMON_H -#define COMMON_H - -#include -#include -#include -#include - -#include - -template -vcl::DrawableMesh getDrawableMesh() -{ - vcl::LoadSettings s; - s.loadTextureImages = true; - // load a mesh: - // MeshType m = - // vcl::load("/home/alessandro/tmp/chimera/chimera.ply"); - // MeshType m = vcl::load(VCLIB_EXAMPLE_MESHES_PATH - // "/greek_helmet.obj"); MeshType m = - // vcl::load(VCLIB_EXAMPLE_MESHES_PATH - // "/bunny_textured.ply"); - // MeshType m = vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/bimba.obj"); - MeshType m = - vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/TextureDouble.ply", s); - vcl::updatePerVertexAndFaceNormals(m); - - // enable the vertex color of the mesh and set it to gray - m.enablePerVertexColor(); - vcl::setPerVertexColor(m, vcl::Color::Gray); - 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; - } - - // create a MeshRenderSettings object, that allows to set the rendering - // options of the mesh - // default is what we want: color per vertex, smooth shading, no wireframe - vcl::MeshRenderSettings settings(m); - - // create a DrawableMesh object from the mesh - vcl::DrawableMesh drawable(m); - - // set the settings to the drawable mesh - drawable.setRenderSettings(settings); - - return drawable; -} - -#endif // COMMON_H diff --git a/examples/render/02-mesh-viewer/opengl2/qt/main.cpp b/examples/render/02-mesh-viewer/opengl2/qt/main.cpp index 101b3d048..c27528d11 100644 --- a/examples/render/02-mesh-viewer/opengl2/qt/main.cpp +++ b/examples/render/02-mesh-viewer/opengl2/qt/main.cpp @@ -20,11 +20,11 @@ * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * ****************************************************************************/ -#include +#include "get_drawable_mesh.h" #include -#include "common.h" +#include int main(int argc, char** argv) { @@ -33,10 +33,21 @@ int main(int argc, char** argv) vcl::qt::MeshViewer mv; // load and set up a drawable mesh - auto drawable = getDrawableMesh(); + 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(drawable); + v->pushBack(m); mv.setDrawableObjectVector(v); diff --git a/examples/render/03-viewer-with-text/bgfx/glfw/CMakeLists.txt b/examples/render/03-viewer-with-text/bgfx/glfw/CMakeLists.txt index f539608b5..3c2389a35 100644 --- a/examples/render/03-viewer-with-text/bgfx/glfw/CMakeLists.txt +++ b/examples/render/03-viewer-with-text/bgfx/glfw/CMakeLists.txt @@ -28,13 +28,10 @@ project(vclib-render-example-${EXAMPLE_NAME}) ### Build settings set(CMAKE_CXX_STANDARD 20) -set(HEADERS - common.h) - set(SOURCES main.cpp) # will create a target called 'vclib-render-example-${EXAMPLE_NAME}' vclib_add_example(${EXAMPLE_NAME} VCLIB_MODULE render - SOURCES ${HEADERS} ${SOURCES}) + SOURCES ${SOURCES}) diff --git a/examples/render/03-viewer-with-text/bgfx/glfw/common.h b/examples/render/03-viewer-with-text/bgfx/glfw/common.h deleted file mode 100644 index a7590f3df..000000000 --- a/examples/render/03-viewer-with-text/bgfx/glfw/common.h +++ /dev/null @@ -1,63 +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. * - ****************************************************************************/ - -#ifndef COMMON_H -#define COMMON_H - -#include -#include -#include -#include - -#include - -inline vcl::TriMesh getMesh(const std::string& filename = "bimba.obj") -{ - // load a mesh: - vcl::TriMesh m = - vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/" + filename); - vcl::updatePerVertexAndFaceNormals(m); - - // enable the vertex color of the mesh and set it to gray - m.enablePerVertexColor(); - vcl::setPerVertexColor(m, vcl::Color::Gray); - return m; -} - -inline vcl::DrawableMesh getDrawableMesh( - const vcl::TriMesh& m = getMesh()) -{ - // create a MeshRenderSettings object, that allows to set the rendering - // options of the mesh - // default is what we want: color per vertex, smooth shading, no wireframe - vcl::MeshRenderSettings settings(m); - - // create a DrawableMesh object from the mesh - vcl::DrawableMesh drawable(m); - - // set the settings to the drawable mesh - drawable.setRenderSettings(settings); - - return drawable; -} - -#endif // COMMON_H diff --git a/examples/render/03-viewer-with-text/bgfx/glfw/main.cpp b/examples/render/03-viewer-with-text/bgfx/glfw/main.cpp index b6f3b11e7..cfeb97a43 100644 --- a/examples/render/03-viewer-with-text/bgfx/glfw/main.cpp +++ b/examples/render/03-viewer-with-text/bgfx/glfw/main.cpp @@ -20,7 +20,7 @@ * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * ****************************************************************************/ -#include "common.h" +#include "get_drawable_mesh.h" #include @@ -29,12 +29,12 @@ int main(int argc, char** argv) vcl::glfw::ViewerWindow tw("Viewer GLFW"); // load and set up a drawable mesh - vcl::TriMesh m = getMesh("greek_helmet.obj"); - vcl::DrawableMesh drawable = getDrawableMesh(m); + vcl::DrawableMesh m = + getDrawableMesh("greek_helmet.obj"); // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh - tw.pushDrawableObject(drawable); + tw.pushDrawableObject(m); tw.enableText(); diff --git a/examples/render/03-viewer-with-text/bgfx/qt/CMakeLists.txt b/examples/render/03-viewer-with-text/bgfx/qt/CMakeLists.txt index 75b7610e3..39063cc5b 100644 --- a/examples/render/03-viewer-with-text/bgfx/qt/CMakeLists.txt +++ b/examples/render/03-viewer-with-text/bgfx/qt/CMakeLists.txt @@ -28,13 +28,10 @@ project(vclib-render-example-${EXAMPLE_NAME}) ### Build settings set(CMAKE_CXX_STANDARD 20) -set(HEADERS - common.h) - set(SOURCES main.cpp) # will create a target called 'vclib-render-example-${EXAMPLE_NAME}' vclib_add_example(${EXAMPLE_NAME} VCLIB_MODULE render - SOURCES ${HEADERS} ${SOURCES}) + SOURCES ${SOURCES}) diff --git a/examples/render/03-viewer-with-text/bgfx/qt/common.h b/examples/render/03-viewer-with-text/bgfx/qt/common.h deleted file mode 100644 index a7590f3df..000000000 --- a/examples/render/03-viewer-with-text/bgfx/qt/common.h +++ /dev/null @@ -1,63 +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. * - ****************************************************************************/ - -#ifndef COMMON_H -#define COMMON_H - -#include -#include -#include -#include - -#include - -inline vcl::TriMesh getMesh(const std::string& filename = "bimba.obj") -{ - // load a mesh: - vcl::TriMesh m = - vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/" + filename); - vcl::updatePerVertexAndFaceNormals(m); - - // enable the vertex color of the mesh and set it to gray - m.enablePerVertexColor(); - vcl::setPerVertexColor(m, vcl::Color::Gray); - return m; -} - -inline vcl::DrawableMesh getDrawableMesh( - const vcl::TriMesh& m = getMesh()) -{ - // create a MeshRenderSettings object, that allows to set the rendering - // options of the mesh - // default is what we want: color per vertex, smooth shading, no wireframe - vcl::MeshRenderSettings settings(m); - - // create a DrawableMesh object from the mesh - vcl::DrawableMesh drawable(m); - - // set the settings to the drawable mesh - drawable.setRenderSettings(settings); - - return drawable; -} - -#endif // COMMON_H diff --git a/examples/render/03-viewer-with-text/bgfx/qt/main.cpp b/examples/render/03-viewer-with-text/bgfx/qt/main.cpp index 0dde08757..fbf0759a7 100644 --- a/examples/render/03-viewer-with-text/bgfx/qt/main.cpp +++ b/examples/render/03-viewer-with-text/bgfx/qt/main.cpp @@ -20,11 +20,12 @@ * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * ****************************************************************************/ -#include "common.h" +#include "get_drawable_mesh.h" -#include #include +#include + int main(int argc, char** argv) { QApplication app(argc, argv); @@ -32,12 +33,12 @@ int main(int argc, char** argv) vcl::qt::ViewerWidget tw("Viewer Qt"); // load and set up a drawable mesh - vcl::TriMesh m = getMesh("greek_helmet.obj"); - vcl::DrawableMesh drawable = getDrawableMesh(m); + vcl::DrawableMesh m = + getDrawableMesh("greek_helmet.obj"); // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh - tw.pushDrawableObject(drawable); + tw.pushDrawableObject(m); tw.enableText(); diff --git a/examples/render/910-viewer-imgui/main.cpp b/examples/render/910-viewer-imgui/main.cpp index af98a6656..43427d35d 100644 --- a/examples/render/910-viewer-imgui/main.cpp +++ b/examples/render/910-viewer-imgui/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char** argv) ImguiDemo tw("Viewer GLFW"); // load and set up a drawable mesh - vcl::DrawableMesh drawable = getDrawableMesh(); + vcl::DrawableMesh drawable = getDrawableMesh(); // add the drawable mesh to the scene // the viewer will own **a copy** of the drawable mesh diff --git a/examples/render/common/get_drawable_mesh.h b/examples/render/common/get_drawable_mesh.h index 4a7a9af71..d8dca4991 100644 --- a/examples/render/common/get_drawable_mesh.h +++ b/examples/render/common/get_drawable_mesh.h @@ -30,12 +30,13 @@ #include -inline vcl::DrawableMesh getDrawableMesh( +template +inline vcl::DrawableMesh getDrawableMesh( const std::string& filename = "bimba.obj") { // load a mesh: - vcl::TriMesh m = - vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/" + filename); + MeshType m = + vcl::load(VCLIB_EXAMPLE_MESHES_PATH "/" + filename); vcl::updatePerVertexAndFaceNormals(m); // enable the vertex color of the mesh and set it to gray @@ -48,7 +49,7 @@ inline vcl::DrawableMesh getDrawableMesh( vcl::MeshRenderSettings settings(m); // create a DrawableMesh object from the mesh - vcl::DrawableMesh drawable(m); + vcl::DrawableMesh drawable(m); // set the settings to the drawable mesh drawable.setRenderSettings(settings);