moai-community/moai-dev — pull request #4 by seebs (2013-09-04 22:55:05+00:00)
Title: Overhaul of Grid/GridDeck2D/Prop interactions

It would be neat if grids had the ability to set color and scale
for each object. But it would also be neat if this weren't really
expensive. So! We create a new DrawRegion function for the grid,
which just calls another function through a function pointer. The
existing implementations of this logic in GridDeck2D and Prop are
combined into a function, with a little generalization. Then four
copies are made, one for each combination of color being present
(yes/no) and scale being present (yes/no), so if you don't add
colors and scales, you don't get a ton of extra processing. ZLColorVec
has an operator* now.

The actual implementation of the color is a bit ugly; we find the
current "ambient" color of the GfxDevice once at the start of the
loop, then for each grid element set the ambient color to the
starting color times that grid element's color, then restore the
original value after the loop.

Signed-off-by: Seebs