Update all positions, publish the snapshot, fire all registered objects.
For each object with a position, calls m_index->update() then m_index->publish(). Then fires each object's function with a context built from the new snapshot.
Definition at line 182 of file Fabric.cpp.
183{
185 std::visit([&](
const auto&
ptr) {
186 if (!
ptr->m_position.has_value()) {
187 return;
188 }
189 if (reg.spatial_id.has_value()) {
190 m_index->update(*reg.spatial_id, *ptr->m_position);
191 } else {
192 reg.spatial_id = m_index->insert(*ptr->m_position);
193 }
194 },
195 reg.member);
196 }
197
199
201 std::unordered_map<uint32_t, uint32_t> entity_of;
204 if (reg.spatial_id.has_value()) {
205 entity_of.emplace(*reg.spatial_id, id);
206 }
207 }
208
209 auto snapshot =
m_index->all();
210 for (
auto& [spatial_id,
position] : snapshot) {
211 if (const auto it = entity_of.find(spatial_id); it != entity_of.end()) {
212 spatial_id = it->second;
213 }
214 }
215
218 }
219
221 if (reg.commit_driven) {
223 }
224 }
225}
std::optional< glm::vec3 > position
std::unordered_map< uint32_t, std::shared_ptr< Expanse > > m_expanses
std::unique_ptr< Kinesis::SpatialIndex3D > m_index
void fire(uint32_t id)
Fire a single object against the current snapshot without republishing.
std::unordered_map< uint32_t, Registration > m_registrations
References fire(), m_expanses, m_fabric_id, m_index, m_registrations, position, and ptr.