2 Comments
User's avatar
⭠ Return to thread
Speykious's avatar

I was following this article, up until the "Immediate Mode Build, + Cache" section. I feel like there are a few things that I'm missing to be able to understand.

To start off, why would a purely immediate-mode UI_Widget data structure that is rebuilt every frame need to encode a binary tree instead of an array list? Is it so that we can put all UI_Widget instances into a single allocation without having to worry about dynamic sizing? We just... don't need random access to a specific child, since we're rendering every frame? But what about scroll views then, surely we won't want to iterate over thousands of list elements before getting to the place where it actually draws what's on the screen...

Then finally, I think I just got completely lost on the part where we introduce hashing. Why do we have hash_next and hash_prev that are pointers to other UI_Widgets instead of being... hashes? Forgive me for stupid questions because it's the first time I see something like this, I'm very confused.

Edit: turns out UI_Widgets is being used as a node of a doubly linked list that is part of the hashmap, one that's being made from scratch. I'm too used to generic hashmaps in other languages lol

Expand full comment
Jakob Garde's avatar

Damn, that hash_next, hash_prev stuff had me too - thx for that edit there. Conclusion: its just a hash-map, implemented the way u want.

Expand full comment