Packagestarling.rendering
Classpublic class FilterEffect
InheritanceFilterEffect Inheritance Effect Inheritance Object
Subclasses MeshEffect

An effect drawing a mesh of textured vertices. This is the standard effect that is the base for all fragment filters; if you want to create your own fragment filters, you will have to extend this class.

For more information about the usage and creation of effects, please have a look at the documentation of the parent class, "Effect".

See also

Effect
MeshEffect
starling.filters.FragmentFilter


Public Properties
 PropertyDefined By
 InheritedmvpMatrix3D : Matrix3D
The MVP (modelview-projection) matrix transforms vertices into clipspace.
Effect
 InheritedonRestore : Function
The function that you provide here will be called after a context loss.
Effect
  texture : Texture
The texture to be mapped onto the vertices.
FilterEffect
  textureRepeat : Boolean
Indicates if pixels at the edges will be repeated or clamped.
FilterEffect
  textureSmoothing : String
The smoothing filter that is used for the texture.
FilterEffect
  vertexFormat : VertexDataFormat
[override] [read-only] The data format that this effect requires from the VertexData that it renders: "position:float2, texCoords:float2"
FilterEffect
Protected Properties
 PropertyDefined By
 InheritedindexBuffer : IndexBuffer3D
[read-only] The internally used index buffer used on rendering.
Effect
 InheritedindexBufferSize : int
[read-only] The current size of the index buffer (in number of indices).
Effect
 Inheritedprogram : Program
[read-only] Returns the current program, either by creating a new one (via createProgram) or by getting it from the Painter.
Effect
 InheritedprogramBaseName : String
Returns the base name for the program.
Effect
 InheritedprogramName : String
[read-only] Returns the full name of the program, which is used to register it at the current Painter.
Effect
  programVariantName : uint
[override] [read-only] Override this method if the effect requires a different program depending on the current settings.
FilterEffect
 InheritedvertexBuffer : VertexBuffer3D
[read-only] The internally used vertex buffer used on rendering.
Effect
 InheritedvertexBufferSize : int
[read-only] The current size of the vertex buffer (in blocks of 32 bits).
Effect
Public Methods
 MethodDefined By
  
Creates a new FilterEffect instance.
FilterEffect
 Inherited
dispose():void
Purges the index- and vertex-buffers.
Effect
 Inherited
purgeBuffers(vertexBuffer:Boolean = true, indexBuffer:Boolean = true):void
Purges one or both of the vertex- and index-buffers.
Effect
 Inherited
render(firstIndex:int = 0, numTriangles:int = -1):void
Draws the triangles described by the index- and vertex-buffers, or a range of them.
Effect
 Inherited
uploadIndexData(indexData:IndexData, bufferUsage:String = staticDraw):void
Uploads the given index data to the internal index buffer.
Effect
 Inherited
uploadVertexData(vertexData:VertexData, bufferUsage:String = staticDraw):void
Uploads the given vertex data to the internal vertex buffer.
Effect
Protected Methods
 MethodDefined By
  
afterDraw(context:Context3D):void
[override] This method is called by render, directly after context.drawTriangles.
FilterEffect
  
beforeDraw(context:Context3D):void
[override] This method is called by render, directly before context.drawTriangles.
FilterEffect
 Inherited
Creates the program (a combination of vertex- and fragment-shader) used to render the effect with the current settings.
Effect
  
tex(resultReg:String, uvReg:String, sampler:int, texture:Texture, convertToPmaIfRequired:Boolean = true):String
[static] Creates an AGAL source string with a tex operation, including an options list with the appropriate format flag.
FilterEffect
Public Constants
 ConstantDefined By
  STD_VERTEX_SHADER : String
[static] The AGAL code for the standard vertex shader that most filters will use.
FilterEffect
  VERTEX_FORMAT : VertexDataFormat
[static] The vertex format expected by uploadVertexData: "position:float2, texCoords:float2"
FilterEffect
Property Detail
programVariantNameproperty
programVariantName:uint  [read-only] [override]

Override this method if the effect requires a different program depending on the current settings. Ideally, you do this by creating a bit mask encoding all the options. This method is called often, so do not allocate any temporary objects when overriding.

Reserve 4 bits for the variant name of the base class.


Implementation
    protected function get programVariantName():uint
textureproperty 
texture:Texture

The texture to be mapped onto the vertices.


Implementation
    public function get texture():Texture
    public function set texture(value:Texture):void
textureRepeatproperty 
textureRepeat:Boolean

Indicates if pixels at the edges will be repeated or clamped. Only works for power-of-two textures.

The default value is false.


Implementation
    public function get textureRepeat():Boolean
    public function set textureRepeat(value:Boolean):void
textureSmoothingproperty 
textureSmoothing:String

The smoothing filter that is used for the texture.

The default value is bilinear.


Implementation
    public function get textureSmoothing():String
    public function set textureSmoothing(value:String):void
vertexFormatproperty 
vertexFormat:VertexDataFormat  [read-only] [override]

The data format that this effect requires from the VertexData that it renders: "position:float2, texCoords:float2"


Implementation
    public function get vertexFormat():VertexDataFormat
Constructor Detail
FilterEffect()Constructor
public function FilterEffect()

Creates a new FilterEffect instance.

Method Detail
afterDraw()method
override protected function afterDraw(context:Context3D):void

This method is called by render, directly after context.drawTriangles. Resets texture and vertex buffer attributes.

Parameters

context:Context3D

beforeDraw()method 
override protected function beforeDraw(context:Context3D):void

This method is called by render, directly before context.drawTriangles. It activates the program and sets up the context with the following constants and attributes:

Parameters

context:Context3D

tex()method 
protected static function tex(resultReg:String, uvReg:String, sampler:int, texture:Texture, convertToPmaIfRequired:Boolean = true):String

Creates an AGAL source string with a tex operation, including an options list with the appropriate format flag. This is just a convenience method forwarding to the respective RenderUtil method.

Parameters

resultReg:String
 
uvReg:String
 
sampler:int
 
texture:Texture
 
convertToPmaIfRequired:Boolean (default = true)

Returns
String

See also

Constant Detail
STD_VERTEX_SHADERConstant
public static const STD_VERTEX_SHADER:String

The AGAL code for the standard vertex shader that most filters will use. It simply transforms the vertex coordinates to clip-space and passes the texture coordinates to the fragment program (as 'v0').

VERTEX_FORMATConstant 
public static const VERTEX_FORMAT:VertexDataFormat

The vertex format expected by uploadVertexData: "position:float2, texCoords:float2"