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 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.
Tags:PapervisionD understanding Plane
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接