papervision test
package {
import flash.display.Sprite;
import flash.events.Event;
import org.papervision3d.view.Viewport3D;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.render.BasicRenderEngine;
[SWF(width="600", height="600", frameRate="24", backgroundColor="#66CCCC")]
public class PV3D extends Sprite
{
private var viewport: Viewport3D;
private var scene: Scene3D;
private var camera: Camera3D;
private var material: ColorMaterial;
private var primitive: Plane;
private var renderer: BasicRenderEngine;
public function PV3D():void
{
viewport = new Viewport3D(500, 400, false, true);
addChild(viewport);
scene = new Scene3D();
camera = new Camera3D();
renderer = new BasicRenderEngine();
material = new ColorMaterial (0x333333);
material.doubleSided = true;
primitive = new Plane(material, 200, 200, 3, 3);
scene.addChild(primitive);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
function onEnterFrame(e:Event):void
{
primitive.rotationY += 2;
renderer.renderScene(scene, camera, viewport);
}
}
}
}