HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

Bloat

Bloat is a modifier that displaces object vertices outside a specified sphere.

Example

Bloat

Instructions

  1. Import stack, modifier, 3D render engine library
    import com.as3dmod.ModifierStack;
    import com.as3dmod.modifiers.Bloat;
    import com.as3dmod.plugins.pv3d.LibraryPv3d;
  2. Initialize modifier
    var modifier :Bloat = new Bloat();
  3. Set modifier radius
    modifier.radius = number;
  4. Declare stack
    private var stack :ModifierStack;
  5. Initialize stack
    stack = new ModifierStack(lib3d, mesh);
    ParameterDefaultDescription
    lib3dNONE3D engine library
    meshNONE3D object
  6. Add modifier to stack
    stack.addModifier(modifier);
  7. Apply
    stack.apply();

Code

package
{
    import com.as3dmod.ModifierStack;
    import com.as3dmod.modifiers.Bloat;
    import com.as3dmod.plugins.pv3d.LibraryPv3d;

    import flash.events.Event;

    import org.papervision3d.materials.WireframeMaterial;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.view.BasicView;

    public class AS3DmodBloat extends BasicView
    {
        private var object :Plane;
        private var stack  :ModifierStack;

        public function AS3DmodBloat()
        {
            super();

            var material :WireframeMaterial = new WireframeMaterial(0x000000);
            material.doubleSided = true;

            object = new Plane(material, 500, 500, 10, 10);
            scene.addChild(object);

            var modifier :Bloat = new Bloat();
            modifier.radius = 500;

            stack = new ModifierStack(new LibraryPv3d(), object);
            stack.addModifier(modifier);
            stack.apply();

            startRendering();
        }

        protected override function onRenderTick(e:Event=null):void
        {
            object.yaw(1);

            super.onRenderTick(e);
        }
    }
}

Download