2009年 07月 28日
package
{
import away3d.cameras.Camera3D;
import away3d.containers.Scene3D;
import away3d.containers.View3D;
import away3d.materials.ColorMaterial;
import away3d.materials.WireColorMaterial;
import away3d.primitives.AbstractPrimitive;
import away3d.primitives.Cube;
import flash.display.Sprite;
import flash.events.Event;
[SWF(backgroundColor="#000000", frameRate="60", quality="LOW", width="600", height="400")]
public class Away3D_Logo extends Sprite
{
//エンジン用 メンバ変数
private var _scene:Scene3D;
private var _camera:Camera3D;
private var _view:View3D;
private var _object3D:AbstractPrimitive;
/**----------------------------------------------------
* Away3D_Logo
----------------------------------------------------*/
public function Away3D_Logo()
{
super();
this._init();
}
/**----------------------------------------------------
* _init
----------------------------------------------------*/
private function _init():void
{
this._scene = new Scene3D();
this._camera = new Camera3D({zoom:1, focus:100, x:0, y:0, z:-1000});
this._view = new View3D({scene:this._scene, camera:this._camera});
//this._view.x = 400;
//this._view.y = 300;
this.addChild( this._view );
var material:WireColorMaterial = new WireColorMaterial( 0xcc0000 );
this._object3D = new Cube({material:material, width:500, height:500, depth:500 , yUp:false});
this._object3D.bothsides = true;
this._scene.addChild( this._object3D );
//イベントを作成
this.addEventListener( Event.ENTER_FRAME, this._enterframe_Event );
this.addEventListener( Event.RESIZE, this._resize_Event );
//リサイズイベントを実行
this._resize_Event(null);
}
/**----------------------------------------------------
* _enterframe_Event
----------------------------------------------------*/
private function _enterframe_Event( evn:Event ):void
{
this._object3D.rotationX += 1.5;
this._object3D.rotationY += 2.0;
this._view.render();
}
/**----------------------------------------------------
* _resize_Event
----------------------------------------------------*/
private function _resize_Event(evn:Event):void
{
this._view.x = stage.stageWidth / 2;
this._view.y = stage.stageHeight / 2;
}
}
}
投稿者: d5 16 : 07
更新日:2009-07-28 16:57:26
|
|
|
| |