Moai SDK  1.5 revision 1 (MoaiEdition)
MOAILayer Class Reference
Inheritance diagram for MOAILayer:
MOAIProp MOAITransform MOAIColor MOAIRenderable MOAITransform MOAIColor MOAIRenderable MOAITransformBase MOAINode MOAITransformBase MOAINode MOAINode MOAIInstanceEventSource MOAINode MOAIInstanceEventSource MOAIInstanceEventSource MOAIEventSource MOAIInstanceEventSource MOAIEventSource MOAIEventSource MOAIEventSource

List of all members.

Function List

  clear
  getFitting
  getPartition
  getSortMode
  getSortScale
  insertProp
  removeProp
  setBox2DWorld
  setCamera
  setCpSpace
  setParallax
  setPartition
  setPartitionCull2D
  setSortMode
  setSortScale
  setViewport
  showDebugLines
  wndToWorld
  worldToWnd

Function Documentation

Remove all props from the layer's partition.


function clear ( MOAILayer self )
Parameters:
self ( MOAILayer )
Returns:
nil

Computes a camera fitting for a given world rect along with an optional screen space padding. To do a fitting, compute the world rect based on whatever you are fitting to, use this method to get the fitting, then animate the camera to match.


function getFitting ( MOAILayer self, number xMin, number yMin, number xMax, number yMax [, number xPad, number yPad ] )
Parameters:
self ( MOAILayer )
xMin ( number )
yMin ( number )
xMax ( number )
yMax ( number )
xPad ( number ) Optional.
yPad ( number ) Optional.
Returns:
x ( number ), y ( number ), s ( number )

Returns the partition (if any) currently attached to this layer.


function getPartition ( MOAILayer self )
Parameters:
self ( MOAILayer )
Returns:
partition ( MOAIPartition )

Get the sort mode for rendering.


function getSortMode ( MOAILayer self )
Parameters:
self ( MOAILayer )
Returns:
sortMode ( number )

Return the scalar applied to axis sorts.


function getSortScale ( MOAILayer2D self )
Parameters:
self ( MOAILayer2D )
Returns:
x ( number ), y ( number ), priority ( number )

Adds a prop to the layer's partition.


function insertProp ( MOAILayer self, MOAIProp prop )
Parameters:
self ( MOAILayer )
prop ( MOAIProp )
Returns:
nil

Removes a prop from the layer's partition.


function removeProp ( MOAILayer self, MOAIProp prop )
Parameters:
self ( MOAILayer )
prop ( MOAIProp )
Returns:
nil

Sets a Box2D world for debug drawing.


function setBox2DWorld ( MOAILayer self, MOAIBox2DWorld world )
Parameters:
self ( MOAILayer )
world ( MOAIBox2DWorld )
Returns:
nil

Sets a camera for the layer. If no camera is supplied, layer will render using the identity matrix as view/proj.


function setCamera ( MOAILayer self [, MOAICamera camera ] )
Parameters:
self ( MOAILayer )
camera ( MOAICamera ) Optional. Default value is nil.
Returns:
nil
Note:

function setCamera ( MOAILayer self [, MOAICamera2D camera ] )
Parameters:
self ( MOAILayer )
camera ( MOAICamera2D ) Optional. Default value is nil.
Returns:
nil
Note:

Sets a Chipmunk space for debug drawing.


function setCpSpace ( MOAILayer self, MOAICpSpace space )
Parameters:
self ( MOAILayer )
space ( MOAICpSpace )
Returns:
nil

Sets the parallax scale for this layer. This is simply a scalar applied to the view transform before rendering.


function setParallax ( MOAILayer self [, number xParallax, number yParallax, number zParallax ] )
Parameters:
self ( MOAILayer )
xParallax ( number ) Optional. Default value is 1.
yParallax ( number ) Optional. Default value is 1.
zParallax ( number ) Optional. Default value is 1.
Returns:
nil

Sets a partition for the layer to use. The layer will automatically create a partition when the first prop is added if no partition has been set.


function setPartition ( MOAILayer self, MOAIPartition partition )
Parameters:
self ( MOAILayer )
partition ( MOAIPartition )
Returns:
nil

Enables 2D partition cull (projection of frustum AABB will be used instead of AABB or frustum).


function setPartitionCull2D ( MOAILayer self, boolean partitionCull2D )
Parameters:
self ( MOAILayer )
partitionCull2D ( boolean ) Default value is false.
Returns:
nil

Set the sort mode for rendering.


function setSortMode ( MOAILayer self, number sortMode )
Parameters:
self ( MOAILayer )
sortMode ( number ) One of MOAILayer.SORT_NONE, MOAILayer.SORT_PRIORITY_ASCENDING, MOAILayer.SORT_PRIORITY_DESCENDING, MOAILayer.SORT_X_ASCENDING, MOAILayer.SORT_X_DESCENDING, MOAILayer.SORT_Y_ASCENDING, MOAILayer.SORT_Y_DESCENDING, MOAILayer.SORT_Z_ASCENDING, MOAILayer.SORT_Z_DESCENDING
Returns:
nil

Set the scalar applied to axis sorts.


function setSortScale ( MOAILayer self [, number x, number y, number z, number priority ] )
Parameters:
self ( MOAILayer )
x ( number ) Optional. Default value is 0.
y ( number ) Optional. Default value is 0.
z ( number ) Optional. Default value is 0.
priority ( number ) Optional. Default value is 1.
Returns:
nil

Set the layer's viewport.


function setViewport ( MOAILayer self, MOAIViewport viewport )
Parameters:
self ( MOAILayer )
viewport ( MOAIViewport )
Returns:
nil

Display debug lines for props in this layer.


function showDebugLines ( MOAILayer self [, boolean showDebugLines ] )
Parameters:
self ( MOAILayer )
showDebugLines ( boolean ) Optional. Default value is 'true'.
Returns:
nil

Project a point from window space into world space and return a normal vector representing a ray cast from the point into the world away from the camera (suitable for 3D picking).


function wndToWorld ( MOAILayer self, number x, number y, number z )
Parameters:
self ( MOAILayer )
x ( number )
y ( number )
z ( number )
Returns:
x ( number ), y ( number ), z ( number ), xn ( number ), yn ( number ), zn ( number )

Transform a point from world space to window space.


function worldToWnd ( MOAILayer self, number x, number y, number Z )
Parameters:
self ( MOAILayer )
x ( number )
y ( number )
Z ( number )
Returns:
x ( number ), y ( number ), z ( number )