Started work on cache for canvas components
This commit is contained in:
parent
c7842c2924
commit
1095b91cec
15 changed files with 261 additions and 74 deletions
|
|
@ -95,7 +95,7 @@ void DrawComponent::check_timers(DrawingProgram& drawP) {
|
|||
if(transformDur > CLIENT_DRAWCOMP_DELAY_TIMER_DURATION) {
|
||||
coords = *delayedCoordinateSpace;
|
||||
delayedCoordinateSpace = nullptr;
|
||||
finalize_update(drawP.colliderAllocated);
|
||||
finalize_update(drawP);
|
||||
}
|
||||
}
|
||||
if(delayedUpdatePtr) {
|
||||
|
|
@ -109,13 +109,21 @@ void DrawComponent::check_timers(DrawingProgram& drawP) {
|
|||
}
|
||||
|
||||
void DrawComponent::temp_update(DrawingProgram& drawP) {
|
||||
drawP.compCache.preupdate_component(this);
|
||||
worldAABB = std::nullopt;
|
||||
initialize_draw_data(drawP);
|
||||
updateDraw = true;
|
||||
}
|
||||
|
||||
void DrawComponent::transform_temp_update(DrawingProgram& drawP) {
|
||||
drawP.compCache.preupdate_component(this);
|
||||
worldAABB = std::nullopt;
|
||||
updateDraw = true;
|
||||
}
|
||||
|
||||
void DrawComponent::final_update(DrawingProgram& drawP) {
|
||||
initialize_draw_data(drawP);
|
||||
finalize_update(drawP.colliderAllocated);
|
||||
finalize_update(drawP);
|
||||
updateDraw = true;
|
||||
}
|
||||
|
||||
|
|
@ -143,8 +151,9 @@ void DrawComponent::client_send_transform_final(DrawingProgram& drawP, ServerCli
|
|||
drawP.world.con.client_send_items_to_server(RELIABLE_COMMAND_CHANNEL, SERVER_TRANSFORM_COMPONENT, false, id, this->coords);
|
||||
}
|
||||
|
||||
void DrawComponent::finalize_update(bool colliderAllocated) {
|
||||
create_collider(colliderAllocated);
|
||||
void DrawComponent::finalize_update(DrawingProgram& drawP) {
|
||||
drawP.compCache.preupdate_component(this);
|
||||
create_collider(drawP.colliderAllocated);
|
||||
updateDraw = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class DrawComponent {
|
|||
|
||||
#ifndef IS_SERVER
|
||||
bool selected = false;
|
||||
|
||||
bool updateDraw = true;
|
||||
|
||||
bool globalCollisionCheck = false;
|
||||
|
|
@ -99,8 +100,9 @@ class DrawComponent {
|
|||
virtual void draw(SkCanvas* canvas, const DrawData& drawData) = 0;
|
||||
void temp_update(DrawingProgram& drawP);
|
||||
void final_update(DrawingProgram& drawP);
|
||||
void transform_temp_update(DrawingProgram& drawP);
|
||||
virtual void initialize_draw_data(DrawingProgram& drawP) = 0;
|
||||
virtual void finalize_update(bool colliderAllocated);
|
||||
virtual void finalize_update(DrawingProgram& drawP);
|
||||
virtual void update(DrawingProgram& drawP) = 0;
|
||||
virtual bool collides_within_coords(const SCollision::ColliderCollection<float>& checkAgainst, bool colliderAllocated) = 0;
|
||||
bool collides_with_world_coords(const CoordSpaceHelper& camCoords, const SCollision::ColliderCollection<WorldScalar>& checkAgainstWorld, bool colliderAllocated);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void DrawImage::update(DrawingProgram& drawP) {
|
|||
std::shared_ptr<ResourceDisplay> display = drawP.world.drawData.rMan->get_display_data(d.imageID);
|
||||
if(display) {
|
||||
if(display->update_draw())// && bounds_draw_check(drawP.world.drawData, collisionTree))
|
||||
updateDraw = true;
|
||||
temp_update(drawP);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,9 +93,9 @@ void DrawTextBox::set_textbox_string(const std::string& str) {
|
|||
textboxUpdate = false;
|
||||
}
|
||||
|
||||
void DrawTextBox::update_contained_string() {
|
||||
void DrawTextBox::update_contained_string(DrawingProgram& drawP) {
|
||||
d.currentText = textBox.get_string();
|
||||
updateDraw = true;
|
||||
temp_update(drawP);
|
||||
}
|
||||
|
||||
Vector2f DrawTextBox::get_mouse_pos(DrawingProgram& drawP) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class DrawTextBox : public DrawComponent {
|
|||
virtual void create_collider(bool colliderAllocated) override;
|
||||
virtual void update_from_delayed_ptr() override;
|
||||
void init_text_box(DrawingProgram& drawP);
|
||||
void update_contained_string();
|
||||
void update_contained_string(DrawingProgram& drawP);
|
||||
void set_textbox_string(const std::string& str);
|
||||
Vector2f get_mouse_pos(DrawingProgram& drawP);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue