@@ -120,7 +120,7 @@ <h3><a href="#cached-world-transforms" name="cached-world-transforms">Cached wor
120120< p > The obvious answer is to < em > cache</ em > it. In each object, we store its local
121121transform and its derived world transform. When we render, we only use the
122122precalculated world transform. If the object never moves, the cached transform
123- is always up-to- date and everything’s happy.</ p >
123+ is always up to date and everything’s happy.</ p >
124124< p > When an object < em > does</ em > move, the simple approach is to refresh its world
125125transform right then. But don’t forget the hierarchy! When a parent moves, we
126126have to recalculate its world transform < em > and all of its children’s,
@@ -413,7 +413,7 @@ <h3><a href="#an-unoptimized-traversal" name="an-unoptimized-traversal">An unopt
413413walking < em > down</ em > the chain.</ p >
414414< p > We calculate the node’s world transform and store it in < code > world</ code > , then we render
415415the mesh, if we have one. Finally, we recurse into the child nodes, passing in
416- < em > this</ em > node’s world transform. All in all, it’s nice, tight, simple recursive
416+ < em > this</ em > node’s world transform. All in all, it’s a tight, simple recursive
417417method.</ p >
418418< p > To draw an entire scene graph, we kick off the process at the root node:</ p >
419419< div class ="codehilite "> < pre > < span class ="n "> graph_</ span > < span class ="o "> -></ span > < span class ="n "> render</ span > < span class ="p "> (</ span > < span class ="n "> Transform</ span > < span class ="o "> ::</ span > < span class ="n "> origin</ span > < span class ="p "> ());</ span >
@@ -446,7 +446,7 @@ <h3><a href="#let's-get-dirty" name="let's-get-dirty">Let’s get dirty</a><
446446
447447< p > The < code > world_</ code > field caches the previously calculated world transform, and
448448< code > dirty_</ code > , of course, is the dirty flag. Note that the flag starts out < code > true</ code > .
449- When we create a new node, we haven’t calculated it’s world transform yet. At
449+ When we create a new node, we haven’t calculated its world transform yet. At
450450birth, it’s already out of sync with the local transform.</ p >
451451< p > The only reason we need this pattern is because objects can < em > move</ em > , so let’s add
452452support for that:</ p >
@@ -507,7 +507,7 @@ <h3><a href="#let's-get-dirty" name="let's-get-dirty">Let’s get dirty</a><
507507be < code > true</ code > if any node above this node in the parent chain was dirty. In much the
508508same way that < code > parentWorld</ code > updates the world transform incrementally as we
509509traverse down the hierarchy, < code > dirty</ code > tracks the dirtiness of the parent chain.</ p >
510- < p > This lets us avoid having to recursively set each child’s < code > dirty_</ code > flag
510+ < p > This lets us avoid having to recursively mark each child’s < code > dirty_</ code > flag
511511in < code > setTransform()</ code > . Instead, we pass the parent’s dirty flag down to its
512512children when we render and look at that too to see if we need to recalculate
513513the world transform.</ p >
@@ -543,10 +543,10 @@ <h3><a href="#when-is-the-dirty-flag-cleaned" name="when-is-the-dirty-flag-clean
543543</ li >
544544< li >
545545< p > < strong > At well-defined checkpoints:</ strong > </ p >
546- < p > Sometimes, there is a point in time in the progression of the game where it’s
546+ < p > Sometimes, there is a point in time or in the progression of the game where it’s
547547natural to do the deferred processing. For example,
548548we may want to save the game only when the pirate sails into port. Or the
549- sync point may not be part of the game mechanics. We may want to hide the
549+ sync point may not be part of the game mechanics. We may just want to hide the
550550work behind a loading screen or a cut scene.</ p >
551551< ul >
552552< li >
0 commit comments