FlexでPaperVision3DのBasicViewを使う
http://moeten.info/flex/20090917_titleShop/bin-release/main.html
FlexでPaperVision3DのBasicViewを使う方法。
こんな感じで書けばとりあえず動きます。
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:view="org.papervision3d.view.*" creationComplete="init();" width="622" height="504" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #DEDEDE]"> <mx:Script> <![CDATA[ import org.papervision3d.materials.BitmapFileMaterial; import org.papervision3d.objects.primitives.Sphere; private var ball:Sphere; //初期化関数 private function init():void{ //BasicViewをステージに追加 myUI.addChild( bv ); //オブジェクトの作成 ball = new Sphere( null , 500 , 10 , 10 ); bv.scene.addChild( ball ); //レンダリング。bv.startRendering();を自前で。 this.addEventListener(Event.ENTER_FRAME , onTimer ); } //レンダリング private function onTimer( e:Event ):void{ bv.renderer.renderScene( bv.scene , bv.camera , bv.viewport ); ball.rotationY += 1; } ]]> </mx:Script> <view:BasicView id="bv"/> <mx:UIComponent id="myUI" width="300" height="300"/> </mx:Application>
BasicViewってカメラとかシーンとかを自動で作ってくれるのでラクチンだね。
カメラとかシーンとかわかんない!って方に便利かも。