| Package | org.flintparticles.threeD.renderers |
| Class | public class BitmapRenderer |
| Inheritance | BitmapRenderer SpriteRendererBase flash.display.Sprite |
| Subclasses | PixelRenderer |
The region of the projection plane drawn by this renderer must be defined in the canvas property of the BitmapRenderer. Particles outside this region are not drawn.
The image to be used for each particle is the particle's image property. This is a DisplayObject, but this DisplayObject is not used directly. Instead it is copied into the bitmap with the various properties of the particle applied, including 3D positioning and perspective relative to the renderer's camera position. Consequently each particle may be represented by the same DisplayObject instance and the SharedImage initializer can be used with this renderer.
The BitmapRenderer allows the use of BitmapFilters to modify the appearance of the bitmap. Every frame, under normal circumstances, the Bitmap used to display the particles is wiped clean before all the particles are redrawn. However, if one or more filters are added to the renderer, the filters are applied to the bitmap instead of wiping it clean. This enables various trail effects by using blur and other filters.
The BitmapRenderer has mouse events disabled for itself and any display objects in its display list. To enable mouse events for the renderer or its children set the mouseEnabled or mouseChildren properties to true.
| Property | Defined By | ||
|---|---|---|---|
| bitmapData : BitmapData [read-only]
The bitmap data of the renderer. | BitmapRenderer | ||
| camera : Camera
The camera controls the view for the renderer
| BitmapRenderer | ||
| canvas : Rectangle
The canvas is the area within the renderer on which particles can be drawn. | BitmapRenderer | ||
![]() | emitters : Vector.<Emitter>
The array of all emitters being rendered by this renderer. | SpriteRendererBase | |
| postFilters : Array
The array of all filters being applied before rendering. | BitmapRenderer | ||
| preFilters : Array
The array of all filters being applied before rendering. | BitmapRenderer | ||
| smoothing : Boolean | BitmapRenderer | ||
| zSort : Boolean
Indicates whether the particles should be sorted in distance order for display. | BitmapRenderer | ||
| Property | Defined By | ||
|---|---|---|---|
![]() | _particles : Array | SpriteRendererBase | |
| toDegrees : Number | BitmapRenderer | ||
| ZERO_POINT : Point [static] | BitmapRenderer | ||
| Method | Defined By | ||
|---|---|---|---|
BitmapRenderer(canvas:Rectangle, zSort:Boolean = true, smoothing:Boolean = false)
The constructor creates a BitmapRenderer. | BitmapRenderer | ||
![]() | addEmitter(emitter:Emitter):void
Adds the emitter to the renderer. | SpriteRendererBase | |
addFilter(filter:BitmapFilter, postRender:Boolean = false):void
The addFilter method adds a BitmapFilter to the renderer. | BitmapRenderer | ||
clearPaletteMap():void
Clears any palette map that has been set for the renderer. | BitmapRenderer | ||
![]() | removeEmitter(emitter:Emitter):void
Removes the emitter from the renderer. | SpriteRendererBase | |
removeFilter(filter:BitmapFilter):void
Removes a BitmapFilter object from the Renderer. | BitmapRenderer | ||
setPaletteMap(red:Array = null, green:Array = null, blue:Array = null, alpha:Array = null):void
Sets a palette map for the renderer. | BitmapRenderer | ||
| Method | Defined By | ||
|---|---|---|---|
![]() | addParticle(particle:Particle):void
The addParticle method is called when a particle is added to one of
the emitters that is being rendered by this renderer. | SpriteRendererBase | |
createBitmap():void
Create the Bitmap and BitmapData objects
| BitmapRenderer | ||
drawParticle(particle:Particle3D):void
Used internally here and in derived classes to render a single particle. | BitmapRenderer | ||
![]() | emitterUpdated(ev:EmitterEvent):void | SpriteRendererBase | |
![]() | removeParticle(particle:Particle):void
The removeParticle method is called when a particle is removed from one
of the emitters that is being rendered by this renderer. | SpriteRendererBase | |
renderParticles(particles:Array):void [override]
This method draws the particles in the bitmap image, positioning and
scaling them according to their positions relative to the camera
viewport. | BitmapRenderer | ||
![]() | updateParticles(ev:Event):void | SpriteRendererBase | |
| bitmapData | property |
bitmapData:BitmapData [read-only] The bitmap data of the renderer.
public function get bitmapData():BitmapData| camera | property |
camera:CameraThe camera controls the view for the renderer
public function get camera():Camera public function set camera(value:Camera):void| canvas | property |
canvas:RectangleThe canvas is the area within the renderer on which particles can be drawn. Particles outside this area will not be drawn.
public function get canvas():Rectangle public function set canvas(value:Rectangle):void| postFilters | property |
postFilters:ArrayThe array of all filters being applied before rendering.
public function get postFilters():Array public function set postFilters(value:Array):void| preFilters | property |
preFilters:ArrayThe array of all filters being applied before rendering.
public function get preFilters():Array public function set preFilters(value:Array):void| smoothing | property |
smoothing:Boolean public function get smoothing():Boolean public function set smoothing(value:Boolean):void| toDegrees | property |
protected var toDegrees:Number| ZERO_POINT | property |
protected static var ZERO_POINT:Point| zSort | property |
zSort:BooleanIndicates whether the particles should be sorted in distance order for display.
public function get zSort():Boolean public function set zSort(value:Boolean):void| BitmapRenderer | () | Constructor |
public function BitmapRenderer(canvas:Rectangle, zSort:Boolean = true, smoothing:Boolean = false)The constructor creates a BitmapRenderer. After creation it should be added to the display list of a DisplayObjectContainer to place it on the stage.
Emitter's should be added to the renderer using the renderer's addEmitter method. The renderer displays all the particles created by the emitter's that have been added to it.
Parameterscanvas:Rectangle — The area within the renderer on which particles can be drawn.
Particles outside this area will not be drawn.
| |
zSort:Boolean (default = true) — Whether to sort the particles according to their
z order when rendering them or not.
| |
smoothing:Boolean (default = false) — Whether to use smoothing when scaling the Bitmap and, if the
particles are represented by bitmaps, when drawing the particles.
Smoothing removes pixelation when images are scaled and rotated, but it
takes longer so it may slow down your particle system.
|
See also
| addFilter | () | method |
public function addFilter(filter:BitmapFilter, postRender:Boolean = false):voidThe addFilter method adds a BitmapFilter to the renderer. These filters are applied each frame, before or after the new particle positions are drawn, instead of wiping the display clear. Use of a blur filter, for example, will produce a trail behind each particle as the previous images blur and fade more each frame.
Parameters
filter:BitmapFilter — The filter to apply
| |
postRender:Boolean (default = false) — If false, the filter is applied before drawing the particles
in their new positions. If true the filter is applied after drawing the particles.
|
| clearPaletteMap | () | method |
public function clearPaletteMap():voidClears any palette map that has been set for the renderer.
| createBitmap | () | method |
protected function createBitmap():voidCreate the Bitmap and BitmapData objects
| drawParticle | () | method |
protected function drawParticle(particle:Particle3D):voidUsed internally here and in derived classes to render a single particle. Each particle is positioned and perspective scaling applied here.
Derived classes can modify the rendering of individual particles by overriding this method.
Parameters
particle:Particle3D — The particle to draw on the bitmap.
|
| removeFilter | () | method |
public function removeFilter(filter:BitmapFilter):voidRemoves a BitmapFilter object from the Renderer.
Parameters
filter:BitmapFilter — The BitmapFilter to remove
|
See also
| renderParticles | () | method |
override protected function renderParticles(particles:Array):voidThis method draws the particles in the bitmap image, positioning and scaling them according to their positions relative to the camera viewport.
This method is called internally by Flint and shouldn't need to be called by the user.
Parameters
particles:Array — The particles to be rendered.
|
| setPaletteMap | () | method |
public function setPaletteMap(red:Array = null, green:Array = null, blue:Array = null, alpha:Array = null):voidSets a palette map for the renderer. See the paletteMap method in flash's BitmapData object for information about how palette maps work. The palette map will be applied to the full canvas of the renderer after all filters have been applied and the particles have been drawn.
Parameters
red:Array (default = null) | |
green:Array (default = null) | |
blue:Array (default = null) | |
alpha:Array (default = null) |