Packagestarling.rendering
Classpublic class MeshEffect
InheritanceMeshEffect Inheritance FilterEffect Inheritance Effect Inheritance Object

An effect drawing a mesh of textured, colored vertices. This is the standard effect that is the base for all mesh styles; if you want to create your own mesh styles, 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 root class, "Effect".

See also

Effect
FilterEffect
starling.styles.MeshStyle


Public Properties
 PropertyDefined By
  alpha : Number
The alpha value of the object rendered by the effect.
MeshEffect
 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
 Inheritedtexture : Texture
The texture to be mapped onto the vertices.
FilterEffect
 InheritedtextureRepeat : Boolean
Indicates if pixels at the edges will be repeated or clamped.
FilterEffect
 InheritedtextureSmoothing : String
The smoothing filter that is used for the texture.
FilterEffect
  tinted : Boolean
Indicates if the rendered vertices are tinted in any way, i.e.
MeshEffect
  vertexFormat : VertexDataFormat
[override] [read-only] The data format that this effect requires from the VertexData that it renders: "position:float2, texCoords:float2, color:bytes4"
MeshEffect
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
 InheritedprogramVariantName : 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 MeshEffect instance.
MeshEffect
 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.
MeshEffect
  
beforeDraw(context:Context3D):void
[override] This method is called by render, directly before context.drawTriangles.
MeshEffect
 Inherited
Creates the program (a combination of vertex- and fragment-shader) used to render the effect with the current settings.
Effect
 Inherited
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
 InheritedSTD_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, color:bytes4"
MeshEffect
Property Detail
alphaproperty
alpha:Number

The alpha value of the object rendered by the effect. Must be taken into account by all subclasses.


Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void
tintedproperty 
tinted:Boolean

Indicates if the rendered vertices are tinted in any way, i.e. if there are vertices that have a different color than fully opaque white. The base MeshEffect class uses this information to simplify the fragment shader if possible. May be ignored by subclasses.


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

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


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

Creates a new MeshEffect 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

Constant Detail
VERTEX_FORMATConstant
public static const VERTEX_FORMAT:VertexDataFormat

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