diff --git a/doxygen/_application_8h_source.html b/doxygen/_application_8h_source.html
index afc99f6e..032fd3ab 100644
--- a/doxygen/_application_8h_source.html
+++ b/doxygen/_application_8h_source.html
@@ -88,50 +88,50 @@
-
-
-
- 25 class ROCKY_EXPORT Application
-
-
-
-
- 34 Application(
int& argc,
char** argv);
-
-
-
-
-
- 48 void onNextUpdate(std::function<
void()> func);
-
- 51 void setViewer(vsg::ref_ptr<vsg::Viewer> viewer);
-
- 54 std::string about()
const;
-
- 57 bool debugLayerOn()
const {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 82 jobs::detail::semaphore handle;
-
- 84 entt::registry registry;
- 85 entt::registry& entities = registry;
+
+
+
+
+ 26 class ROCKY_EXPORT Application
+
+
+
+
+ 35 Application(
int& argc,
char** argv);
+
+
+
+
+
+ 49 void onNextUpdate(std::function<
void()> func);
+
+ 52 void setViewer(vsg::ref_ptr<vsg::Viewer> viewer);
+
+ 55 std::string about()
const;
+
+ 58 bool debugLayerOn()
const {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 83 jobs::detail::semaphore handle;
+
+ 85 ecs::Registry registry;
88 vsg::ref_ptr<rocky::MapNode> mapNode;
diff --git a/doxygen/_e_c_s_8h_source.html b/doxygen/_e_c_s_8h_source.html
index aef4b97a..f64c54c3 100644
--- a/doxygen/_e_c_s_8h_source.html
+++ b/doxygen/_e_c_s_8h_source.html
@@ -94,577 +94,630 @@
- 29 using time_point = std::chrono::steady_clock::time_point;
-
-
- 32 template<
typename T,
int NUM_VIEWS, T default_value = T{} >
-
-
- 35 PerView() { views.fill(default_value); }
- 36 std::array<T, NUM_VIEWS> views;
- 37 auto& operator[](
int i) {
return views[i]; }
- 38 const auto& operator[](
int i)
const {
return views[i]; }
- 39 void setAll(
const T& value) { views.fill(value); }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 65 using LockedNode = util::locked_value<vsg::ref_ptr<vsg::Node>>;
- 66 vsg::ref_ptr<vsg::Node> node;
- 67 std::unique_ptr<LockedNode> staged = std::make_unique<LockedNode>();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 109 System(entt::registry& in_registry) :
- 110 registry(in_registry) { }
-
-
-
-
-
-
-
- 127 struct CreateOrUpdateData
-
- 129 vsg::ref_ptr<vsg::Node> existing_node;
- 130 vsg::ref_ptr<vsg::Node> new_node;
- 131 bool new_node_needs_compilation =
true;
-
-
- 134 struct EntityCompileBatch
-
- 136 std::vector<entt::entity> entities;
-
-
-
+ 29 class Registry :
public entt::registry
+
+
+ 32 std::shared_mutex mutex;
+
+
+
+
+ 37 using time_point = std::chrono::steady_clock::time_point;
+
+ 42 template<
typename T,
int NUM_VIEWS, T default_value = T{} >
+
+
+ 45 PerView() { views.fill(default_value); }
+ 46 std::array<T, NUM_VIEWS> views;
+ 47 auto& operator[](
int i) {
return views[i]; }
+ 48 const auto& operator[](
int i)
const {
return views[i]; }
+ 49 void setAll(
const T& value) { views.fill(value); }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 75 using LockedNode = util::locked_value<vsg::ref_ptr<vsg::Node>>;
+ 76 vsg::ref_ptr<vsg::Node> node;
+ 77 std::unique_ptr<LockedNode> staged = std::make_unique<LockedNode>();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 122 System(Registry& in_registry) :
+ 123 registry(in_registry) { }
+
+
+
+
+ 129 vsg::ref_ptr<vsg::Node> existing_node;
+ 130 vsg::ref_ptr<vsg::Node> new_node;
+
+
+
+
+
+
+ 137 std::uint16_t version;
+
+ 139 ~BuildItem() {
if (component)
delete component; }
- 141 virtual void create_or_update(entt::entity entity, CreateOrUpdateData& data,
Runtime& runtime)
const = 0;
- 142 virtual void finish_update(entt::entity entity, CreateOrUpdateData& data)
const = 0;
-
-
-
- 146 class SystemNode :
public vsg::Inherit<SystemNodeBase, SystemNode<T>>,
public System
-
-
-
-
- 152 virtual ~SystemNode<T>();
-
-
- 155 void update(
Runtime&)
override;
+
+ 142 BuildItem() =
default;
+ 143 BuildItem(
const BuildItem&) =
delete;
+ 144 BuildItem& operator=(
const BuildItem& rhs) =
delete;
+ 145 BuildItem(BuildItem&& rhs) noexcept { *
this = std::move(rhs); }
+ 146 BuildItem& operator = (BuildItem&& rhs) noexcept {
+
+ 148 version = rhs.version;
+ 149 existing_node = rhs.existing_node;
+ 150 new_node = rhs.new_node;
+ 151 component = rhs.component;
+ 152 rhs.component =
nullptr;
+
+
+
-
- 159 SystemNode<T>(entt::registry& in_registry);
-
- 162 virtual int featureMask(
const T& t)
const {
return 0; }
+
+
+
+ 160 std::vector<BuildItem> items;
+ 161 class SystemNodeBase* system =
nullptr;
+ 162 Runtime* runtime =
nullptr;
-
-
-
-
-
-
- 170 vsg::ref_ptr<vsg::GraphicsPipelineConfigurator> config;
- 171 vsg::ref_ptr<vsg::Commands> commands;
-
- 173 std::vector<Pipeline> pipelines;
-
-
- 176 void compile(vsg::Context&)
override;
- 177 void traverse(vsg::Visitor& v)
override;
- 178 void traverse(vsg::ConstVisitor& v)
const override;
- 179 void traverse(vsg::RecordTraversal&)
const override;
-
- 187 bool setReferencePoint(
const GeoPoint& point, SRSOperation& out_xform, vsg::dvec3& out_offset)
const;
-
- 190 vsg::ref_ptr<vsg::PipelineLayout> getPipelineLayout(
const T&)
const;
-
- 193 virtual void createOrUpdateNode(entt::entity entity, SystemNodeBase::CreateOrUpdateData& data, Runtime& runtime)
const = 0;
-
- 195 void create_or_update(entt::entity entity, SystemNodeBase::CreateOrUpdateData& data, Runtime& runtime)
const override;
- 196 void finish_update(entt::entity entity, SystemNodeBase::CreateOrUpdateData& data)
const override;
+
+ 165 BuildBatch() =
default;
+ 166 BuildBatch(BuildBatch&& rhs) noexcept =
default;
+ 167 BuildBatch& operator=(BuildBatch&& rhs) noexcept =
default;
+ 168 BuildBatch(
const BuildBatch&) =
delete;
+ 169 BuildBatch& operator=(
const BuildBatch& rhs) =
delete;
+
+
+
+
+
+
+
+ 186 virtual void invokeCreateOrUpdate(BuildItem& ec,
Runtime& runtime)
const = 0;
+
+ 188 virtual void mergeCreateOrUpdateResults(BuildItem& ec) = 0;
+
+
+
+ 192 class SystemNode :
public vsg::Inherit<SystemNodeBase, SystemNode<T>>,
public System
+
+
+ 196 virtual ~SystemNode<T>();
-
-
-
- 201 mutable std::vector<entt::entity> entities_to_update;
-
-
-
-
- 206 Renderable& renderable;
- 207 Transform* transform;
-
-
-
- 211 mutable std::vector<std::vector<RenderLeaf>> pipelineRenderLeaves;
-
-
-
-
-
-
-
-
- 226 void add(vsg::ref_ptr<SystemNode<T>> system)
-
-
- 229 systems.emplace_back(system.get());
-
-
-
- 236 vsg::ref_ptr<T>
add(entt::registry& entities)
-
- 238 auto system = T::create(entities);
-
-
-
- 242 systems.emplace_back(system);
-
-
-
-
- 250 void add(std::shared_ptr<System> system)
-
- 252 non_node_systems.emplace_back(system);
- 253 systems.emplace_back(system.get());
-
-
-
-
- 261 for (
auto& child : children)
-
-
-
-
- 266 systemNode->manager =
this;
-
-
-
- 270 for (
auto& system : systems)
-
- 272 system->initializeSystem(runtime);
-
-
-
-
-
- 280 for (
auto& system : systems)
-
- 282 system->update(runtime);
-
-
-
- 286 void traverse(vsg::RecordTraversal& rt)
const override
-
- 288 vsg::Group::traverse(rt);
-
-
-
-
- 293 util::ring_buffer<SystemNodeBase::EntityCompileBatch> entityCompileJobs{ 16 };
-
-
- 296 std::vector<System*> systems;
- 297 std::vector<std::shared_ptr<System>> non_node_systems;
-
-
+
+ 199 void update(
Runtime&)
override;
+
+
+ 203 SystemNode<T>(Registry& in_registry);
+
+ 206 virtual int featureMask(
const T& t)
const {
return 0; }
+
+
+
+
+
+
+
+ 214 vsg::ref_ptr<vsg::GraphicsPipelineConfigurator> config;
+ 215 vsg::ref_ptr<vsg::Commands> commands;
+
+ 217 std::vector<Pipeline> pipelines;
+
+
+ 220 void compile(vsg::Context&)
override;
+ 221 void traverse(vsg::Visitor& v)
override;
+ 222 void traverse(vsg::ConstVisitor& v)
const override;
+ 223 void traverse(vsg::RecordTraversal&)
const override;
+
+ 231 bool parseReferencePoint(
const GeoPoint& point, SRSOperation& out_xform, vsg::dvec3& out_offset)
const;
+
+ 234 vsg::ref_ptr<vsg::PipelineLayout> getPipelineLayout(
const T&)
const;
+
+ 237 virtual void createOrUpdateNode(
const T&, BuildInfo&, Runtime&)
const = 0;
+
+ 239 void invokeCreateOrUpdate(BuildItem& ec, Runtime& runtime)
const override;
+
+ 241 void mergeCreateOrUpdateResults(BuildItem& ec)
override;
+
+
+
+
+ 246 mutable std::vector<entt::entity> entities_to_update;
+
+
+
+
+ 251 Renderable& renderable;
+ 252 Transform* transform;
+
+
+
+ 256 mutable std::vector<std::vector<RenderLeaf>> pipelineRenderLeaves;
+
+
+
+
+
+
+
+
+ 271 void add(vsg::ref_ptr<SystemNode<T>> system)
+
+
+ 274 systems.emplace_back(system.get());
+
+
+
+ 281 vsg::ref_ptr<T>
add(Registry& registry)
+
+ 283 auto system = T::create(registry);
+
+
+
+ 287 systems.emplace_back(system);
+
+
+
+
+ 295 void add(std::shared_ptr<System> system)
+
+ 297 non_node_systems.emplace_back(system);
+ 298 systems.emplace_back(system.get());
+
-
-
- 307 return vis.parent !=
nullptr ?
visible(*vis.parent, view_index) : vis[view_index];
-
-
- 315 inline void setVisible(entt::registry& r, entt::entity e,
bool value,
int view_index = -1)
-
-
- 318 if (visibility.parent ==
nullptr)
-
-
- 321 visibility[view_index] = value;
-
- 323 visibility.setAll(value);
-
-
-
- 332 inline bool visible(entt::registry& r, entt::entity e,
int view_index = 0)
-
-
-
-
-
-
-
+
+
+ 306 for (
auto& child : children)
+
+
+
+
+ 311 systemNode->manager =
this;
+
+
+
+ 315 for (
auto& system : systems)
+
+ 317 system->initializeSystem(runtime);
+
+
+
+
+
+ 325 void traverse(vsg::RecordTraversal& rt)
const override
+
+ 327 vsg::Group::traverse(rt);
+
+
+
+
+ 332 util::ring_buffer<ecs::BuildBatch> buildInput{ 16 };
+ 333 util::ring_buffer<ecs::BuildBatch> buildOutput{ 16 };
+
+
+ 336 std::vector<System*> systems;
+ 337 std::vector<std::shared_ptr<System>> non_node_systems;
+
+
-
-
-
-
-
-
-
- 348 inline void SystemNode_on_construct(entt::registry& r, entt::entity e)
-
- 350 T& new_component = r.get<T>(e);
-
-
-
- 354 if (!r.try_get<Visibility>(e))
-
- 356 r.emplace<Visibility>(e);
-
-
-
- 360 new_component.attach_point = r.create();
- 361 r.emplace<ecs::Renderable>(new_component.attach_point);
-
- 363 new_component.revision++;
-
-
-
-
- 368 inline void SystemNode_on_update(entt::registry& r, entt::entity e)
-
- 370 T& updated_component = r.get<T>(e);
-
- 372 if (updated_component.attach_point == entt::null)
-
- 374 updated_component.attach_point = r.create();
- 375 r.emplace<ecs::Renderable>(updated_component.attach_point);
-
-
- 378 updated_component.revision++;
-
+
+
+ 347 return vis.parent !=
nullptr ?
visible(*vis.parent, view_index) : (vis.active && vis[view_index]);
+
+
+ 355 inline void setVisible(entt::registry& r, entt::entity e,
bool value,
int view_index = -1)
+
+ 357 ROCKY_SOFT_ASSERT_AND_RETURN(e != entt::null,
void());
+
+ 359 if (visibility.parent ==
nullptr)
+
+
+ 362 visibility[view_index] = value;
+
+ 364 visibility.setAll(value);
+
+
+
+ 373 inline bool visible(entt::registry& r, entt::entity e,
int view_index = 0)
+
+ 375 ROCKY_SOFT_ASSERT_AND_RETURN(e != entt::null,
false);
+
+
+
+
-
-
- 383 inline void SystemNode_on_destroy(entt::registry& r, entt::entity e)
-
- 385 T& component_being_destroyed = r.get<T>(e);
- 386 r.destroy(component_being_destroyed.attach_point);
-
-
-
-
-
- 392 ecs::SystemNode<T>::SystemNode(entt::registry& in_registry) :
-
-
- 395 registry.on_construct<T>().
template connect<&detail::SystemNode_on_construct<T>>();
- 396 registry.on_update<T>().
template connect<&detail::SystemNode_on_update<T>>();
- 397 registry.on_destroy<T>().
template connect<&detail::SystemNode_on_destroy<T>>();
-
-
-
- 401 ecs::SystemNode<T>::~SystemNode()
-
- 403 registry.on_construct<T>().
template disconnect<&detail::SystemNode_on_construct<T>>();
- 404 registry.on_update<T>().
template disconnect<&detail::SystemNode_on_update<T>>();
- 405 registry.on_destroy<T>().
template disconnect<&detail::SystemNode_on_destroy<T>>();
-
+
+
+
+
+
+
+
+
+
+ 390 inline void SystemNode_on_construct(entt::registry& r, entt::entity e)
+
+ 392 T& new_component = r.get<T>(e);
+
+
+
+ 396 if (!r.try_get<Visibility>(e))
+
+ 398 r.emplace<Visibility>(e);
+
+
+
+ 402 new_component.attach_point = r.create();
+ 403 r.emplace<ecs::Renderable>(new_component.attach_point);
+
+ 405 new_component.revision++;
+
-
- 409 inline void ecs::SystemNode<T>::traverse(vsg::Visitor& v)
-
- 411 for (
auto& pipeline : pipelines)
-
- 413 pipeline.commands->accept(v);
-
-
- 416 registry.view<T>().each([&](
auto& c)
-
- 418 auto& renderable = registry.get<Renderable>(c.attach_point);
-
- 420 renderable.node->accept(v);
-
+
+
+ 410 inline void SystemNode_on_update(entt::registry& r, entt::entity e)
+
+ 412 T& updated_component = r.get<T>(e);
+
+ 414 if (updated_component.attach_point == entt::null)
+
+ 416 updated_component.attach_point = r.create();
+ 417 r.emplace<ecs::Renderable>(updated_component.attach_point);
+
+
+ 420 updated_component.revision++;
+
-
-
-
-
- 428 inline void ecs::SystemNode<T>::traverse(vsg::ConstVisitor& v)
const
-
- 430 for (
auto& pipeline : pipelines)
-
- 432 pipeline.commands->accept(v);
-
-
- 435 registry.view<T>().each([&](
auto& c)
-
- 437 auto& renderable = registry.get<Renderable>(c.attach_point);
-
- 439 renderable.node->accept(v);
-
+
+
+ 425 inline void SystemNode_on_destroy(entt::registry& r, entt::entity e)
+
+ 427 T& component_being_destroyed = r.get<T>(e);
+ 428 r.destroy(component_being_destroyed.attach_point);
+
+
+
+
+
+ 434 ecs::SystemNode<T>::SystemNode(Registry& in_registry) :
+
+
+ 437 registry.on_construct<T>().
template connect<&detail::SystemNode_on_construct<T>>();
+ 438 registry.on_update<T>().
template connect<&detail::SystemNode_on_update<T>>();
+ 439 registry.on_destroy<T>().
template connect<&detail::SystemNode_on_destroy<T>>();
+
-
-
-
-
- 446 inline void ecs::SystemNode<T>::compile(vsg::Context& context)
-
-
- 449 for (
auto& pipeline : pipelines)
-
- 451 pipeline.commands->compile(context);
-
-
-
- 455 util::SimpleCompiler compiler(context);
-
- 457 registry.view<T>().each([&](
auto& c)
-
- 459 auto& renderable = registry.get<Renderable>(c.attach_point);
-
- 461 renderable.node->accept(compiler);
-
-
+
+ 443 ecs::SystemNode<T>::~SystemNode()
+
+ 445 registry.on_construct<T>().
template disconnect<&detail::SystemNode_on_construct<T>>();
+ 446 registry.on_update<T>().
template disconnect<&detail::SystemNode_on_update<T>>();
+ 447 registry.on_destroy<T>().
template disconnect<&detail::SystemNode_on_destroy<T>>();
+
+
+
+ 451 inline void ecs::SystemNode<T>::traverse(vsg::Visitor& v)
+
+ 453 for (
auto& pipeline : pipelines)
+
+ 455 pipeline.commands->accept(v);
+
+
+ 458 registry.view<T>().each([&](
auto& c)
+
+ 460 auto& renderable = registry.get<Renderable>(c.attach_point);
+
+ 462 renderable.node->accept(v);
+
-
- 466 inline void ecs::SystemNode<T>::traverse(vsg::RecordTraversal& rt)
const
-
- 468 const vsg::dmat4 identity_matrix = vsg::dmat4(1.0);
- 469 auto viewID = rt.getState()->_commandBuffer->viewID;
-
-
-
- 473 if (pipelineRenderLeaves.empty())
-
- 475 pipelineRenderLeaves.resize(!pipelines.empty() ? pipelines.size() : 1);
-
-
-
- 479 registry.view<T, Visibility>().each([&](
const entt::entity entity,
const T& component,
auto& visibility)
-
- 481 auto& renderable = registry.get<Renderable>(component.attach_point);
-
-
- 484 auto& leaves = !pipelines.empty() ? pipelineRenderLeaves[featureMask(component)] : pipelineRenderLeaves[0];
- 485 auto* transform = registry.try_get<Transform>(entity);
+ 465 Inherit::traverse(v);
+
+
+
+ 470 inline void ecs::SystemNode<T>::traverse(vsg::ConstVisitor& v)
const
+
+ 472 for (
auto& pipeline : pipelines)
+
+ 474 pipeline.commands->accept(v);
+
+
+ 477 registry.view<T>().each([&](
auto& c)
+
+ 479 auto& renderable = registry.get<Renderable>(c.attach_point);
+
+ 481 renderable.node->accept(v);
+
+
+ 484 Inherit::traverse(v);
+
-
- 488 if (
visible(visibility, viewID))
-
- 490 leaves.emplace_back(RenderLeaf{ renderable, transform });
-
-
-
-
-
-
-
- 498 transform->push(rt, identity_matrix,
false);
-
-
-
-
- 503 if (renderable.staged->has_value())
-
- 505 entities_to_update.emplace_back(entity);
-
-
-
- 509 else if (renderable.revision != component.revision)
-
- 511 entities_to_update.emplace_back(entity);
- 512 renderable.revision = component.revision;
-
-
-
-
- 517 for (
int p = 0; p < pipelineRenderLeaves.size(); ++p)
-
- 519 if (!pipelineRenderLeaves[p].empty())
-
-
- 522 if (!pipelines.empty())
-
- 524 pipelines[p].commands->accept(rt);
-
-
-
- 528 for (
auto& leaf : pipelineRenderLeaves[p])
-
-
-
- 532 if (leaf.transform->push(rt, identity_matrix,
true))
+
+ 488 inline void ecs::SystemNode<T>::compile(vsg::Context& context)
+
+
+ 491 for (
auto& pipeline : pipelines)
+
+ 493 pipeline.commands->compile(context);
+
+
+
+ 497 util::SimpleCompiler compiler(context);
+
+ 499 registry.view<T>().each([&](
auto& c)
+
+ 501 auto& renderable = registry.get<Renderable>(c.attach_point);
+
+ 503 renderable.node->accept(compiler);
+
+
+
+
+ 508 inline void ecs::SystemNode<T>::traverse(vsg::RecordTraversal& rt)
const
+
+ 510 const vsg::dmat4 identity_matrix = vsg::dmat4(1.0);
+ 511 auto viewID = rt.getState()->_commandBuffer->viewID;
+
+
+
+ 515 if (pipelineRenderLeaves.empty())
+
+ 517 pipelineRenderLeaves.resize(!pipelines.empty() ? pipelines.size() : 1);
+
+
+
+ 521 registry.view<T, Visibility>().each([&](
const entt::entity entity,
const T& component,
auto& visibility)
+
+ 523 if (visibility.active)
+
+ 525 auto& renderable = registry.get<Renderable>(component.attach_point);
+
+
+ 528 auto& leaves = !pipelines.empty() ? pipelineRenderLeaves[featureMask(component)] : pipelineRenderLeaves[0];
+ 529 auto* transform = registry.try_get<Transform>(entity);
+
+
+ 532 if (
visible(visibility, viewID))
- 534 leaf.renderable.node->accept(rt);
- 535 leaf.transform->pop(rt);
-
-
-
-
- 540 leaf.renderable.node->accept(rt);
-
-
-
-
- 545 pipelineRenderLeaves[p].clear();
-
-
-
-
-
-
- 552 inline void ecs::SystemNode<T>::update(Runtime& runtime)
-
- 554 std::vector<entt::entity> entities_to_create;
-
- 556 for (
auto& entity : entities_to_update)
-
- 558 T& component = registry.get<T>(entity);
- 559 Renderable& renderable = registry.get<Renderable>(component.attach_point);
+ 534 leaves.emplace_back(RenderLeaf{ renderable, transform });
+
+
+
+
+
+
+
+ 542 transform->push(rt, identity_matrix,
false);
+
+
+
+
+ 547 if (renderable.staged->has_value())
+
+ 549 entities_to_update.emplace_back(entity);
+
+
+
+ 553 else if (renderable.revision != component.revision)
+
+ 555 entities_to_update.emplace_back(entity);
+ 556 renderable.revision = component.revision;
+
+
+
-
- 562 vsg::ref_ptr<vsg::Node> new_node;
- 563 if (renderable.staged->get_and_clear(new_node))
-
-
- 566 runtime.dispose(renderable.node);
-
- 568 renderable.node = new_node;
-
-
-
-
-
- 574 entities_to_create.emplace_back(entity);
-
-
-
-
- 579 if (!entities_to_create.empty())
-
- 581 if (SystemNodeBase::manager)
-
- 583 bool ok = SystemNodeBase::manager->entityCompileJobs.emplace(SystemNodeBase::EntityCompileBatch{
- 584 std::move(entities_to_create),
-
-
-
-
-
- 590 Log()->warn(
"Failed to enqueue entity compile job - queue overflow");
-
-
-
+
+ 562 for (
int p = 0; p < pipelineRenderLeaves.size(); ++p)
+
+ 564 if (!pipelineRenderLeaves[p].empty())
+
+
+ 567 if (!pipelines.empty())
+
+ 569 pipelines[p].commands->accept(rt);
+
+
+
+ 573 for (
auto& leaf : pipelineRenderLeaves[p])
+
+
+
+ 577 if (leaf.transform->push(rt, identity_matrix,
true))
+
+ 579 leaf.renderable.node->accept(rt);
+ 580 leaf.transform->pop(rt);
+
+
+
+
+ 585 leaf.renderable.node->accept(rt);
+
+
+
+
+ 590 pipelineRenderLeaves[p].clear();
+
+
+
- 595 entities_to_update.clear();
-
-
-
- 599 void ecs::SystemNode<T>::create_or_update(entt::entity entity, SystemNodeBase::CreateOrUpdateData& data, Runtime& runtime)
const
-
- 601 T& component = registry.get<T>(entity);
- 602 auto& renderable = registry.get<Renderable>(component.attach_point);
- 603 data.existing_node = renderable.node;
- 604 createOrUpdateNode(entity, data, runtime);
-
-
-
- 608 void ecs::SystemNode<T>::finish_update(entt::entity entity, SystemNodeBase::CreateOrUpdateData& data)
const
-
- 610 T& component = registry.get<T>(entity);
- 611 auto& renderable = registry.get<Renderable>(component.attach_point);
-
-
- 614 renderable.staged->set(data.new_node);
-
-
-
-
- 619 bool ecs::SystemNode<T>::setReferencePoint(
const GeoPoint& point, SRSOperation& out_xform, vsg::dvec3& out_offset)
const
-
- 621 if (point.srs.valid())
-
- 623 SRS worldSRS = point.srs;
-
- 625 if (point.srs.isGeodetic())
-
- 627 worldSRS = point.srs.geocentricSRS();
- 628 GeoPoint world = point.transform(worldSRS);
-
-
- 631 out_offset = vsg::dvec3{ world.x, world.y, world.z };
-
-
-
-
- 636 out_offset = vsg::dvec3{ point.x, point.y, point.z };
-
-
- 639 out_xform = SRSOperation(point.srs, worldSRS);
-
-
-
-
-
-
- 646 vsg::ref_ptr<vsg::PipelineLayout> ecs::SystemNode<T>::getPipelineLayout(
const T& t)
const
-
- 648 return pipelines.empty() ? nullptr : pipelines[featureMask(t)].config->layout;
-
-
+
+
+ 597 inline void ecs::SystemNode<T>::update(Runtime& runtime)
+
+ 599 std::vector<ecs::BuildItem> entities_to_build;
+
+ 601 for (
auto& entity : entities_to_update)
+
+ 603 T& component = registry.get<T>(entity);
+ 604 Renderable& renderable = registry.get<Renderable>(component.attach_point);
+
+
+ 607 vsg::ref_ptr<vsg::Node> new_node;
+ 608 if (renderable.staged->get_and_clear(new_node))
+
+
+ 611 runtime.dispose(renderable.node);
+
+ 613 renderable.node = new_node;
+
+
+
+
+
+
+ 620 item.entity = entity;
+ 621 item.version = registry.current(entity);
+ 622 item.component =
new T(component);
+ 623 item.existing_node = renderable.node;
+
+
+ 626 entities_to_build.emplace_back(std::move(item));
+
+
+
+
+ 631 if (!entities_to_build.empty())
+
+ 633 if (SystemNodeBase::manager)
+
+ 635 ecs::BuildBatch batch;
+ 636 batch.items = std::move(entities_to_build);
+
+ 638 batch.runtime = &runtime;
+
+ 640 bool ok = SystemNodeBase::manager->buildInput.emplace(std::move(batch));
+
+
+
+ 644 Log()->warn(
"Failed to enqueue entity compile job - queue overflow");
+
+
+
+
+ 649 entities_to_update.clear();
+
+
+
+ 653 void ecs::SystemNode<T>::invokeCreateOrUpdate(BuildItem& item, Runtime& runtime)
const
+
+ 655 createOrUpdateNode(*
static_cast<T*
>(item.component), item, runtime);
+
+
+
+ 659 void ecs::SystemNode<T>::mergeCreateOrUpdateResults(BuildItem& item)
+
+
+
+ 663 if (item.new_node && registry.valid(item.entity) && registry.current(item.entity) == item.version)
+
+ 665 T& component = registry.get<T>(item.entity);
+ 666 auto& renderable = registry.get<Renderable>(component.attach_point);
+
+
+ 669 renderable.staged->set(item.new_node);
+
+
+
+
+
+ 675 bool ecs::SystemNode<T>::parseReferencePoint(
const GeoPoint& point, SRSOperation& out_xform, vsg::dvec3& out_offset)
const
+
+ 677 if (point.srs.valid())
+
+ 679 SRS worldSRS = point.srs;
+
+ 681 if (point.srs.isGeodetic())
+
+ 683 worldSRS = point.srs.geocentricSRS();
+ 684 GeoPoint world = point.transform(worldSRS);
+
+
+ 687 out_offset = vsg::dvec3{ world.x, world.y, world.z };
+
+
+
+
+ 692 out_offset = vsg::dvec3{ point.x, point.y, point.z };
+
+
+ 695 out_xform = SRSOperation(point.srs, worldSRS);
+
+
+
+
+
+
+ 702 vsg::ref_ptr<vsg::PipelineLayout> ecs::SystemNode<T>::getPipelineLayout(
const T& t)
const
+
+ 704 return pipelines.empty() ? nullptr : pipelines[featureMask(t)].config->layout;
+
+
-
-virtual void update(Runtime &runtime)
Update the ECS system (once per frame)
Definition: ECS.h:103
-entt::registry & registry
ECS entity registry.
Definition: ECS.h:91
-Status status
Status.
Definition: ECS.h:94
-virtual void initializeSystem(Runtime &runtime)
Initialize the ECS system (once at startup)
Definition: ECS.h:97
-
-
-vsg::ref_ptr< T > add(entt::registry &entities)
Definition: ECS.h:236
-void add(std::shared_ptr< System > system)
Definition: ECS.h:250
-void update(Runtime &runtime)
Definition: ECS.h:278
-void add(vsg::ref_ptr< SystemNode< T >> system)
Definition: ECS.h:226
-void initialize(Runtime &runtime)
Definition: ECS.h:259
-void setVisible(entt::registry &r, entt::entity e, bool value, int view_index=-1)
Definition: ECS.h:315
-bool visible(Visibility &vis, int view_index)
Definition: ECS.h:305
+
+Registry & registry
ECS entity registry.
Definition: ECS.h:104
+virtual void update(Runtime &runtime)
Update the ECS system (once per frame)
Definition: ECS.h:116
+Status status
Status.
Definition: ECS.h:107
+virtual void initializeSystem(Runtime &runtime)
Initialize the ECS system (once at startup)
Definition: ECS.h:110
+
+
+vsg::ref_ptr< T > add(Registry ®istry)
Definition: ECS.h:281
+void add(std::shared_ptr< System > system)
Definition: ECS.h:295
+void add(vsg::ref_ptr< SystemNode< T >> system)
Definition: ECS.h:271
+void initialize(Runtime &runtime)
Definition: ECS.h:304
+void setVisible(entt::registry &r, entt::entity e, bool value, int view_index=-1)
Definition: ECS.h:355
+bool visible(Visibility &vis, int view_index)
Definition: ECS.h:345
Definition: Callbacks.h:16
-
-
-
-int revision
Revision, for synchronizing this component with another.
Definition: ECS.h:48
-entt::entity attach_point
Attach point for additional components, as needed.
Definition: ECS.h:52
+
+Information passed to a system when creating or updating a node.
Definition: ECS.h:128
+
+
+
+int revision
Revision, for synchronizing this component with another.
Definition: ECS.h:58
+entt::entity attach_point
Attach point for additional components, as needed.
Definition: ECS.h:62