WEB开发网
开发学院图形图像Flash Papervision3D: understanding Plane object 阅读

Papervision3D: understanding Plane object

 2009-10-20 00:00:00 来源:WEB开发网   
核心提示:The Plane is the simplest object you can create with Papervision3D.But “simple” does not mean we don’t have a set of options to custom our pla

The Plane is the simplest object you can create with Papervision3D.

But “simple” does not mean we don’t have a set of options to custom our planes.

Look at this script, that is quite the same as the one published at Papervision3D for the absolute beginners:

package {
 import flash.display.Sprite;
 import flash.events.Event;
 import org.papervision3d.cameras.Camera3D;
 import org.papervision3d.render.BasicRenderEngine;
 import org.papervision3d.scenes.Scene3D;
 import org.papervision3d.view.Viewport3D;
 import org.papervision3d.objects.primitives.Plane;
 public class papervision extends Sprite {
  public var viewport:Viewport3D = new Viewport3D();
  public var scene:Scene3D = new Scene3D();
  public var camera:Camera3D = new Camera3D();
  public var renderer:BasicRenderEngine = new BasicRenderEngine();
  public var plane:Plane = new Plane();
  public function papervision() {
   addChild(viewport);
   scene.addChild(plane);
   addEventListener(Event.ENTER_FRAME, render);
  }
  public function render(e:Event) {
   plane.pitch(1);
   renderer.renderScene(scene, camera, viewport);
  }
 }
}

The only changes are I added an ENTER_FRAME listener to render the scene at every frame because renderScene renders the scene only once, and I added a pitch method to the plane to make it rotate along its x axis by 1 degree at every frame.

1 2 3  下一页

Tags:PapervisionD understanding Plane

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接