Menu
Samaritan's Purse

QUADRANTRENDERENGINE

QuadrantRenderEngine renders the data.

It renders one, or many, scenes, cameras, and viewports. It also sorts triangles and splits intersecting triangles.

EXAMPLE

QuadrantRenderEngine

INSTRUCTIONS

  1. Import import org.papervision3d.render.QuadrantRenderEngine;
  2. Declare private var renderer :QuadrantRenderEngine;
  3. Initialize renderer = new QuadrantRenderEngine(type);
    PARAMETER DEFAULT DESCRIPTION
    type 3 1 | 2 | 3
    1 - sort triangles
    2 - split intersecting triangles
    3 - sort triangles and split intersecting triangles
  4. Render renderer.renderScene(scene, camera, viewport);

CODE

´╗┐package
{
    import flash.display.Sprite;
    import flash.events.Event;

    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.materials.ColorMaterial;
    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.materials.special.CompositeMaterial;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.render.QuadrantRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;

    public class Papervision3DQuadrantRenderEngine extends Sprite
    {
        private var scene     :Scene3D;
        private var camera    :Camera3D;
        private var viewport :Viewport3D;
        private var renderer :QuadrantRenderEngine;
        private var material :CompositeMaterial;
        private var material2 :CompositeMaterial;
        private var object    :Plane;
        private var object2 :Plane;

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

            camera = new Camera3D();

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

            renderer = new QuadrantRenderEngine();

            material             = new CompositeMaterial();
            material.doubleSided = true;
            material.addMaterial(new ColorMaterial(0x000000, 0.5));
            material.addMaterial(new WireframeMaterial(0x000000));

            material2             = new CompositeMaterial();
            material2.doubleSided = true;
            material2.addMaterial(new ColorMaterial(0xff0000, 0.5));
            material2.addMaterial(new WireframeMaterial(0xff0000));

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

            object2 = new Plane(material2);
            scene.addChild(object2);

            addEventListener(Event.ENTER_FRAME, handleEnterFrame);
        }

        private function handleEnterFrame(e:Event):void
        {
            object.yaw(1);
            object2.pitch(1);

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

Download

Papervision3D Official Documentation