27 #include "generic/containers/contiguous_map.h"
28 #include "generic/property.h"
29 #include "generic/managed.h"
30 #include "renderers/renderer.h"
32 #include "interfaces.h"
41 WRITE_OPERATION_UPDATE,
42 WRITE_OPERATION_REMOVE,
47 WriteOperation operation;
52 #define MAX_STAGED_WRITES 1024
68 write.operation = WRITE_OPERATION_ADD;
70 stage_write(node, write);
73 void update_stage_node(StageNode* node,
const AABB& bounds) {
75 write.operation = WRITE_OPERATION_UPDATE;
76 write.new_bounds = bounds;
78 stage_write(node, write);
81 void remove_stage_node(StageNode* node) {
83 write.operation = WRITE_OPERATION_REMOVE;
85 stage_write(node, write);
90 virtual void lights_and_geometry_visible_from(
92 std::vector<LightID>& lights_out,
93 std::vector<StageNode*>& geom_out
96 virtual MeshID debug_mesh_id() {
return MeshID(); }
98 Stage* get_stage()
const {
return stage_; }
100 virtual void apply_staged_write(
const UniqueIDKey& key,
const StagedWrite& write) = 0;
102 void stage_write(StageNode* node,
const StagedWrite& op);
107 thread::Mutex staging_lock_;
109 std::vector<StageNode*> staged_writes_;
110 std::unordered_map<StageNode*, UniqueIDKey> removed_nodes_;
113 Property<decltype(&Partitioner::stage_)> stage = {
this, &Partitioner::stage_ };
120 DEFINE_ENUM_HASH(smlt::WriteOperation);
123 #endif // PARTITIONER_H