Menu
Riverview Church

COMPOSITEMATERIAL

CompositeMaterial is a combination of other materials.

EXAMPLE

CompositeMaterial

INSTRUCTIONS

  1. Import import org.papervision3d.materials.special.CompositeMaterial;
  2. Declare private var material :CompositeMaterial;
  3. Initialize material = new CompositeMaterial();
  4. Add material.addMaterial(new material);

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.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;

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

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

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

            camera = new Camera3D();

            renderer = new BasicRenderEngine();

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

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

            addEventListener(Event.ENTER_FRAME, handleEnterFrame);
        }

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

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

Download

Papervision3D Official Documentation