Packagestarling.core
Classpublic class RenderSupport
InheritanceRenderSupport Inheritance Object

A class that contains helper methods simplifying Stage3D rendering. A RenderSupport instance is passed to any "render" method of display objects. It allows manipulation of the current transformation matrix (similar to the matrix manipulation methods of OpenGL 1.x) and other helper methods.



Public Properties
 PropertyDefined By
  blendMode : String
The blend mode to be used on rendering.
RenderSupport
  mvpMatrix : Matrix3D
[read-only] Calculates the product of modelview and projection matrix.
RenderSupport
Public Methods
 MethodDefined By
  
Creates a new RenderSupport object with an empty matrix stack.
RenderSupport
  
applyBlendMode(premultipliedAlpha:Boolean):void
Activates the appropriate blend factors on the current rendering context.
RenderSupport
  
batchQuad(quad:Quad, parentAlpha:Number, texture:Texture = null, smoothing:String = null):void
Adds a quad to the current batch of unrendered quads.
RenderSupport
  
clear(rgb:uint = 0, alpha:Number = 0.0):void
[static] Clears the render context with a certain color and alpha value.
RenderSupport
  
dispose():void
Disposes all quad batches.
RenderSupport
  
Renders the current quad batch and resets it.
RenderSupport
  
Changes the modelview matrix to the identity matrix.
RenderSupport
  
nextFrame():void
Resets the matrix and blend mode stacks, and the quad batch index.
RenderSupport
  
Restores the blend mode that was last pushed to the stack.
RenderSupport
  
popMatrix():void
Restores the modelview matrix that was last pushed to the stack.
RenderSupport
  
Pushes the current blend mode to a stack from which it can be restored later.
RenderSupport
  
pushMatrix():void
Pushes the current modelview matrix to a stack from which it can be restored later.
RenderSupport
  
Clears the blend mode stack and restores NORMAL blend mode.
RenderSupport
  
Empties the matrix stack, resets the modelview matrix to the identity matrix.
RenderSupport
  
rotateMatrix(angle:Number, axis:Vector3D = null):void
Prepends a rotation (angle in radians) to the modelview matrix.
RenderSupport
  
scaleMatrix(sx:Number, sy:Number, sz:Number = 1.0):void
Prepends an incremental scale change to the modelview matrix.
RenderSupport
  
setBlendFactors(premultipliedAlpha:Boolean, blendMode:String = normal):void
[static] Sets up the blending factors that correspond with a certain blend mode.
RenderSupport
  
setDefaultBlendFactors(premultipliedAlpha:Boolean):void
[static] Deprecated.
RenderSupport
  
setOrthographicProjection(width:Number, height:Number, near:Number = -1.0, far:Number = 1.0):void
Sets up the projection matrix for ortographic 2D rendering.
RenderSupport
  
Prepends translation, scale and rotation of an object to the modelview matrix.
RenderSupport
  
transformMatrixForObject(matrix:Matrix3D, object:DisplayObject):void
[static] Prepends translation, scale and rotation of an object to a custom matrix.
RenderSupport
  
translateMatrix(dx:Number, dy:Number, dz:Number = 0):void
Prepends a translation to the modelview matrix.
RenderSupport
Property Detail
blendModeproperty
blendMode:String

The blend mode to be used on rendering.


Implementation
    public function get blendMode():String
    public function set blendMode(value:String):void
mvpMatrixproperty 
mvpMatrix:Matrix3D  [read-only]

Calculates the product of modelview and projection matrix. CAUTION: Don't save a reference to this object! Each call returns the same instance.


Implementation
    public function get mvpMatrix():Matrix3D
Constructor Detail
RenderSupport()Constructor
public function RenderSupport()

Creates a new RenderSupport object with an empty matrix stack.

Method Detail
applyBlendMode()method
public function applyBlendMode(premultipliedAlpha:Boolean):void

Activates the appropriate blend factors on the current rendering context.

Parameters

premultipliedAlpha:Boolean

batchQuad()method 
public function batchQuad(quad:Quad, parentAlpha:Number, texture:Texture = null, smoothing:String = null):void

Adds a quad to the current batch of unrendered quads. If there is a state change, all previous quads are rendered at once, and the batch is reset.

Parameters

quad:Quad
 
parentAlpha:Number
 
texture:Texture (default = null)
 
smoothing:String (default = null)

clear()method 
public static function clear(rgb:uint = 0, alpha:Number = 0.0):void

Clears the render context with a certain color and alpha value.

Parameters

rgb:uint (default = 0)
 
alpha:Number (default = 0.0)

dispose()method 
public function dispose():void

Disposes all quad batches.

finishQuadBatch()method 
public function finishQuadBatch():void

Renders the current quad batch and resets it.

loadIdentity()method 
public function loadIdentity():void

Changes the modelview matrix to the identity matrix.

nextFrame()method 
public function nextFrame():void

Resets the matrix and blend mode stacks, and the quad batch index.

popBlendMode()method 
public function popBlendMode():void

Restores the blend mode that was last pushed to the stack.

popMatrix()method 
public function popMatrix():void

Restores the modelview matrix that was last pushed to the stack.

pushBlendMode()method 
public function pushBlendMode():void

Pushes the current blend mode to a stack from which it can be restored later.

pushMatrix()method 
public function pushMatrix():void

Pushes the current modelview matrix to a stack from which it can be restored later.

resetBlendMode()method 
public function resetBlendMode():void

Clears the blend mode stack and restores NORMAL blend mode.

resetMatrix()method 
public function resetMatrix():void

Empties the matrix stack, resets the modelview matrix to the identity matrix.

rotateMatrix()method 
public function rotateMatrix(angle:Number, axis:Vector3D = null):void

Prepends a rotation (angle in radians) to the modelview matrix.

Parameters

angle:Number
 
axis:Vector3D (default = null)

scaleMatrix()method 
public function scaleMatrix(sx:Number, sy:Number, sz:Number = 1.0):void

Prepends an incremental scale change to the modelview matrix.

Parameters

sx:Number
 
sy:Number
 
sz:Number (default = 1.0)

setBlendFactors()method 
public static function setBlendFactors(premultipliedAlpha:Boolean, blendMode:String = normal):void

Sets up the blending factors that correspond with a certain blend mode.

Parameters

premultipliedAlpha:Boolean
 
blendMode:String (default = normal)

setDefaultBlendFactors()method 
public static function setDefaultBlendFactors(premultipliedAlpha:Boolean):void

Deprecated. Call 'setBlendFactors' instead.

Parameters

premultipliedAlpha:Boolean

setOrthographicProjection()method 
public function setOrthographicProjection(width:Number, height:Number, near:Number = -1.0, far:Number = 1.0):void

Sets up the projection matrix for ortographic 2D rendering.

Parameters

width:Number
 
height:Number
 
near:Number (default = -1.0)
 
far:Number (default = 1.0)

transformMatrix()method 
public function transformMatrix(object:DisplayObject):void

Prepends translation, scale and rotation of an object to the modelview matrix.

Parameters

object:DisplayObject

transformMatrixForObject()method 
public static function transformMatrixForObject(matrix:Matrix3D, object:DisplayObject):void

Prepends translation, scale and rotation of an object to a custom matrix.

Parameters

matrix:Matrix3D
 
object:DisplayObject

translateMatrix()method 
public function translateMatrix(dx:Number, dy:Number, dz:Number = 0):void

Prepends a translation to the modelview matrix.

Parameters

dx:Number
 
dy:Number
 
dz:Number (default = 0)