PV3DGeometry
/**
* Copyright milkmidi ( http://wonderfl.net/user/milkmidi )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/nqK3
*/
package {
import flash.events.Event;
import org.papervision3d.core.geom.renderables.Triangle3D;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.view.BasicView;
public class PV3DGeometry extends BasicView{
private var _sphere :Sphere;
public function PV3DGeometry() {
super(0,0,true,true);
startRendering();
init3DObject();
}
private function init3DObject():void {
_sphere = new Sphere( null , 300, 16, 16);
scene.addChild(_sphere);
for each( var triangle:Triangle3D in _sphere.geometry.faces ) {
triangle.material = new ColorMaterial(0xffffff * Math.random());
}
}
override protected function onRenderTick(event:Event = null):void {
super.onRenderTick(event);
_sphere.localRotationY++;
}
}
}