Moai SDK
1.5 revision 1 (MoaiEdition)
|
Inherits MOAILuaObject.
Function List | |
clear | |
insertProp | |
propForPoint | |
propForRay | |
propListForPoint | |
propListForRay | |
propListForRect | |
removeProp | |
reserveLevels | |
setLevel | |
setPlane |
Remove all props from the partition.
function clear ( MOAIPartition self )
self | ( MOAIPartition ) |
Inserts a prop into the partition. A prop can only be in one partition at a time.
function insertProp ( MOAIPartition self, MOAIProp prop )
self | ( MOAIPartition ) |
prop | ( MOAIProp ) |
Returns the prop with the highest priority that contains the given world space point.
function propForPoint ( MOAIPartition self, number x, number y, number z [, number sortMode, number xScale, number yScale, number zScale, number priorityScale ] )
self | ( MOAIPartition ) |
x | ( number ) |
y | ( number ) |
z | ( number ) |
sortMode | ( number ) Optional. One of the MOAILayer sort modes. Default value is SORT_PRIORITY_ASCENDING. |
xScale | ( number ) Optional. X scale for vector sort. Default value is 0. |
yScale | ( number ) Optional. Y scale for vector sort. Default value is 0. |
zScale | ( number ) Optional. Z scale for vector sort. Default value is 0. |
priorityScale | ( number ) Optional. Priority scale for vector sort. Default value is 1. |
Returns the prop closest to the camera that intersects the given ray.
function propForRay ( MOAIPartition self, number x, number y, number z, number xdirection, number ydirection, number zdirection )
self | ( MOAIPartition ) |
x | ( number ) |
y | ( number ) |
z | ( number ) |
xdirection | ( number ) |
ydirection | ( number ) |
zdirection | ( number ) |
Returns all props under a given world space point.
function propListForPoint ( MOAIPartition self, number x, number y, number z [, number sortMode, number xScale, number yScale, number zScale, number priorityScale ] )
self | ( MOAIPartition ) |
x | ( number ) |
y | ( number ) |
z | ( number ) |
sortMode | ( number ) Optional. One of the MOAILayer sort modes. Default value is SORT_NONE. |
xScale | ( number ) Optional. X scale for vector sort. Default value is 0. |
yScale | ( number ) Optional. Y scale for vector sort. Default value is 0. |
zScale | ( number ) Optional. Z scale for vector sort. Default value is 0. |
priorityScale | ( number ) Optional. Priority scale for vector sort. Default value is 1. |
Returns all props under a given world space point.
function propListForRay ( MOAIPartition self, number x, number y, number z, number xdirection, number ydirection, number zdirection [, number sortMode, number xScale, number yScale, number zScale, number priorityScale ] )
self | ( MOAIPartition ) |
x | ( number ) |
y | ( number ) |
z | ( number ) |
xdirection | ( number ) |
ydirection | ( number ) |
zdirection | ( number ) |
sortMode | ( number ) Optional. One of the MOAILayer sort modes. Default value is SORT_KEY_ASCENDING. |
xScale | ( number ) Optional. X scale for vector sort. Default value is 0. |
yScale | ( number ) Optional. Y scale for vector sort. Default value is 0. |
zScale | ( number ) Optional. Z scale for vector sort. Default value is 0. |
priorityScale | ( number ) Optional. Priority scale for vector sort. Default value is 1. |
Returns all props under a given world space rect.
function propListForRect ( MOAIPartition self, number xMin, number yMin, number xMax, number yMax [, number sortMode, number xScale, number yScale, number zScale, number priorityScale ] )
self | ( MOAIPartition ) |
xMin | ( number ) |
yMin | ( number ) |
xMax | ( number ) |
yMax | ( number ) |
sortMode | ( number ) Optional. One of the MOAILayer sort modes. Default value is SORT_NONE. |
xScale | ( number ) Optional. X scale for vector sort. Default value is 0. |
yScale | ( number ) Optional. Y scale for vector sort. Default value is 0. |
zScale | ( number ) Optional. Z scale for vector sort. Default value is 0. |
priorityScale | ( number ) Optional. Priority scale for vector sort. Default value is 1. |
Removes a prop from the partition.
function removeProp ( MOAIPartition self, MOAIProp prop )
self | ( MOAIPartition ) |
prop | ( MOAIProp ) |
Reserves a stack of levels in the partition. Levels must be initialized with setLevel (). This will trigger a full rebuild of the partition if it contains any props.
function reserveLevels ( MOAIPartition self, number nLevels )
self | ( MOAIPartition ) |
nLevels | ( number ) |
Initializes a level previously created by reserveLevels (). This will trigger a full rebuild of the partition if it contains any props. Each level is a loose grid. Props of a given size may be placed by the system into any level with cells large enough to accommodate them. The dimensions of a level control how many cells the level contains. If an object goes off of the edge of a level, it will wrap around to the other side. It is possible to model a quad tree by initializing levels correctly, but for some simulations better structures may be possible.
function setLevel ( MOAIPartition self, number levelID, number cellSize, number xCells, number yCells )
self | ( MOAIPartition ) |
levelID | ( number ) |
cellSize | ( number ) Dimensions of the layer's cells. |
xCells | ( number ) Width of layer in cells. |
yCells | ( number ) Height of layer in cells. |
Selects the plane the partition will use. If this is different from the current plane then all non-global props will be redistributed. Redistribution works by moving all props to the 'empties' cell and then scheduling them all for a dep node update (which refreshes the prop's bounds and may also flag it as global).
function setPlane ( MOAIPartition self, number planeID )
self | ( MOAIPartition ) |
planeID | ( number ) One of MOAIPartition::PLANE_XY, MOAIPartition::PLANE_XZ, MOAIPartition::PLANE_YZ. Default value is MOAIPartition::PLANE_XY. |