Using dirty flags to reduce unnecessary processing
Dirty flag involves updating values only when they are needed. The best explanation of how it works comes in the context of base-level engine development and the transform hierarchy. When you set a local location on a transform, you are indicating that you want to be x, y, and z units away from the parent’s location. This is easy enough to update, but in doing this, we are also changing the transform’s world space location. It is easy to calculate the matrix that will deal with this local-to-world space conversion, then multiply our vector by it; that process doesn’t even cost many resources. Then, we must remember that this is a hierarchy. What if we were moving the root of a tree that is hundreds of transforms deep? Not a great position to be in for multiple reasons, but if the parent of a transform moves, then the child moves with it, and so on, recursively. This presents a lot of world space value transforms...