Package | org.zozuar.volumetrics |
Class | public class EffectContainer |
Inheritance | EffectContainer ![]() |
Subclasses | VolumetricPointLight |
Property | Defined By | ||
---|---|---|---|
blur : Boolean = false
When true a blur filter is applied to the final effect bitmap (can help when colorIntegrity == true). | EffectContainer | ||
colorIntegrity : Boolean = false
Selects rendering method; when set to true colors won't be distorted and performance will be
a little worse. | EffectContainer | ||
intensity : Number = 4
Light intensity. | EffectContainer | ||
passes : uint = 6
Number of passes applied to buffer. | EffectContainer | ||
rasterQuality : String = null
Set this to one of the StageQuality constants to use this quality level when drawing bitmaps, or to
null to use the current stage quality. | EffectContainer | ||
scale : Number = 2
Final scale of emission. | EffectContainer | ||
smoothing : Boolean = true
Smooth scaling of the effect's final output bitmap. | EffectContainer | ||
srcX : Number
Light source x. | EffectContainer | ||
srcY : Number
Light source y. | EffectContainer |
Property | Defined By | ||
---|---|---|---|
_baseBmd : BitmapData | EffectContainer | ||
_blurFilter : BlurFilter | EffectContainer | ||
_bufferBmd : BitmapData | EffectContainer | ||
_bufferRect : Rectangle | EffectContainer | ||
_bufferSize : uint = 0x8000 | EffectContainer | ||
_ct : ColorTransform | EffectContainer | ||
_emission : DisplayObject | EffectContainer | ||
_halve : ColorTransform | EffectContainer | ||
_lightBmp : Bitmap | EffectContainer | ||
_mtx : Matrix | EffectContainer | ||
_occlusion : DisplayObject | EffectContainer | ||
_occlusionLoResBmd : BitmapData | EffectContainer | ||
_occlusionLoResBmp : Bitmap | EffectContainer | ||
_viewportHeight : uint | EffectContainer | ||
_viewportWidth : uint | EffectContainer | ||
_zero : Point | EffectContainer |
Method | Defined By | ||
---|---|---|---|
EffectContainer(width:uint, height:uint, emission:DisplayObject, occlusion:DisplayObject = null)
Creates a new effect container. | EffectContainer | ||
dispose():void
Dispose of all intermediate buffers. | EffectContainer | ||
render(e:Event = null):void
Render a single frame. | EffectContainer | ||
setBufferSize(size:uint):void
Sets the approximate size (in pixels) of the effect's internal buffers. | EffectContainer | ||
setViewportSize(width:uint, height:uint):void
Sets the container's size. | EffectContainer | ||
startRendering():void
Render the effect on every frame until stopRendering is called. | EffectContainer | ||
stopRendering():void
Stop rendering on every frame. | EffectContainer |
Method | Defined By | ||
---|---|---|---|
_applyEffect(bmd:BitmapData, rect:Rectangle, buffer:BitmapData, mtx:Matrix, passes:uint):void
Low-level workhorse, applies the lighting effect to a bitmap. | EffectContainer | ||
_copyMatrix(src:Matrix, dst:Matrix):void | EffectContainer | ||
_drawLoResEmission():void
Draws a scaled-down emission on _baseBmd. | EffectContainer | ||
_eraseLoResOcclusion():void
Draws a scaled-down occlusion on _occlusionLoResBmd and erases it from _baseBmd. | EffectContainer | ||
_updateBuffers():void | EffectContainer |
_baseBmd | property |
protected var _baseBmd:BitmapData
_blurFilter | property |
protected var _blurFilter:BlurFilter
_bufferBmd | property |
protected var _bufferBmd:BitmapData
_bufferRect | property |
protected var _bufferRect:Rectangle
_bufferSize | property |
protected var _bufferSize:uint = 0x8000
_ct | property |
protected var _ct:ColorTransform
_emission | property |
protected var _emission:DisplayObject
_halve | property |
protected var _halve:ColorTransform
_lightBmp | property |
protected var _lightBmp:Bitmap
_mtx | property |
protected var _mtx:Matrix
_occlusion | property |
protected var _occlusion:DisplayObject
_occlusionLoResBmd | property |
protected var _occlusionLoResBmd:BitmapData
_occlusionLoResBmp | property |
protected var _occlusionLoResBmp:Bitmap
_viewportHeight | property |
protected var _viewportHeight:uint
_viewportWidth | property |
protected var _viewportWidth:uint
_zero | property |
protected var _zero:Point
blur | property |
public var blur:Boolean = false
When true a blur filter is applied to the final effect bitmap (can help when colorIntegrity == true).
colorIntegrity | property |
public var colorIntegrity:Boolean = false
Selects rendering method; when set to true colors won't be distorted and performance will be a little worse. Also, this might make the final output appear grainier.
intensity | property |
public var intensity:Number = 4
Light intensity.
passes | property |
public var passes:uint = 6
Number of passes applied to buffer. Lower numbers mean lower quality but better performance, anything above 8 is probably overkill.
rasterQuality | property |
public var rasterQuality:String = null
Set this to one of the StageQuality constants to use this quality level when drawing bitmaps, or to null to use the current stage quality. Mileage may vary on different platforms and player versions. I think it should only be used when stage.quality is LOW (set this to BEST to get reasonable results).
scale | property |
public var scale:Number = 2
Final scale of emission. Should always be more than 1.
smoothing | property |
public var smoothing:Boolean = true
Smooth scaling of the effect's final output bitmap.
srcX | property |
public var srcX:Number
Light source x.
The default value is viewport center (set in constructor).
.
srcY | property |
public var srcY:Number
Light source y.
The default value is viewport center (set in constructor).
.
EffectContainer | () | Constructor |
public function EffectContainer(width:uint, height:uint, emission:DisplayObject, occlusion:DisplayObject = null)
Creates a new effect container.
Parameterswidth:uint — Viewport width in pixels.
| |
height:uint — Viewport height in pixels.
| |
emission:DisplayObject — A DisplayObject to which the effect will be applied. This object will be
added as a child of the container. When applying the effect the object's filters and color
transform are ignored, if you want to use filters or a color transform put your content in
another object and addChild it to this one instead.
| |
occlusion:DisplayObject (default = null ) — An optional occlusion object, handled the same way as the emission object.
|
_applyEffect | () | method |
protected function _applyEffect(bmd:BitmapData, rect:Rectangle, buffer:BitmapData, mtx:Matrix, passes:uint):void
Low-level workhorse, applies the lighting effect to a bitmap. This function modifies the bmd and buffer bitmaps and its mtx argument.
Parameters
bmd:BitmapData — The BitmapData to apply the effect on.
| |
rect:Rectangle — BitmapData rectangle.
| |
buffer:BitmapData — Another BitmapData object for temporary storage. Must be the same size as bmd.
| |
mtx:Matrix — Effect matrix.
| |
passes:uint — Number of passes to make.
|
_copyMatrix | () | method |
protected function _copyMatrix(src:Matrix, dst:Matrix):void
Parameters
src:Matrix | |
dst:Matrix |
_drawLoResEmission | () | method |
protected function _drawLoResEmission():void
Draws a scaled-down emission on _baseBmd.
_eraseLoResOcclusion | () | method |
protected function _eraseLoResOcclusion():void
Draws a scaled-down occlusion on _occlusionLoResBmd and erases it from _baseBmd.
_updateBuffers | () | method |
protected function _updateBuffers():void
dispose | () | method |
public function dispose():void
Dispose of all intermediate buffers. After calling this the EffectContainer object will be unusable.
render | () | method |
public function render(e:Event = null):void
Render a single frame.
Parameters
e:Event (default = null ) — In case you want to make this an event listener.
|
setBufferSize | () | method |
public function setBufferSize(size:uint):void
Sets the approximate size (in pixels) of the effect's internal buffers. Smaller number means lower quality and better performance. This method recreates internal buffers (slow), do not call this on every frame.
Parameters
size:uint — Buffer size in pixels
|
setViewportSize | () | method |
public function setViewportSize(width:uint, height:uint):void
Sets the container's size. This method recreates internal buffers (slow), do not call this on every frame.
Parameters
width:uint — Viewport width in pixels
| |
height:uint — Viewport height in pixels
|
startRendering | () | method |
public function startRendering():void
Render the effect on every frame until stopRendering is called.
stopRendering | () | method |
public function stopRendering():void
Stop rendering on every frame.