PV3D
源代码:
Code
package
{
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.cameras.FreeCamera3D;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.objects.primitives.Sphere;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
[SWF(width="700", height="400",backgroundColor='0x000000', frameRate="30")]
public class TestPV extends Sprite
{
private var _viewPort:Viewport3D=new Viewport3D(600,500);
private var _scene:Scene3D=new Scene3D();
private var _camera:FreeCamera3D=new FreeCamera3D();
private var _render:BasicRenderEngine=new BasicRenderEngine();
private var _sphere:Sphere=new Sphere(new BitmapFileMaterial('2.png'),400,16,16);
public function TestPV()
{
this.addChild(this._viewPort);
//_render.renderScene(this._scene,this._camera,this._viewPort);
this._scene.addChild(this._sphere);
this.addEventListener(Event.ENTER_FRAME,process);
}
private function process(event:Event):void {
this._sphere.rotationY+=1;
this._sphere.z+=5;
//this._sphere.rotationZ+=1;
_render.renderScene(this._scene,this._camera,this._viewPort);
}
}
}