ActionScript3.0/Alternativa3D_7
Alternativa7_GeoSphere();
Zeronine
2011. 10. 12. 16:40
package
{
import alternativa.engine3d.core.Camera3D;
import alternativa.engine3d.core.Object3DContainer;
import alternativa.engine3d.core.View;
import alternativa.engine3d.materials.FillMaterial;
import alternativa.engine3d.primitives.GeoSphere;
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
private var _container:Object3DContainer;
private var _geoSphere:GeoSphere;
private var _material:FillMaterial;
private var _camera:Camera3D;
private var _view:View;
public function Main():void
{
_container = new Object3DContainer();
_material = new FillMaterial(0x000000, 1, 1, 0xffffff);
_geoSphere = new GeoSphere(100, 8);
_geoSphere.setMaterialToAllFaces(_material);
_container.addChild(_geoSphere);
_camera = new Camera3D();
_camera.z = -300;
_container.addChild(_camera);
_view = new View(stage.stageWidth, stage.stageHeight);
_camera.view = _view;
this.addChild(_view);
addEventListener(Event.ENTER_FRAME, onEnter);
}
private function onEnter(e:Event):void
{
_camera.render();
_geoSphere.rotationX += 0.01;
_geoSphere.rotationY += 0.01;
}
}
}