diff --git a/CMakeLists.txt b/CMakeLists.txt index 386395bb..595a5d4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,14 @@ endif() # Main PROJECT definition project( rocky - VERSION 0.5.1 + VERSION 0.5.2 DESCRIPTION "Rocky by Pelican Mapping" HOMEPAGE_URL https://github.com/pelicanmapping/rocky LANGUAGES CXX C ) # please update this with each ABI change!! -set(PROJECT_VERSION_ABI 112) +set(PROJECT_VERSION_ABI 113) # require C++17 set(CMAKE_CXX_STANDARD 17) diff --git a/data/fonts/times.vsgb b/data/fonts/times.vsgb new file mode 100644 index 00000000..c3f83491 Binary files /dev/null and b/data/fonts/times.vsgb differ diff --git a/src/apps/rocky_demo/Demo_Simulation.h b/src/apps/rocky_demo/Demo_Simulation.h index b23ea8dc..a18ca294 100644 --- a/src/apps/rocky_demo/Demo_Simulation.h +++ b/src/apps/rocky_demo/Demo_Simulation.h @@ -38,6 +38,7 @@ namespace struct Declutter { + bool dummy = false; }; class DeclutterSystem : public ECS::System @@ -66,7 +67,7 @@ namespace sorted.clear(); double ar = -1.0; // same for all objects auto view = registry.view(); - for (auto& [entity, declutter, transform] : view.each()) + for (auto&& [entity, declutter, transform] : view.each()) { if (transform.node) { @@ -115,7 +116,7 @@ namespace void resetVisibility() { auto view = registry.view(); - for (auto& [entity, declutter, visibility] : view.each()) + for (auto&& [entity, declutter, visibility] : view.each()) { visibility.visible = true; } @@ -211,7 +212,8 @@ auto Demo_Simulation = [](Application& app) { // add an icon: auto io = app.instance.io(); - auto image = io.services.readImageFromURI("https://github.com/gwaldron/osgearth/blob/master/data/airport.png?raw=true", io); + //auto image = io.services.readImageFromURI("https://github.com/gwaldron/osgearth/blob/master/data/airport.png?raw=true", io); + auto image = io.services.readImageFromURI("https://user-images.githubusercontent.com/326618/236923465-c85eb0c2-4d31-41a7-8ef1-29d34696e3cb.png", io); status = image.status; if (image.status.ok()) { @@ -280,7 +282,7 @@ auto Demo_Simulation = [](Application& app) if (sim.declutterEnabled) { - ImGuiLTable::SliderDouble(" Buffer size", &sim.declutter.buffer, 0.0f, 0.03f, "%.3f"); + ImGuiLTable::SliderDouble(" Separation", &sim.declutter.buffer, 0.0f, 0.03f, "%.3f"); ImGuiLTable::SliderFloat(" Frequency", &sim.declutter_hertz, 1.0f, 30.0f, "%.0f hz"); ImGuiLTable::Text(" Visible", "%ld / %ld", sim.declutter.visible, sim.declutter.total); } diff --git a/src/rocky/CMakeLists.txt b/src/rocky/CMakeLists.txt index 43ac6a4b..852a8e0f 100644 --- a/src/rocky/CMakeLists.txt +++ b/src/rocky/CMakeLists.txt @@ -25,7 +25,8 @@ endmacro() file(GLOB HEADERS_CONTRIB contrib/*.h) file(GLOB SOURCES_CONTRIB contrib/*.cpp) - +# data files to install +list(APPEND DATA_FILES "${PROJECT_SOURCE_DIR}/data/fonts/times.vsgb") # find dependecies ---- @@ -256,6 +257,7 @@ install( # installs the default headers. install(FILES ${HEADERS_CORE} DESTINATION include/rocky) install(FILES ${HEADERS_CONTRIB} DESTINATION include/rocky/contrib) +install(FILES ${DATA_FILES} DESTINATION share/rocky/data) # installs the VSG headers and shaders. if(ROCKY_RENDERER_VSG) diff --git a/src/rocky/vsg/ECS.h b/src/rocky/vsg/ECS.h index a6af235e..c04d55a4 100644 --- a/src/rocky/vsg/ECS.h +++ b/src/rocky/vsg/ECS.h @@ -17,7 +17,7 @@ #include #include -#define ENTT_NO_ETO +//#define ENTT_NO_ETO #include namespace ROCKY_NAMESPACE @@ -359,16 +359,20 @@ namespace ROCKY_NAMESPACE template inline void SystemNode_on_construct(entt::registry& r, entt::entity e) { - // Add a visibility tag - r.emplace(e); + T& new_component = r.get(e); - T& comp = r.get(e); + // Add a visibility tag (if first time dealing with this entity) + // I am not sure yet how to remove this in the end. + if (!r.try_get(e)) + { + r.emplace(e); + } // Create a Renderable component and attach it to the new component. - comp.entity = r.create(); - r.emplace(comp.entity); + new_component.entity = r.create(); + r.emplace(new_component.entity); - comp.revision++; + new_component.revision++; } template @@ -377,7 +381,8 @@ namespace ROCKY_NAMESPACE T& comp = r.get(e); r.remove(comp.entity); - r.remove(e); + // Only want to remove it if there are no more components on this entity. I guess. + //r.remove(e); } } diff --git a/src/rocky/vsg/InstanceVSG.cpp b/src/rocky/vsg/InstanceVSG.cpp index 48ba6745..ccee4ee7 100644 --- a/src/rocky/vsg/InstanceVSG.cpp +++ b/src/rocky/vsg/InstanceVSG.cpp @@ -276,11 +276,19 @@ InstanceVSG::ctor(int& argc, char** argv) // For system fonts runtime.readerWriterOptions->paths.push_back("C:/windows/fonts"); + runtime.readerWriterOptions->paths.push_back("/etc/fonts"); + runtime.readerWriterOptions->paths.push_back("/usr/local/share/rocky/data"); // Load a default font if there is one auto font_file = util::getEnvVar("ROCKY_DEFAULT_FONT"); if (font_file.empty()) + { +#ifdef WIN32 font_file = "arial.ttf"; +#else + font_file = "times.vsgb"; +#endif + } runtime.defaultFont = vsg::read_cast(font_file, runtime.readerWriterOptions); if (!runtime.defaultFont)