Fire and Smoke

This project uses two emitters, one to create the fire and the other to create the smoke. The smoke is created from a number of circular particles at very low alpha which overlap to create the random smoke distribution. The fire is created from elliptical particles that are orientated so their pointy end points in the direction they’re traveling.

package
{
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.renderers.BitmapRenderer;
  import org.flintparticles.threeD.renderers.controllers.OrbitCamera;

  import flash.display.Sprite;
  import flash.geom.Rectangle;
  import flash.geom.Vector3D;

  [SWF(width='400', height='400', frameRate='60', backgroundColor='#000000')]
  
  public class Main extends Sprite
  {
    private var smoke:Emitter3D;
    private var fire:Emitter3D;
    private var orbitter:OrbitCamera;
    
    public function Main()
    {
      smoke = new Smoke();      
      smoke.start( );
      
      fire = new Fire();
      fire.start( );
      
      var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( -200, -200, 400, 400 ) );
      renderer.x = 200;
      renderer.y = 200;
      renderer.addEmitter( smoke );
      renderer.addEmitter( fire );
      addChild( renderer );
      
      renderer.camera.position = new Vector3D( 0, -150, -400 );
      renderer.camera.target = new Vector3D( 0, -150, 0 );
      renderer.camera.projectionDistance = 400;
      orbitter = new OrbitCamera( stage, renderer.camera );
      orbitter.start();
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.ColorChange;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.common.initializers.SharedImage;
  import org.flintparticles.threeD.actions.Accelerate;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RotateToDirection;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Position;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.DiscZone;

  import flash.geom.Vector3D;

  public class Fire extends Emitter3D
  {
    public function Fire()
    {
      counter = new Steady( 60 );

      addInitializer( new Lifetime( 2, 3 ) );
      addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 20 ) ) );
      addInitializer( new Position( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 3 ) ) );
      addInitializer( new SharedImage( new FireBlob() ) );

      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 1 ) );
      addAction( new Accelerate( new Vector3D( 0, -40, 0 ) ) );
      addAction( new ColorChange( 0xFFFFCC00, 0x00CC0000 ) );
      addAction( new ScaleImage( 1, 1.5 ) );
      addAction( new RotateToDirection() );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.displayObjects.RadialDot;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.common.initializers.SharedImage;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RandomDrift;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.ConeZone;

  import flash.geom.Vector3D;

  public class Smoke extends Emitter3D
  {
    public function Smoke()
    {
      counter = new Steady( 10 );
      
      addInitializer( new Lifetime( 11, 12 ) );
      addInitializer( new Velocity( new ConeZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, -1, 0 ), 0.5, 40, 30 ) ) );
      addInitializer( new SharedImage( new RadialDot( 6 ) ) );
      
      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 0.01 ) );
      addAction( new ScaleImage( 1, 15 ) );
      addAction( new Fade( 0.15, 0 ) );
      addAction( new RandomDrift( 15, 15, 15 ) );
    }
  }
}
import org.flintparticles.common.actions.*;
import org.flintparticles.common.counters.*;
import org.flintparticles.common.displayObjects.RadialDot;
import org.flintparticles.common.initializers.*;
import org.flintparticles.threeD.actions.*;
import org.flintparticles.threeD.emitters.Emitter3D;
import org.flintparticles.threeD.initializers.*;
import org.flintparticles.threeD.renderers.BitmapRenderer;
import org.flintparticles.threeD.renderers.controllers.OrbitCamera;
import org.flintparticles.threeD.zones.*;

var smoke:Emitter3D = new Emitter3D();
smoke.counter = new Steady( 10 );
  
smoke.addInitializer( new Lifetime( 11, 12 ) );
smoke.addInitializer( new Velocity( new ConeZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, -1, 0 ), 0.5, 40, 30 ) ) );
smoke.addInitializer( new SharedImage( new RadialDot( 6 ) ) );
  
smoke.addAction( new Age( ) );
smoke.addAction( new Move( ) );
smoke.addAction( new LinearDrag( 0.01 ) );
smoke.addAction( new ScaleImage( 1, 15 ) );
smoke.addAction( new Fade( 0.15, 0 ) );
smoke.addAction( new RandomDrift( 15, 15, 15 ) );

smoke.start( );

var fire:Emitter3D = new Emitter3D();
fire.counter = new Steady( 60 );

fire.addInitializer( new Lifetime( 2, 3 ) );
fire.addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 20 ) ) );
fire.addInitializer( new Position( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 3 ) ) );
fire.addInitializer( new SharedImage( new FireBlob() ) );

fire.addAction( new Age( ) );
fire.addAction( new Move( ) );
fire.addAction( new LinearDrag( 1 ) );
fire.addAction( new Accelerate( new Vector3D( 0, -40, 0 ) ) );
fire.addAction( new ColorChange( 0xFFFFCC00, 0x00CC0000 ) );
fire.addAction( new ScaleImage( 1, 1.5 ) );
fire.addAction( new RotateToDirection() );

fire.start( );

var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( -200, -200, 400, 400 ) );
renderer.x = 200;
renderer.y = 200;
renderer.addEmitter( smoke );
renderer.addEmitter( fire );
addChild( renderer );

renderer.camera.position = new Vector3D( 0, -150, -400 );
renderer.camera.target = new Vector3D( 0, -150, 0 );
renderer.camera.projectionDistance = 400;
var orbitter:OrbitCamera = new OrbitCamera( stage, renderer.camera );
orbitter.start();
<?xml version="1.0" encoding="utf-8"?>
<s:Application
  xmlns:fx="http://ns.adobe.com/mxml/2009" 
  xmlns:s="library://ns.adobe.com/flex/spark"
  xmlns:f="http://flintparticles.org/2009/flint3d"
  xmlns:geom="flash.geom.*"
  xmlns:filters="flash.filters.*"
  width="400" height="400"
  backgroundColor="#000000">

<f:BitmapRenderer id="renderer" width="400" height="400">
  <f:camera>
    <f:Camera projectionDistance="400">
      <f:position>
        <geom:Vector3D x="0" y="-150" z="-400"/>
      </f:position>
      <f:target>
        <geom:Vector3D x="0" y="-150" z="0"/>
      </f:target>
      <f:controller>
        <f:OrbitCamera/>
      </f:controller>
    </f:Camera>
  </f:camera>
  <f:emitters>
    <f:Emitter id="smoke" autoStart="true">
      <f:counter>
        <f:Steady rate="10"/>
      </f:counter>
      <f:initializers>
        <f:Velocity>
          <f:ConeZone angle="0.5" height="40" truncatedHeight="30">
            <f:axis>
              <geom:Vector3D x="0" y="-1" z="0"/>
            </f:axis>
          </f:ConeZone>
        </f:Velocity>
        <f:SharedImage>
          <f:RadialDot radius="6"/>
        </f:SharedImage>
        <f:Lifetime minLifetime="11" maxLifetime="12"/>
      </f:initializers>
      <f:actions>
        <f:Move/>
        <f:Age/>
        <f:LinearDrag drag="0.01"/>
        <f:ScaleImage startScale="1" endScale="15"/>
        <f:Fade startAlpha="0.15" endAlpha="0"/>
        <f:RandomDrift driftX="15" driftY="15" driftZ="15"/>
      </f:actions>
    </f:Emitter>
    <f:Emitter id="fire" autoStart="true">
      <f:counter>
        <f:Steady rate="60"/>
      </f:counter>
      <f:initializers>
        <f:Position>
          <f:DiscZone outerRadius="3">
            <f:normal>
              <geom:Vector3D x="0" y="1" z="0"/>
            </f:normal>
          </f:DiscZone>
        </f:Position>
        <f:Velocity>
          <f:DiscZone outerRadius="20">
            <f:normal>
              <geom:Vector3D x="0" y="1" z="0"/>
            </f:normal>
          </f:DiscZone>
        </f:Velocity>
        <f:SharedImage image="{new FireBlob()}"/>
        <f:Lifetime minLifetime="2" maxLifetime="3"/>
      </f:initializers>
      <f:actions>
        <f:Move/>
        <f:RotateToDirection/>
        <f:Age/>
        <f:LinearDrag drag="1"/>
        <f:Accelerate x="0" y="-40" z="0"/>
        <f:ScaleImage startScale="1" endScale="1.5"/>
        <f:ColorChange startColor="{0xFFFFCC00}" endColor="0x00CC0000"/>
      </f:actions>
    </f:Emitter>
  </f:emitters>
</f:BitmapRenderer>
</s:Application>
package
{
  import away3d.containers.ObjectContainer3D;
  import away3d.containers.View3D;

  import org.flintparticles.integration.away3d.v4.A3D4Renderer;
  import org.flintparticles.threeD.emitters.Emitter3D;

  import flash.display.Sprite;
  import flash.events.Event;
  import flash.geom.Vector3D;

  [SWF(width='400', height='400', frameRate='61', backgroundColor='#000000')]
  
  public class Main extends Sprite
  {
    private var smoke:Emitter3D;
    private var fire:Emitter3D;
    private var view:View3D;
    private var renderer:A3D4Renderer;
    
    public function Main()
    {
      smoke = new Smoke();
      smoke.start( );
      
      fire = new Fire();
      fire.start( );
      
      view = new View3D();
      view.width = 400;
      view.height = 400;
      view.camera.y = 150;
      view.camera.z = 320;
      view.camera.lookAt( new Vector3D( 0, 150, 0 ) );
      addChild(view);

      var particleContainer:ObjectContainer3D = new ObjectContainer3D();
      view.scene.addChild( particleContainer );
      
      renderer = new A3D4Renderer( particleContainer );
      renderer.addEmitter( smoke );
      renderer.addEmitter( fire );
      
      addEventListener( Event.ENTER_FRAME, render, false, 0, true );
    }
    
    private function render( ev:Event ):void
    {
      // render the view
      view.render();
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.ColorChange;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.away3d.v4.initializers.A3D4DisplayObject;
  import org.flintparticles.threeD.actions.Accelerate;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RotateToDirection;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Position;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.DiscZone;

  import flash.geom.Vector3D;

  public class Fire extends Emitter3D
  {
    public function Fire()
    {
      counter = new Steady( 60 );

      addInitializer( new Lifetime( 2, 3 ) );
      addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 20 ) ) );
      addInitializer( new Position( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 3 ) ) );
      addInitializer( new A3D4DisplayObject( new FireBlob(), true ) );

      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 1 ) );
      addAction( new Accelerate( new Vector3D( 0, 40, 0 ) ) );
      addAction( new ColorChange( 0xFEFFCC00, 0x00CC0000 ) );
      addAction( new ScaleImage( 1, 1.5 ) );
      addAction( new RotateToDirection() );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.displayObjects.RadialDot;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.away3d.v4.initializers.A3D4DisplayObject;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RandomDrift;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.ConeZone;

  import flash.geom.Vector3D;

  public class Smoke extends Emitter3D
  {
    public function Smoke()
    {
      counter = new Steady( 10 );
      
      addInitializer( new Lifetime( 11, 12 ) );
      addInitializer( new Velocity( new ConeZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 0.5, 40, 30 ) ) );
      addInitializer( new A3D4DisplayObject( new RadialDot( 6 ), true ) );
      
      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 0.01 ) );
      addAction( new ScaleImage( 1, 15 ) );
      addAction( new Fade( 0.15, 0 ) );
      addAction( new RandomDrift( 15, 15, 15 ) );
    }
  }
}
package
{
  import alternativa.engine3d.core.Camera3D;
  import alternativa.engine3d.core.Object3D;
  import alternativa.engine3d.core.Resource;
  import alternativa.engine3d.core.View;

  import org.flintparticles.integration.alternativa3d.Alt3DRenderer;
  import org.flintparticles.threeD.emitters.Emitter3D;

  import flash.display.Sprite;
  import flash.display.Stage3D;
  import flash.events.Event;

  [SWF(width='400', height='400', frameRate='61', backgroundColor='#000000')]
  
  public class Main extends Sprite
  {
    private var smoke:Emitter3D;
    private var fire:Emitter3D;
    private var particleContainer : Object3D;
    private var camera : Camera3D;
    private var stage3D : Stage3D;
    private var renderer : Alt3DRenderer;
    
    public function Main()
    {
      camera = new Camera3D( 0.1, 10000 );
      camera.view = new View( stage.stageWidth, stage.stageHeight );
      camera.view.backgroundColor = 0x000000;
      camera.view.hideLogo();
      addChild( camera.view );
      addChild( camera.diagram );
      
      camera.rotationX = 0;
      camera.y = -150;
      camera.z = -300;

      stage3D = stage.stage3Ds[0];
      stage3D.addEventListener( Event.CONTEXT3D_CREATE, onContextCreate );
      stage3D.requestContext3D();
    }

    private function onContextCreate( event : Event ) : void
    {
      particleContainer = new Object3D();
      particleContainer.addChild( camera );
      renderer = new Alt3DRenderer( particleContainer );
      
      smoke = new Smoke();
      renderer.addEmitter( smoke );
      smoke.start( );
      
      fire = new Fire();
      renderer.addEmitter( fire );
      fire.start( );
      
      addEventListener( Event.ENTER_FRAME, render, false, 0, true );
    }
    
    private function render( ev:Event ):void
    {
      // render the view
      camera.view.width = stage.stageWidth;
      camera.view.height = stage.stageHeight;
      camera.render( stage3D );
      for each ( var resource:Resource in particleContainer.getResources( true ) )
      {
        resource.upload( stage3D.context3D );
      }
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.alternativa3d.initializers.Alt3DDisplayObject;
  import org.flintparticles.threeD.actions.Accelerate;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RotateToDirection;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Position;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.DiscZone;

  import flash.geom.Vector3D;

  public class Fire extends Emitter3D
  {
    public function Fire()
    {
      counter = new Steady( 60 );

      addInitializer( new Lifetime( 2, 3 ) );
      addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 20 ) ) );
      addInitializer( new Position( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 3 ) ) );
      addInitializer( new Alt3DDisplayObject( new FireBlob() ) );

      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 1 ) );
      addAction( new Accelerate( new Vector3D( 0, -40, 0 ) ) );
      addAction( new Fade( 1, 0 ) );
      addAction( new ScaleImage( 1.5, 2.2 ) );
      addAction( new RotateToDirection() );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.displayObjects.RadialDot;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.alternativa3d.initializers.Alt3DDisplayObject;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RandomDrift;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.ConeZone;

  import flash.geom.Vector3D;

  public class Smoke extends Emitter3D
  {
    public function Smoke()
    {
      counter = new Steady( 9 );
      
      addInitializer( new Lifetime( 11, 12 ) );
      addInitializer( new Velocity( new ConeZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, -1, 0 ), 0.5, 40, 30 ) ) );
      addInitializer( new Alt3DDisplayObject( new RadialDot( 8 ) ) );
      
      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 0.01 ) );
      addAction( new ScaleImage( 1, 15 ) );
      addAction( new Fade( 0.15, 0 ) );
      addAction( new RandomDrift( 15, 15, 15 ) );
    }
  }
}
package
{
  import away3d.containers.View3D;

  import org.flintparticles.integration.away3d.v3.A3D3Renderer;
  import org.flintparticles.threeD.emitters.Emitter3D;

  import flash.display.Sprite;
  import flash.events.Event;
  import flash.geom.Vector3D;

  [SWF(width='400', height='400', frameRate='61', backgroundColor='#000000')]
  
  public class Main extends Sprite
  {
    private var smoke:Emitter3D;
    private var fire:Emitter3D;
    private var view:View3D;
    private var renderer:A3D3Renderer;
    
    public function Main()
    {
      smoke = new Smoke();
      smoke.start( );
      
      fire = new Fire();
      fire.start( );
      
      view = new View3D({x:200,y:200});
      view.camera.y = 150;
      view.camera.z = 750;
      view.camera.lookAt( new Vector3D( 0, 150, 0 ) );
      addChild(view);
      renderer = new A3D3Renderer( view.scene );
      renderer.addEmitter( smoke );
      renderer.addEmitter( fire );
      
      addEventListener( Event.ENTER_FRAME, render, false, 0, true );
    }
    
    private function render( ev:Event ):void
    {
      // render the view
      view.render();
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.ColorChange;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.away3d.v3.initializers.A3D3DisplayObjectClass;
  import org.flintparticles.threeD.actions.Accelerate;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RotateToDirection;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Position;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.DiscZone;

  import flash.geom.Vector3D;

  public class Fire extends Emitter3D
  {
    public function Fire()
    {
      counter = new Steady( 60 );

      addInitializer( new Lifetime( 2, 3 ) );
      addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 20 ) ) );
      addInitializer( new Position( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 3 ) ) );
      addInitializer( new A3D3DisplayObjectClass( FireBlob ) );

      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 1 ) );
      addAction( new Accelerate( new Vector3D( 0, 40, 0 ) ) );
      addAction( new ColorChange( 0xFFFFCC00, 0x00CC0000 ) );
      addAction( new ScaleImage( 1, 1.5 ) );
      addAction( new RotateToDirection() );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.displayObjects.RadialDot;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.away3d.v3.initializers.A3D3DisplayObjectClass;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RandomDrift;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.ConeZone;

  import flash.geom.Vector3D;

  public class Smoke extends Emitter3D
  {
    public function Smoke()
    {
      counter = new Steady( 9 );
      
      addInitializer( new Lifetime( 11, 12 ) );
      addInitializer( new Velocity( new ConeZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 0.5, 40, 30 ) ) );
      addInitializer( new A3D3DisplayObjectClass( RadialDot, [6] ) );
      
      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 0.01 ) );
      addAction( new ScaleImage( 1, 15 ) );
      addAction( new Fade( 0.15, 0 ) );
      addAction( new RandomDrift( 15, 15, 15 ) );
    }
  }
}
package
{
  import org.flintparticles.integration.papervision3d.PV3DRenderer;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.papervision3d.cameras.Camera3D;
  import org.papervision3d.render.BasicRenderEngine;
  import org.papervision3d.scenes.Scene3D;
  import org.papervision3d.view.Viewport3D;

  import flash.display.Sprite;
  import flash.events.Event;

  [SWF(width='400', height='400', frameRate='61', backgroundColor='#000000')]
  
  public class Main extends Sprite
  {
    private var viewport:Viewport3D;
    private var smoke:Emitter3D;
    private var fire:Emitter3D;
    private var renderer:BasicRenderEngine;
    private var flintRenderer:PV3DRenderer;
    private var scene:Scene3D;
    private var camera:Camera3D;

    public function Main()
    {
      smoke = new Smoke();
      smoke.start( );
      
      fire = new Fire();
      fire.start( );
      
      viewport = new Viewport3D( 400, 400 );
      addChild( viewport );
      
      renderer = new BasicRenderEngine();
      scene = new Scene3D();
      camera = new Camera3D();
      camera.z = -400;
      camera.y = 150;
      
      flintRenderer = new PV3DRenderer( scene );
      flintRenderer.addEmitter( smoke );
      flintRenderer.addEmitter( fire );
      
      addEventListener( Event.ENTER_FRAME, render, false, 0, true );
    }
    
    private function render( ev:Event ):void
    {
      // render the view
      renderer.renderScene( scene, camera, viewport);
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.ColorChange;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.papervision3d.initializers.PV3DDisplayObjectClass;
  import org.flintparticles.threeD.actions.Accelerate;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RotateToDirection;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Position;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.DiscZone;

  import flash.geom.Vector3D;

  public class Fire extends Emitter3D
  {
    public function Fire()
    {
      counter = new Steady( 60 );

      addInitializer( new Lifetime( 2, 3 ) );
      addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 20 ) ) );
      addInitializer( new Position( new DiscZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 3 ) ) );
      addInitializer( new PV3DDisplayObjectClass( FireBlob ) );

      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 1 ) );
      addAction( new Accelerate( new Vector3D( 0, 40, 0 ) ) );
      addAction( new ColorChange( 0xFFFFCC00, 0x00CC0000 ) );
      addAction( new ScaleImage( 1, 1.5 ) );
      addAction( new RotateToDirection() );
    }
  }
}
package
{
  import org.flintparticles.common.actions.Age;
  import org.flintparticles.common.actions.Fade;
  import org.flintparticles.common.actions.ScaleImage;
  import org.flintparticles.common.counters.Steady;
  import org.flintparticles.common.displayObjects.RadialDot;
  import org.flintparticles.common.initializers.Lifetime;
  import org.flintparticles.integration.papervision3d.initializers.PV3DDisplayObjectClass;
  import org.flintparticles.threeD.actions.LinearDrag;
  import org.flintparticles.threeD.actions.Move;
  import org.flintparticles.threeD.actions.RandomDrift;
  import org.flintparticles.threeD.emitters.Emitter3D;
  import org.flintparticles.threeD.initializers.Velocity;
  import org.flintparticles.threeD.zones.ConeZone;

  import flash.geom.Vector3D;

  public class Smoke extends Emitter3D
  {
    public function Smoke()
    {
      counter = new Steady( 7 );
      
      addInitializer( new Lifetime( 11, 12 ) );
      addInitializer( new Velocity( new ConeZone( new Vector3D( 0, 0, 0 ), new Vector3D( 0, 1, 0 ), 0.5, 40, 30 ) ) );
      addInitializer( new PV3DDisplayObjectClass( RadialDot, 6 ) );
      
      addAction( new Age( ) );
      addAction( new Move( ) );
      addAction( new LinearDrag( 0.01 ) );
      addAction( new ScaleImage( 1, 15 ) );
      addAction( new Fade( 0.15, 0 ) );
      addAction( new RandomDrift( 15, 15, 15 ) );
    }
  }
}