Plane(apply ColorMaterial)

by flabaka
PlaneにColorMaterialを貼り付けてみた。

MaterialをPlaneの裏面にも適用させるには、bothsides = true;にしてあげる。
♥0 | Line 24 | Modified 2010-12-16 09:25:47 | MIT License
play

ActionScript3 source code

/**
 * Copyright flabaka ( http://wonderfl.net/user/flabaka )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/kM2m
 */

package {
    
    import away3dlite.materials.ColorMaterial;
    import away3dlite.primitives.Plane;
    import away3dlite.templates.BasicTemplate;
    
    [SWF (width="465",height="465",backgroundColor="0xffffff",frameRate="30")]
    
    /**
    * ...
    * @author flabaka
    */
    
    public class PlaneSample extends BasicTemplate 
    {
        private var plane:Plane;
        private var mat:ColorMaterial;
        
        override protected function onInit():void
        {
            mat = new ColorMaterial();
            plane = new Plane(mat);
            
            //Materialを裏面にも適用する
            plane.bothsides = true;
            plane.rotationX = 90;
            scene.addChild(plane);
            
            debug = false;
        }
        
        override protected function onPreRender():void
        {
            plane.rotationY += 3;
        }
     }      
        
}