Remove colliderAllocated flag
This commit is contained in:
parent
0a75b0ada3
commit
eb9db31d31
18 changed files with 44 additions and 117 deletions
|
|
@ -173,18 +173,6 @@ void DrawingProgram::check_updateable_components() {
|
|||
comp->update(*this);
|
||||
}
|
||||
|
||||
void DrawingProgram::free_collider_memory() {
|
||||
for(auto& c : components.client_list())
|
||||
c->obj->free_collider();
|
||||
colliderAllocated = false;
|
||||
}
|
||||
|
||||
void DrawingProgram::allocate_collider_memory() {
|
||||
for(auto& c : components.client_list())
|
||||
c->obj->allocate_collider();
|
||||
colliderAllocated = true;
|
||||
}
|
||||
|
||||
void DrawingProgram::parallel_loop_all_components(std::function<void(const std::shared_ptr<CollabList<std::shared_ptr<DrawComponent>, ServerClientID>::ObjectInfo>&)> func) {
|
||||
parallel_loop_container(components.client_list(), func);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ class DrawingProgram {
|
|||
void write_to_file(cereal::PortableBinaryOutputArchive& a);
|
||||
World& world;
|
||||
|
||||
void free_collider_memory();
|
||||
void allocate_collider_memory();
|
||||
|
||||
bool prevent_undo_or_redo();
|
||||
|
||||
void add_file_to_canvas_by_path(const std::string& filePath, Vector2f dropPos, bool addInSameThread);
|
||||
|
|
@ -50,8 +47,6 @@ class DrawingProgram {
|
|||
|
||||
void parallel_loop_all_components(std::function<void(const std::shared_ptr<CollabList<std::shared_ptr<DrawComponent>, ServerClientID>::ObjectInfo>&)> func);
|
||||
|
||||
bool colliderAllocated = false;
|
||||
|
||||
DrawingProgramCache compCache;
|
||||
|
||||
CollabListType components;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ void DrawingProgramSelection::add_from_cam_coord_collider_to_selection(const SCo
|
|||
return true;
|
||||
}
|
||||
std::erase_if(comps, [&](auto& c) {
|
||||
if(c->obj->collides_with(drawP.world.drawData.cam.c, cCWorld, cC, drawP.colliderAllocated)) {
|
||||
if(c->obj->collides_with(drawP.world.drawData.cam.c, cCWorld, cC)) {
|
||||
selectedComponents.emplace(c);
|
||||
drawP.compCache.invalidate_cache_at_aabb_before_pos(c->obj->worldAABB.value(), c->obj->collabListInfo.lock()->pos);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void EditTool::tool_update() {
|
|||
|
||||
drawP.compCache.traverse_bvh_run_function(mouseAABB, [&](const std::shared_ptr<DrawingProgramCacheBVHNode>& bvhNode, const std::vector<CollabListType::ObjectInfoPtr>& components) {
|
||||
for(auto& c : components) {
|
||||
if(c->pos > lastPos && c->obj->collides_with_world_coords(drawP.world.drawData.cam.c, cMouseAABB, drawP.colliderAllocated)) {
|
||||
if(c->pos > lastPos && c->obj->collides_with_world_coords(drawP.world.drawData.cam.c, cMouseAABB)) {
|
||||
lastSelectedObj = c;
|
||||
lastPos = c->pos;
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ void EditTool::tool_update() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(!isMovingPoint && !a->collides_with_cam_coords(drawP.world.drawData.cam.c, cMouseCircle, drawP.colliderAllocated))
|
||||
if(!isMovingPoint && !a->collides_with_cam_coords(drawP.world.drawData.cam.c, cMouseCircle))
|
||||
clickedAway = true;
|
||||
}
|
||||
else if(controls.pointDragging) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ void EraserTool::tool_update() {
|
|||
return true;
|
||||
}
|
||||
std::erase_if(comps, [&](auto& c) {
|
||||
if(c->obj->collides_with(drawP.world.drawData.cam.c, cCWorld, cC, drawP.colliderAllocated)) {
|
||||
if(c->obj->collides_with(drawP.world.drawData.cam.c, cCWorld, cC)) {
|
||||
erasedComponents.emplace(c);
|
||||
drawP.compCache.invalidate_cache_at_aabb_before_pos(c->obj->worldAABB.value(), c->obj->collabListInfo.lock()->pos);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ bool TextBoxTool::edit_update(const std::shared_ptr<DrawTextBox>& a) {
|
|||
mousePointCollection.recalculate_bounds();
|
||||
|
||||
a->textBox.setWidth(std::abs(a->d.p2.x() - a->d.p1.x()));
|
||||
a->create_collider(drawP.colliderAllocated);
|
||||
a->create_collider();
|
||||
|
||||
InputManager& input = drawP.world.main.input;
|
||||
auto& textbox = a->textBox;
|
||||
|
|
@ -103,7 +103,7 @@ bool TextBoxTool::edit_update(const std::shared_ptr<DrawTextBox>& a) {
|
|||
bool movedHeld = false;
|
||||
|
||||
bool collidesWithBox = false;
|
||||
if(a->collides_with_cam_coords(drawP.world.drawData.cam.c, mousePointCollection, drawP.colliderAllocated)) {
|
||||
if(a->collides_with_cam_coords(drawP.world.drawData.cam.c, mousePointCollection)) {
|
||||
//drawP.world.main.input.cursorIcon = InputManager::SystemCursorType::TEXT;
|
||||
collidesWithBox = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue