Packageaway3d.core.managers
Classpublic class Stage3DProxy
InheritanceStage3DProxy Inheritance flash.events.EventDispatcher

Stage3DProxy provides a proxy class to manage a single Stage3D instance as well as handling the creation and attachment of the Context3D (and in turn the back buffer) is uses. Stage3DProxy should never be created directly, but requested through Stage3DManager.

See also

todo: consider moving all creation methods (createVertexBuffer etc) in here, so that disposal can occur here along with the context, instead of scattered throughout the framework


Public Properties
 PropertyDefined By
  antiAlias : int
The antiAliasing of the Stage3D.
Stage3DProxy
  color : uint
The background color of the Stage3D.
Stage3DProxy
  context3D : Context3D
[read-only] The Context3D object associated with the given Stage3D object.
Stage3DProxy
  driverInfo : String
[read-only] The driver information as reported by the Context3D object (if any)
Stage3DProxy
  enableDepthAndStencil : Boolean
Stage3DProxy
  height : int
The height of the Stage3D.
Stage3DProxy
  renderSurfaceSelector : int
[read-only]
Stage3DProxy
  renderTarget : TextureBase
[read-only]
Stage3DProxy
  scissorRect : Rectangle
Stage3DProxy
  stage3D : Stage3D
[read-only] The base Stage3D object associated with this proxy.
Stage3DProxy
  stage3DIndex : int
[read-only] The index of the Stage3D which is managed by this instance of Stage3DProxy.
Stage3DProxy
  usesSoftwareRendering : Boolean
[read-only] Indicates whether the Stage3D managed by this proxy is running in software mode.
Stage3DProxy
  viewPort : Rectangle
[read-only] A viewPort rectangle equivalent of the Stage3D size and position.
Stage3DProxy
  visible : Boolean
The visibility of the Stage3D.
Stage3DProxy
  width : int
The width of the Stage3D.
Stage3DProxy
  x : Number
The x position of the Stage3D.
Stage3DProxy
  y : Number
The y position of the Stage3D.
Stage3DProxy
Public Methods
 MethodDefined By
  
Stage3DProxy(stage3DIndex:int, stage3D:Stage3D, stage3DManager:Stage3DManager, forceSoftware:Boolean = false)
Creates a Stage3DProxy object.
Stage3DProxy
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
[override] Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
Stage3DProxy
  
clear():void
Stage3DProxy
  
configureBackBuffer(backBufferWidth:int, backBufferHeight:int, antiAlias:int, enableDepthAndStencil:Boolean):void
Configures the back buffer associated with the Stage3D object.
Stage3DProxy
  
dispose():void
Disposes the Stage3DProxy object, freeing the Context3D attached to the Stage3D.
Stage3DProxy
  
present():void
Stage3DProxy
  
Stage3DProxy
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[override] Removes a listener from the EventDispatcher object.
Stage3DProxy
  
setProgram(program3D:Program3D):void
Set the shader program for the subsequent rendering calls.
Stage3DProxy
  
setRenderTarget(target:TextureBase, enableDepthAndStencil:Boolean = false, surfaceSelector:int = 0):void
Stage3DProxy
  
setSimpleVertexBuffer(index:int, buffer:VertexBuffer3D, format:String, offset:int = 0):void
Assign the vertex buffer in the Context3D ready for use in the shader.
Stage3DProxy
  
setTextureAt(index:int, texture:TextureBase):void
Assign the texture in the Context3D ready for use in the shader.
Stage3DProxy
Events
 Event Summary Defined By
  Stage3DProxy
  Stage3DProxy
Property Detail
_context3Dproperty
arcane var _context3D:Context3D

_stage3DIndexproperty 
arcane var _stage3DIndex:int = -1

antiAliasproperty 
antiAlias:int

The antiAliasing of the Stage3D.


Implementation
    public function get antiAlias():int
    public function set antiAlias(value:int):void
colorproperty 
color:uint

The background color of the Stage3D.


Implementation
    public function get color():uint
    public function set color(value:uint):void
context3Dproperty 
context3D:Context3D  [read-only]

The Context3D object associated with the given Stage3D object.


Implementation
    public function get context3D():Context3D
driverInfoproperty 
driverInfo:String  [read-only]

The driver information as reported by the Context3D object (if any)


Implementation
    public function get driverInfo():String
enableDepthAndStencilproperty 
enableDepthAndStencil:Boolean


Implementation
    public function get enableDepthAndStencil():Boolean
    public function set enableDepthAndStencil(value:Boolean):void
heightproperty 
height:int

The height of the Stage3D.


Implementation
    public function get height():int
    public function set height(value:int):void
renderSurfaceSelectorproperty 
renderSurfaceSelector:int  [read-only]


Implementation
    public function get renderSurfaceSelector():int
renderTargetproperty 
renderTarget:TextureBase  [read-only]


Implementation
    public function get renderTarget():TextureBase
scissorRectproperty 
scissorRect:Rectangle


Implementation
    public function get scissorRect():Rectangle
    public function set scissorRect(value:Rectangle):void
stage3Dproperty 
stage3D:Stage3D  [read-only]

The base Stage3D object associated with this proxy.


Implementation
    public function get stage3D():Stage3D
stage3DIndexproperty 
stage3DIndex:int  [read-only]

The index of the Stage3D which is managed by this instance of Stage3DProxy.


Implementation
    public function get stage3DIndex():int
usesSoftwareRenderingproperty 
usesSoftwareRendering:Boolean  [read-only]

Indicates whether the Stage3D managed by this proxy is running in software mode. Remember to wait for the CONTEXT3D_CREATED event before checking this property, as only then will it be guaranteed to be accurate.


Implementation
    public function get usesSoftwareRendering():Boolean
viewPortproperty 
viewPort:Rectangle  [read-only]

A viewPort rectangle equivalent of the Stage3D size and position.


Implementation
    public function get viewPort():Rectangle
visibleproperty 
visible:Boolean

The visibility of the Stage3D.


Implementation
    public function get visible():Boolean
    public function set visible(value:Boolean):void
widthproperty 
width:int

The width of the Stage3D.


Implementation
    public function get width():int
    public function set width(value:int):void
xproperty 
x:Number

The x position of the Stage3D.


Implementation
    public function get x():Number
    public function set x(value:Number):void
yproperty 
y:Number

The y position of the Stage3D.


Implementation
    public function get y():Number
    public function set y(value:Number):void
Constructor Detail
Stage3DProxy()Constructor
public function Stage3DProxy(stage3DIndex:int, stage3D:Stage3D, stage3DManager:Stage3DManager, forceSoftware:Boolean = false)

Creates a Stage3DProxy object. This method should not be called directly. Creation of Stage3DProxy objects should be handled by Stage3DManager.

Parameters
stage3DIndex:int — The index of the Stage3D to be proxied.
 
stage3D:Stage3D — The Stage3D to be proxied.
 
stage3DManager:Stage3DManager
 
forceSoftware:Boolean (default = false) — Whether to force software mode even if hardware acceleration is available.
Method Detail
addEventListener()method
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void

Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. Special case for enterframe and exitframe events - will switch Stage3DProxy into automatic render mode. You can register event listeners on all nodes in the display list for a specific type of event, phase, and priority.

Parameters

type:String — The type of event.
 
listener:Function — The listener function that processes the event.
 
useCapture:Boolean (default = false) — Determines whether the listener works in the capture phase or the target and bubbling phases. If useCapture is set to true, the listener processes the event only during the capture phase and not in the target or bubbling phase. If useCapture is false, the listener processes the event only during the target or bubbling phase. To listen for the event in all three phases, call addEventListener twice, once with useCapture set to true, then again with useCapture set to false.
 
priority:int (default = 0) — The priority level of the event listener. The priority is designated by a signed 32-bit integer. The higher the number, the higher the priority. All listeners with priority n are processed before listeners of priority n-1. If two or more listeners share the same priority, they are processed in the order in which they were added. The default priority is 0.
 
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak. A strong reference (the default) prevents your listener from being garbage-collected. A weak reference does not.

clear()method 
public function clear():void

configureBackBuffer()method 
public function configureBackBuffer(backBufferWidth:int, backBufferHeight:int, antiAlias:int, enableDepthAndStencil:Boolean):void

Configures the back buffer associated with the Stage3D object.

Parameters

backBufferWidth:int — The width of the backbuffer.
 
backBufferHeight:int — The height of the backbuffer.
 
antiAlias:int — The amount of anti-aliasing to use.
 
enableDepthAndStencil:Boolean — Indicates whether the back buffer contains a depth and stencil buffer.

dispose()method 
public function dispose():void

Disposes the Stage3DProxy object, freeing the Context3D attached to the Stage3D.

present()method 
public function present():void

recoverFromDisposal()method 
public function recoverFromDisposal():Boolean

Returns
Boolean
removeEventListener()method 
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Removes a listener from the EventDispatcher object. Special case for enterframe and exitframe events - will switch Stage3DProxy out of automatic render mode. If there is no matching listener registered with the EventDispatcher object, a call to this method has no effect.

Parameters

type:String — The type of event.
 
listener:Function — The listener object to remove.
 
useCapture:Boolean (default = false) — Specifies whether the listener was registered for the capture phase or the target and bubbling phases. If the listener was registered for both the capture phase and the target and bubbling phases, two calls to removeEventListener() are required to remove both, one call with useCapture() set to true, and another call with useCapture() set to false.

setProgram()method 
public function setProgram(program3D:Program3D):void

Set the shader program for the subsequent rendering calls.

Parameters

program3D:Program3D — The program to be used in the shader

setRenderTarget()method 
public function setRenderTarget(target:TextureBase, enableDepthAndStencil:Boolean = false, surfaceSelector:int = 0):void

Parameters

target:TextureBase
 
enableDepthAndStencil:Boolean (default = false)
 
surfaceSelector:int (default = 0)

setSimpleVertexBuffer()method 
public function setSimpleVertexBuffer(index:int, buffer:VertexBuffer3D, format:String, offset:int = 0):void

Assign the vertex buffer in the Context3D ready for use in the shader.

Parameters

index:int — The index for the vertex buffer setting
 
buffer:VertexBuffer3D — The Vertex Buffer
 
format:String — The format of the buffer. See Context3DVertexBufferFormat
 
offset:int (default = 0) — An offset from the start of the data

setTextureAt()method 
public function setTextureAt(index:int, texture:TextureBase):void

Assign the texture in the Context3D ready for use in the shader.

Parameters

index:int — The index where the texture is set
 
texture:TextureBase — The texture to set

Event Detail
enterFrame Event
Event Object Type: flash.events.Event

exitFrame Event  
Event Object Type: flash.events.Event