package org.papervision3d.core.geom.renderables { import org.papervision3d.core.render.command.IRenderListItem; import org.papervision3d.core.render.command.Renderstudent_ar_org_papervision3d_core_geom_renderables_Particle; import org.papervision3d.materials.special.student_ar_org_papervision3d_core_geom_renderables_ParticleMaterial; import flash.geom.Rectangle; /** * This is the single renderable student_ar_org_papervision3d_core_geom_renderables_Particle object, used by student_ar_org_papervision3d_core_geom_renderables_Particles.as * * See student_ar_org_papervision3d_core_geom_renderables_Particles.as for a full explanation. * * * @author Ralph Hauwert * @author Seb Lee-Delisle */ public class 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:student_ar_org_papervision3d_core_geom_renderables_ParticleMaterial; public var renderCommand:Renderstudent_ar_org_papervision3d_core_geom_renderables_Particle; public var renderScale:Number; /** * The rectangle containing the particles visible area in 2D. */ public var renderRect:Rectangle; /** * * @param material The student_ar_org_papervision3d_core_geom_renderables_ParticleMaterial used for rendering the student_ar_org_papervision3d_core_geom_renderables_Particle * @param size The size of the particle. For some materials (ie Bitmapstudent_ar_org_papervision3d_core_geom_renderables_ParticleMaterial) this is used as a scale factor. * @param x x position of the particle * @param y y position of the particle * @param z z position of the particle * */ public function student_ar_org_papervision3d_core_geom_renderables_Particle(material:student_ar_org_papervision3d_core_geom_renderables_ParticleMaterial, size:Number=1, x:Number=0, y:Number=0, z:Number=0) { this.material = material; this.size = size; this.renderCommand = new Renderstudent_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; } } }