C# Class Axiom.Components.Paging.Grid2DPageStrategyData

Specialisation of PageStrategyData for GridPageStrategy.
Structurally this data defines with a grid of pages, with the logical origin in the middle of the entire grid. The grid cells are indexed from 0 as a 'centre' slot, supporting both positive and negative values. so (0,0) is the centre cell, (1,0) is the cell to the right of the centre, (1,0) is the cell above the centre, (-2,1) is the cell two to the left of the centre and one up, etc. The maximum extent of each axis is -32768 to +32767, so in other words enough for over 4 billion entries. @par To limit the page load requests that are generated to a fixed region, you can set the min and max cell indexes (inclusive)for each direction; if a page request would address a cell outside this range it is ignored so you don't have the expense of checking for page data that will never exist. @par The data format for this in a file is:
Grid2DPageStrategyData (Identifier 'G2DD')\n [Version 1]
Name Type Description
Grid orientation byte The orientation of the grid; XZ = 0, XY = 1, YZ = 2
Grid origin Vector3 World origin of the grid.
Grid cell size Real The size of each cell (page) in the grid
Grid cell range (minx, maxx, miny, maxy) short * 4 The extents of the world in cell indexes
Load radius Real The outer radius at which new pages should start loading
Hold radius Real The radius at which existing pages should be held if already loaded but not actively loaded (should be larger than Load radius)
Inheritance: IPageStrategyData
ファイルを表示 Open project: WolfgangSt/axiom

Public Properties

Property Type Description
CHUNK_ID uint
CHUNK_VERSION ushort

Protected Properties

Property Type Description
mBottomLeft Vector2
mCellSize float
mGridExtentsHorz int
mGridExtentsVert int
mHoldRadius float
mHoldRadiusInCells float
mLoadRadius float
mLoadRadiusInCells float
mMode Grid2Mode
mOrigin Vector2
mWorldOrigin Vector3

Public Methods

Method Description
CalculatePageID ( int row, int col ) : PageID

CalculateRowCol ( PageID inPageID, int &row, int &col ) : void

ConvertGridToWorldSpace ( Vector2 grid, Vector3 &world ) : void

Convert a grid point to world space - note only 2 axes populated

ConvetWorldToGridSpace ( Vector3 world, Vector2 &grid ) : void

Convert a world point to grid space (not relative to origin)

DetermineGridLocation ( Vector2 gridPos, int &row, int &col ) : void

Convert a grid position into a row and column index

GetBottomLeftGridSpace ( int row, int col, Vector2 &bl ) : void

Get the (grid space) corners of a cell.

GetCornersGridSpace ( int row, int col, Vector2 &fourPoints ) : void

GetMidPointGridSpace ( int row, int col, Vector2 &mid ) : void

Get the (grid space) mid point of a cell

Grid2DPageStrategyData ( ) : System

Load ( StreamSerializer stream ) : bool

Load this data from a stream (returns true if successful)

Save ( StreamSerializer stream ) : void

Save this data to a stream

SetCellCount ( int horz, int vert ) : void

Set the number of cells in the grid in each dimension (defaults to max of 65536)

Protected Methods

Method Description
UpdateDerivedMetrics ( ) : void

Method Details

CalculatePageID() public method

public CalculatePageID ( int row, int col ) : PageID
row int
col int
return PageID

CalculateRowCol() public method

public CalculateRowCol ( PageID inPageID, int &row, int &col ) : void
inPageID PageID
row int
col int
return void

ConvertGridToWorldSpace() public method

Convert a grid point to world space - note only 2 axes populated
public ConvertGridToWorldSpace ( Vector2 grid, Vector3 &world ) : void
grid Vector2
world Vector3
return void

ConvetWorldToGridSpace() public method

Convert a world point to grid space (not relative to origin)
public ConvetWorldToGridSpace ( Vector3 world, Vector2 &grid ) : void
world Vector3
grid Vector2
return void

DetermineGridLocation() public method

Convert a grid position into a row and column index
public DetermineGridLocation ( Vector2 gridPos, int &row, int &col ) : void
gridPos Vector2
row int
col int
return void

GetBottomLeftGridSpace() public method

Get the (grid space) corners of a cell.
public GetBottomLeftGridSpace ( int row, int col, Vector2 &bl ) : void
row int
col int
bl Vector2
return void

GetCornersGridSpace() public method

public GetCornersGridSpace ( int row, int col, Vector2 &fourPoints ) : void
row int
col int
fourPoints Vector2
return void

GetMidPointGridSpace() public method

Get the (grid space) mid point of a cell
public GetMidPointGridSpace ( int row, int col, Vector2 &mid ) : void
row int
col int
mid Vector2
return void

Grid2DPageStrategyData() public method

public Grid2DPageStrategyData ( ) : System
return System

Load() public method

Load this data from a stream (returns true if successful)
public Load ( StreamSerializer stream ) : bool
stream Axiom.Serialization.StreamSerializer
return bool

Save() public method

Save this data to a stream
public Save ( StreamSerializer stream ) : void
stream Axiom.Serialization.StreamSerializer
return void

SetCellCount() public method

Set the number of cells in the grid in each dimension (defaults to max of 65536)
public SetCellCount ( int horz, int vert ) : void
horz int
vert int
return void

UpdateDerivedMetrics() protected method

protected UpdateDerivedMetrics ( ) : void
return void

Property Details

CHUNK_ID public_oe static_oe property

public static uint CHUNK_ID
return uint

CHUNK_VERSION public_oe static_oe property

public static ushort CHUNK_VERSION
return ushort

mBottomLeft protected_oe property

Bottom-left position (grid-aligned world space)
protected Vector2 mBottomLeft
return Vector2

mCellSize protected_oe property

Grid cell (page) size.
protected float mCellSize
return float

mGridExtentsHorz protected_oe property

Grid horizontal extent in cells
protected int mGridExtentsHorz
return int

mGridExtentsVert protected_oe property

Grid vertical extent in cells
protected int mGridExtentsVert
return int

mHoldRadius protected_oe property

hold radius.
protected float mHoldRadius
return float

mHoldRadiusInCells protected_oe property

protected float mHoldRadiusInCells
return float

mLoadRadius protected_oe property

Load radius
protected float mLoadRadius
return float

mLoadRadiusInCells protected_oe property

protected float mLoadRadiusInCells
return float

mMode protected_oe property

Orientation of the grid.
protected Grid2Mode mMode
return Grid2Mode

mOrigin protected_oe property

Origin (grid-aligned world space)
protected Vector2 mOrigin
return Vector2

mWorldOrigin protected_oe property

Origin (world space)
protected Vector3 mWorldOrigin
return Vector3