Package | starling.rendering |
Class | public class MeshEffect |
Inheritance | MeshEffect FilterEffect Effect Object |
For more information about the usage and creation of effects, please have a look at the documentation of the root class, "Effect".
See also
Property | Defined By | ||
---|---|---|---|
alpha : Number The alpha value of the object rendered by the effect. | MeshEffect | ||
mvpMatrix3D : Matrix3D The MVP (modelview-projection) matrix transforms vertices into clipspace. | Effect | ||
onRestore : 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 | ||
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 |
Method | Defined By | ||
---|---|---|---|
Creates a new MeshEffect instance. | MeshEffect | ||
dispose():void Purges the index- and vertex-buffers. | Effect | ||
purgeBuffers(vertexBuffer:Boolean = true, indexBuffer:Boolean = true):void Purges one or both of the vertex- and index-buffers. | Effect | ||
render(firstIndex:int = 0, numTriangles:int = -1):void Draws the triangles described by the index- and vertex-buffers, or a range of them. | Effect | ||
uploadIndexData(indexData:IndexData, bufferUsage:String = staticDraw):void Uploads the given index data to the internal index buffer. | Effect | ||
uploadVertexData(vertexData:VertexData, bufferUsage:String = staticDraw):void Uploads the given vertex data to the internal vertex buffer. | Effect |
Method | Defined 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 | ||
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 |
Constant | Defined 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, color:bytes4" | MeshEffect |
alpha | property |
alpha:Number
The alpha value of the object rendered by the effect. Must be taken into account by all subclasses.
public function get alpha():Number
public function set alpha(value:Number):void
tinted | property |
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.
public function get tinted():Boolean
public function set tinted(value:Boolean):void
vertexFormat | property |
vertexFormat:VertexDataFormat
[read-only] [override] The data format that this effect requires from the VertexData that it renders:
"position:float2, texCoords:float2, color:bytes4"
public function get vertexFormat():VertexDataFormat
MeshEffect | () | Constructor |
public function MeshEffect()
Creates a new MeshEffect instance.
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:
vc0-vc3
— MVP matrixvc4
— alpha value (same value for all components)va0
— vertex position (xy)va1
— texture coordinates (uv)va2
— vertex color (rgba), using premultiplied alphafs0
— textureParameters
context:Context3D |
VERTEX_FORMAT | Constant |
public static const VERTEX_FORMAT:VertexDataFormat
The vertex format expected by uploadVertexData
:
"position:float2, texCoords:float2, color:bytes4"