Home Menu

2

Add an object to the scene.

Example

2

Instructions

  1. 1
  2. Import object class
    import org.papervision3d.objects.primitives.Plane;
  3. Declare object
    private var object :Plane;
  4. Initialize object
    object = new Plane();
  5. Add object to scene
    scene.addChild(object);
  6. Set viewport size to stage size
    viewport.autoScaleToStage = true;

Code

package
{
    import flash.display.Sprite;

    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;

    public class Papervision3D2 extends Sprite
    {
        private var scene    :Scene3D;
        private var camera   :Camera3D;
        private var viewport :Viewport3D;
        private var renderer :BasicRenderEngine;
        private var object   :Plane;

        public function Papervision3D2()
        {
            scene = new Scene3D();

            camera = new Camera3D();

            viewport                  = new Viewport3D();
            viewport.autoScaleToStage = true;
            addChild(viewport);

            renderer = new BasicRenderEngine();

            object = new Plane();
            scene.addChild(object);

            renderer.renderScene(scene, camera, viewport);
        }
    }
}

Download

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms