Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Jeff Pierce's reaction to this
The short answer to the first questions is that the code is already in
there; a hidden object is never rendered. Here's the code in renderOn:
"Draw our mesh if the object is not hidden"
(isHidden) ifFalse: [ self drawMesh: aRenderer ].
The short answer to the second question is that there is a side effect from
the change the students made. When a Wonderland walks the scene graph to
render the scene, it does two things at each Actor: it draws the actor, and
it builds up a composite transformation matrix. The current code prevents
the former if the actor is hidden, but permits the latter. This means that
if a child of the Actor is not hidden it will still be drawn with the
correct position and orientation. With the change the students made, not
only will the composite transformation matrix not be built correctly, but
the Wonderland won't even try to draw the Actor's children. That's not a
problem if hidden Actors never have visible children in their worlds, but
in general it'll cause problems.
If they really wanted to optimize the code, they'd have to be able to
guarantee that none of the Actor's children were visible before aborting
the rest of the renderOn: method.
Link to this Page