Skip to content

Commit

Permalink
Fix gcc errors, add font paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gwaldron committed Nov 1, 2024
1 parent fdf762b commit 11aceba
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file added data/fonts/times.vsgb
Binary file not shown.
10 changes: 6 additions & 4 deletions src/apps/rocky_demo/Demo_Simulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace

struct Declutter
{
bool dummy = false;
};

class DeclutterSystem : public ECS::System
Expand Down Expand Up @@ -66,7 +67,7 @@ namespace
sorted.clear();
double ar = -1.0; // same for all objects
auto view = registry.view<Declutter, Transform>();
for (auto& [entity, declutter, transform] : view.each())
for (auto&& [entity, declutter, transform] : view.each())
{
if (transform.node)
{
Expand Down Expand Up @@ -115,7 +116,7 @@ namespace
void resetVisibility()
{
auto view = registry.view<Declutter, ECS::Visibility>();
for (auto& [entity, declutter, visibility] : view.each())
for (auto&& [entity, declutter, visibility] : view.each())
{
visibility.visible = true;
}
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion src/rocky/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 13 additions & 8 deletions src/rocky/vsg/ECS.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <chrono>
#include <type_traits>

#define ENTT_NO_ETO
//#define ENTT_NO_ETO
#include <entt/entt.hpp>

namespace ROCKY_NAMESPACE
Expand Down Expand Up @@ -359,16 +359,20 @@ namespace ROCKY_NAMESPACE
template<typename T>
inline void SystemNode_on_construct(entt::registry& r, entt::entity e)
{
// Add a visibility tag
r.emplace<ECS::Visibility>(e);
T& new_component = r.get<T>(e);

T& comp = r.get<T>(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<ECS::Visibility>(e))
{
r.emplace<ECS::Visibility>(e);
}

// Create a Renderable component and attach it to the new component.
comp.entity = r.create();
r.emplace<ECS::Renderable>(comp.entity);
new_component.entity = r.create();
r.emplace<ECS::Renderable>(new_component.entity);

comp.revision++;
new_component.revision++;
}

template<typename T>
Expand All @@ -377,7 +381,8 @@ namespace ROCKY_NAMESPACE
T& comp = r.get<T>(e);
r.remove<ECS::Renderable>(comp.entity);

r.remove<ECS::Visibility>(e);
// Only want to remove it if there are no more components on this entity. I guess.
//r.remove<ECS::Visibility>(e);
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/rocky/vsg/InstanceVSG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<vsg::Font>(font_file, runtime.readerWriterOptions);
if (!runtime.defaultFont)
Expand Down

0 comments on commit 11aceba

Please sign in to comment.