1
Start with a scene, camera, viewport, and renderer.
Scene is the container.
Camera is the point of view.
Viewport is the area to render.
Renderer renders the data.
Note: Nothing is rendered in this step.
Example
Instructions
- Import scene, camera, viewport, and renderer classes
import org.papervision3d.cameras.Camera3D; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D;
- Declare scene, camera, viewport, and renderer
private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine;
- Initialize scene
scene = new Scene3D();
- Initialize camera
camera = new Camera3D();
- Initialize and add viewport
viewport = new Viewport3D(); addChild(viewport);
- Initialize renderer
renderer = new BasicRenderEngine();
- Render - nothing is rendered in this step
renderer.renderScene(scene, camera, viewport);
Code
package { import flash.display.Sprite; import org.papervision3d.cameras.Camera3D; import org.papervision3d.render.BasicRenderEngine; import org.papervision3d.scenes.Scene3D; import org.papervision3d.view.Viewport3D; public class Papervision3D1 extends Sprite { private var scene :Scene3D; private var camera :Camera3D; private var viewport :Viewport3D; private var renderer :BasicRenderEngine; public function Papervision3D1() { scene = new Scene3D(); camera = new Camera3D(); viewport = new Viewport3D(); addChild(viewport); renderer = new BasicRenderEngine(); renderer.renderScene(scene, camera, viewport); } } }