Jared Weinstock-TL

Chau Nguyen

Todd Carpenter

Kyle McArdle

Nick Deimler

Tom Bergamini *NEW*
Color Changing Planes
18 April 2009 | by Jared

Color Planes

(click the image above, press spacebar to spin the cube, click the planes)

For each side of the cube I set up a grid class (a DisplayObject3D) that takes 2 different ColorMaterials (one with a .5 alpha, and one solid).  Inside this grid class, I build an array of planes.  When a plane is clicked, it is swapped out with a new solid ColorMaterial plane and the old plane is removed from the display list.  To do this, I send the parameters from the clicked plane to a function (the array index, the x value, the y value, and eventually the color value), and a new plane is built in place with these parameters while exchanging the ColorMaterial.

You might ask, why not just change the alpha of the single plane instead of changing the ColorMaterial?  Well, it’s not so simple.  Each plane of the same color shares a ColorMaterial, and when you change the alpha, it changes the alpha of every plane that is associated with that ColorMaterial.  I tested out many different methods and my “swap” method seems to be the lightest and simplest way to achieve the color change (so far?).

Eventually, each grid class is going to need to access every ColorMaterial, as each side of the cube will include colors from other grids.


No Comments Yet

There are no comments yet. You could be the first!

Leave a Comment

Copyright © 2009 | The Fourmation | All Rights Reserved.