Skip to content

Terrain brush fixups#129

Open
BogdanW3 wants to merge 6 commits intostijnherfst:mainfrom
BogdanW3:terrain_brush_misc
Open

Terrain brush fixups#129
BogdanW3 wants to merge 6 commits intostijnherfst:mainfrom
BogdanW3:terrain_brush_misc

Conversation

@BogdanW3
Copy link
Copy Markdown
Contributor

  • Use DP to optimize the apply call's updated area
  • Fix the 3x3 kernel for cliff_near
  • Unflip the brush's display

@stijnherfst
Copy link
Copy Markdown
Owner

Rewriting it to use a stack based approach is really good. I would maybe make some suggestions on the design.

Instead of taking a std::vector<glm::ivec2>& seeds the function would be more general if it purely used the QRect area as input for what area to check.

std::vector<uint8_t> visited(static_cast<size_t>(corner_width * corner_height), 0);

Is a bit pessimitic in allocating for the full map while most operations will likely never even trigger any cliff changes. A hashmap (hive::unordered_map is quite optimized too) will likely be better in most cases with only the worst case (whole map change) being a bit worse.

visit_index is named like an action but it's more like get_linear_index

Nice catch on the bugs :)

@BogdanW3
Copy link
Copy Markdown
Contributor Author

Thanks for the reply! Indeed it sounds like I can just use the area as an input as well, especially with the suggested change to a hashmap, but sadly my attempts to do that haven't been successful thus far.
Even without that, it seems there is a bug with the clamping logic where I am sometimes somehow able to make a specific cliff glitch out, I've had more luck doing it by first adding +4 to the base terrain then doing -4 in a small section and then dragging it around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants