topical media & game development

talk show tell print

student-ar-org-papervision3d-core-geom-renderables-Particle.ax

student-ar-org-papervision3d-core-geom-renderables-Particle.ax [swf] [flash] flex


  package org.papervision3d.core.geom.renderables
  {
          
          
          import org.papervision3d.core.render.command.IRenderListItem;
          import org.papervision3d.core.render.command.Render@ax-student-ar-org-papervision3d-core-geom-renderables-Particle;
          import org.papervision3d.materials.special.@fileMaterial;
          
          import flash.geom.Rectangle;         
  
          
This is the single renderable @ax-student-ar-org-papervision3d-core-geom-renderables-Particle object, used by @files.as See @files.as for a full explanation.
author: Ralph Hauwert
author: Seb Lee-Delisle

  
  
          public class @ax-student-ar-org-papervision3d-core-geom-renderables-Particle extends AbstractRenderable implements IRenderable
          {
                  
The size or scale factor of the particle.

                  
                  public var size:Number;
                  public var vertex3D:Vertex3D;
                  public var material:@fileMaterial;
                  public var renderCommand:Render@ax-student-ar-org-papervision3d-core-geom-renderables-Particle;
                  public var renderScale:Number;
                  
                  
The rectangle containing the particles visible area in 2D.

                  
                  public var renderRect:Rectangle;
                  
                  

parameter: material The @fileMaterial used for rendering the @ax-student-ar-org-papervision3d-core-geom-renderables-Particle
parameter: size The size of the particle. For some materials (ie Bitmap@fileMaterial) this is used as a scale factor.
parameter: x x position of the particle
parameter: y y position of the particle
parameter: z z position of the particle

                  
                  public function @ax-student-ar-org-papervision3d-core-geom-renderables-Particle(material:@fileMaterial, size:Number=1, x:Number=0, y:Number=0, z:Number=0)
                  {
                          this.material = material;
                          this.size = size;
                          this.renderCommand = new Render@ax-student-ar-org-papervision3d-core-geom-renderables-Particle(this);
                          this.renderRect = new Rectangle();
                          vertex3D = new Vertex3D(x,y,z);
                  }
                  
                  
This is called during the projection cycle. It updates the rectangular area that the particle is drawn into. It's important for the culling phase, and changes dependent on the type of material used.

                  
  
                  public function updateRenderRect():void
                  {
                          material.updateRenderRect(this);
                  }
                  
                  public function set x(x:Number):void
                  {
                          vertex3D.x = x;
                  }
                  
                  public function get x():Number
                  {
                          return vertex3D.x;
                  }
                  
                  public function set y(y:Number):void
                  {
                          vertex3D.y = y;
                  }
                  
                  public function get y():Number
                  {
                          return vertex3D.y;
                  }
                  
                  public function set z(z:Number):void
                  {
                          vertex3D.z = z;
                  }
                  
                  public function get z():Number
                  {
                          return vertex3D.z;
                  }
                  
                  override public function getRenderListItem():IRenderListItem
                  {
                          return renderCommand;
                  }
                  
          }
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.