Menu
Samaritan's Purse

CELLMATERIAL

CellMaterial is a texture.

EXAMPLE

CellMaterial

INSTRUCTIONS

  1. Import import org.papervision3d.materials.shadematerials.CellMaterial;
  2. Declare private var material :CellMaterial;
  3. Initialize material = new CellMaterial(light, color_1, color_2, steps);
    PARAMETER DEFAULT DESCRIPTION
    light NONE light position
    color_1 NONE light color
    color_2 NONE object color
    steps NONE color distribution steps

CODE

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

    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.lights.PointLight3D;
    import org.papervision3d.materials.shadematerials.CellMaterial;
    import org.papervision3d.objects.primitives.Cone;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;

    public class Papervision3DCellMaterial extends Sprite
    {
        private var scene    :Scene3D;
        private var camera :Camera3D;
        private var viewport :Viewport3D;
        private var renderer :BasicRenderEngine;
        private var light    :PointLight3D;
        private var material :CellMaterial;
        private var object :Cone;

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

            camera = new Camera3D();

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

            renderer = new BasicRenderEngine();

            light = new PointLight3D();

            material = new CellMaterial(light, 0xffffff, 0x000000, 8);

            object = new Cone(material, 400, 400);
            scene.addChild(object);

            addEventListener(Event.ENTER_FRAME, handleEnterFrame);
        }

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

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

Download

Papervision3D Official Documentation