C# 클래스 Axiom.Components.Terrain.TerrainQuadTreeNode

A node in a quad tree used to store a patch of terrain.
Algorithm overview: Our goal is to perform traditional chunked LOD with geomorphing. But, instead of just dividing the terrain into tiles, we will divide them into a hierarchy of tiles, a quadtree, where any level of the quadtree can be a rendered tile (to the exclusion of its children). The idea is to collect together children into a larger batch with their siblings as LOD decreases, to improve performance. The minBatchSize and maxBatchSize parameters on Terrain a key to defining this behaviour. Both values are expressed in vertices down one axis. maxBatchSize determines the number of tiles on one side of the terrain, which is numTiles = (terrainSize-1) / (maxBatchSize-1). This in turn determines the depth of the quad tree, which is sqrt(numTiles). The minBatchSize determines the 'floor' of how low the number of vertices can go in a tile before it has to be grouped together with its siblings to drop any lower. We also do not group a tile with its siblings unless all of them are at this minimum batch size, rather than trying to group them when they all end up on the same 'middle' LOD; this is for several reasons; firstly, tiles hitting the same 'middle' LOD is less likely and more transient if they have different levels of 'roughness', and secondly since we're sharing a vertex / index pool between all tiles, only grouping at the min level means that the number of combinations of buffer sizes for any one tile is greatly simplified, making it easier to pool data. To be more specific, any tile / quadtree node can only have log2(maxBatchSize-1) - log2(minBatchSize-1) + 1 LOD levels (and if you set them to the same value, LOD can only change by going up/down the quadtree). The numbers of vertices / indices in each of these levels is constant for the same (relative) LOD index no matter where you are in the tree, therefore buffers can potentially be reused more easily.
상속: IDisposable
파일 보기 프로젝트 열기: WolfgangSt/axiom 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
DELTA_BUFFER short
POSITION_BUFFER short

보호된 프로퍼티들

프로퍼티 타입 설명
mAABB Axiom.Math.AxisAlignedBox
mBaseLod ushort
mBoundaryX ushort
mBoundaryY ushort
mBoundingRadius float
mChildWithMaxHeightDelta TerrainQuadTreeNode
mChildren TerrainQuadTreeNode[]
mCurrentLod int
mDepth ushort
mLocalCentre Vector3
mLodLevels List
mLodTransition float
mMaterialLodIndex ushort
mNodeWithVertexData TerrainQuadTreeNode
mOffsetX ushort
mOffsetY ushort
mParent TerrainQuadTreeNode
mQuadrant ushort
mRend TerrainRendable
mSelfOrChildRendered bool
mSize ushort
mTerrain Terrain
mVertexDataRecord VertexDataRecord

공개 메소드들

메소드 설명
AssignVertexData ( ushort treeDepthStart, ushort treeDepthEnd, ushort resolution, ushort sz ) : void

Assign vertex data to the tree, from a depth and at a given resolution.

CalculateCurrentLod ( Camera cam, float cFactor ) : bool

Calculate appropriate LOD for this node and children

Dispose ( ) : void

FinaliseDeltaValues ( Rectangle rect ) : void

Promote the delta values calculated to the runtime ones (this must be called in the main thread).

GetChild ( ushort child ) : TerrainQuadTreeNode

Get child node

GetLodLevel ( ushort lod ) : LodLevel

Get the LodLevel information for a given lod.

GetSquaredViewDepth ( Camera cam ) : float

GetWorldTransforms ( Matrix4 xform ) : void

Load ( ) : void

Load node and children (perform GPU tasks, will be render thread)

MergeIntoBounds ( long x, long y, Vector3 pos ) : void

Merge a point (relative to terrain node) into the local bounds, and that of children if applicable.

NotifyDelta ( ushort x, ushort y, ushort lod, float delta ) : void

Notify the node (and children) of a height delta value.

PointIntersectsNode ( long x, long y ) : bool

Returns true if the given point is in the terrain area that this node references.

PostDeltaCalculation ( Rectangle rect ) : void

Notify the node (and children) that deltas are going to be calculated for a given range.

PreDeltaCalculation ( Rectangle rect ) : void

Notify the node (and children) that deltas are going to be calculated for a given range.

Prepare ( ) : void

Prepare node and children (perform CPU tasks, may be background thread)

RectContainsNode ( Rectangle rect ) : bool

Returns true if the given rectangle completely contains the terrain area that this node references.

RectIntersectsNode ( Rectangle rect ) : bool

Returns true if the given rectangle overlaps the terrain area that this node references.

ResetBounds ( Rectangle rect ) : void

Reset the bounds of this node and all its children for the region given.

TerrainQuadTreeNode ( Axiom.Components.Terrain.Terrain terrain, TerrainQuadTreeNode parent, ushort xOff, ushort yOff, ushort size, ushort lod, ushort depth, ushort quadrant ) : System

Default constructor.

Unload ( ) : void

Unload node and children (perform GPU tasks, will be render thread)

Unprepare ( ) : void

Unprepare node and children (perform CPU tasks, may be background thread)

UpdateRenderQueue ( RenderQueue queue ) : void

UpdateVertexData ( bool positions, bool deltas, Rectangle rect, bool cpuData ) : void

Tell the node to update its vertex data for a given region.

UseAncestorVertexData ( TerrainQuadTreeNode owner, int treeDepthEnd, int resolution ) : void

Tell a node that it should use an anscestor's vertex data.

VisitRenderables ( bool debugRenderables ) : void

보호된 메소드들

메소드 설명
CalcSkirtVertexIndex ( ushort mainIndex, bool isCol ) : ushort

CreateCpuIndexData ( ) : void

CreateCpuVertexData ( ) : void

CreateGpuIndexData ( ) : void

CreateGpuVertexData ( ) : void

CreateTriangleStripBuffer ( ushort batchSize, IndexData destData ) : void

DestroyCpuIndexData ( ) : void

DestroyCpuVertexData ( ) : void

DestroyGpuIndexData ( ) : void

DestroyGpuVertexData ( ) : void

UpdateGpuVertexData ( ) : void

UpdateVertexBuffer ( HardwareVertexBuffer posBuff, HardwareVertexBuffer deltaBuf, Rectangle rect ) : void

비공개 메소드들

메소드 설명
UpdateVertexBufferr ( HardwareVertexBuffer posbuf, HardwareVertexBuffer deltabuf, Rectangle rect ) : void

메소드 상세

AssignVertexData() 공개 메소드

Assign vertex data to the tree, from a depth and at a given resolution.
public AssignVertexData ( ushort treeDepthStart, ushort treeDepthEnd, ushort resolution, ushort sz ) : void
treeDepthStart ushort
treeDepthEnd ushort The end of the depth that should use this data (exclusive)
resolution ushort The resolution of the data to use (compared to full terrain)
sz ushort The size of the data along one edge
리턴 void

CalcSkirtVertexIndex() 보호된 메소드

protected CalcSkirtVertexIndex ( ushort mainIndex, bool isCol ) : ushort
mainIndex ushort
isCol bool
리턴 ushort

CalculateCurrentLod() 공개 메소드

Calculate appropriate LOD for this node and children
public CalculateCurrentLod ( Camera cam, float cFactor ) : bool
cam Axiom.Core.Camera The camera to be used (this should already be the LOD camera)
cFactor float The cFactor which incorporates the viewport size, max pixel error and lod bias
리턴 bool

CreateCpuIndexData() 보호된 메소드

protected CreateCpuIndexData ( ) : void
리턴 void

CreateCpuVertexData() 보호된 메소드

protected CreateCpuVertexData ( ) : void
리턴 void

CreateGpuIndexData() 보호된 메소드

protected CreateGpuIndexData ( ) : void
리턴 void

CreateGpuVertexData() 보호된 메소드

protected CreateGpuVertexData ( ) : void
리턴 void

CreateTriangleStripBuffer() 보호된 메소드

protected CreateTriangleStripBuffer ( ushort batchSize, IndexData destData ) : void
batchSize ushort
destData Axiom.Graphics.IndexData
리턴 void

DestroyCpuIndexData() 보호된 메소드

protected DestroyCpuIndexData ( ) : void
리턴 void

DestroyCpuVertexData() 보호된 메소드

protected DestroyCpuVertexData ( ) : void
리턴 void

DestroyGpuIndexData() 보호된 메소드

protected DestroyGpuIndexData ( ) : void
리턴 void

DestroyGpuVertexData() 보호된 메소드

protected DestroyGpuVertexData ( ) : void
리턴 void

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

FinaliseDeltaValues() 공개 메소드

Promote the delta values calculated to the runtime ones (this must be called in the main thread).
public FinaliseDeltaValues ( Rectangle rect ) : void
rect Axiom.Core.Rectangle
리턴 void

GetChild() 공개 메소드

Get child node
public GetChild ( ushort child ) : TerrainQuadTreeNode
child ushort
리턴 TerrainQuadTreeNode

GetLodLevel() 공개 메소드

Get the LodLevel information for a given lod.
public GetLodLevel ( ushort lod ) : LodLevel
lod ushort /// The lod level index relative to this classes own list; if you /// want to use a global lod level, subtract getBaseLod() first. Higher /// LOD levels are lower detail. ///
리턴 LodLevel

GetSquaredViewDepth() 공개 메소드

public GetSquaredViewDepth ( Camera cam ) : float
cam Axiom.Core.Camera
리턴 float

GetWorldTransforms() 공개 메소드

public GetWorldTransforms ( Matrix4 xform ) : void
xform Axiom.Math.Matrix4
리턴 void

Load() 공개 메소드

Load node and children (perform GPU tasks, will be render thread)
public Load ( ) : void
리턴 void

MergeIntoBounds() 공개 메소드

Merge a point (relative to terrain node) into the local bounds, and that of children if applicable.
public MergeIntoBounds ( long x, long y, Vector3 pos ) : void
x long The point on the terrain to which this position corresponds /// (affects which nodes update their bounds)
y long The point on the terrain to which this position corresponds /// (affects which nodes update their bounds)
pos Vector3 The position relative to the terrain centre
리턴 void

NotifyDelta() 공개 메소드

Notify the node (and children) of a height delta value.
public NotifyDelta ( ushort x, ushort y, ushort lod, float delta ) : void
x ushort
y ushort
lod ushort
delta float
리턴 void

PointIntersectsNode() 공개 메소드

Returns true if the given point is in the terrain area that this node references.
public PointIntersectsNode ( long x, long y ) : bool
x long The point in top-level terrain coords
y long The point in top-level terrain coords
리턴 bool

PostDeltaCalculation() 공개 메소드

Notify the node (and children) that deltas are going to be calculated for a given range.
public PostDeltaCalculation ( Rectangle rect ) : void
rect Axiom.Core.Rectangle
리턴 void

PreDeltaCalculation() 공개 메소드

Notify the node (and children) that deltas are going to be calculated for a given range.
public PreDeltaCalculation ( Rectangle rect ) : void
rect Axiom.Core.Rectangle
리턴 void

Prepare() 공개 메소드

Prepare node and children (perform CPU tasks, may be background thread)
public Prepare ( ) : void
리턴 void

RectContainsNode() 공개 메소드

Returns true if the given rectangle completely contains the terrain area that this node references.
public RectContainsNode ( Rectangle rect ) : bool
rect Axiom.Core.Rectangle The region in top-level terrain coords
리턴 bool

RectIntersectsNode() 공개 메소드

Returns true if the given rectangle overlaps the terrain area that this node references.
public RectIntersectsNode ( Rectangle rect ) : bool
rect Axiom.Core.Rectangle The region in top-level terrain coords
리턴 bool

ResetBounds() 공개 메소드

Reset the bounds of this node and all its children for the region given.
public ResetBounds ( Rectangle rect ) : void
rect Axiom.Core.Rectangle The region for which bounds should be reset, in top-level terrain coords
리턴 void

TerrainQuadTreeNode() 공개 메소드

Default constructor.
public TerrainQuadTreeNode ( Axiom.Components.Terrain.Terrain terrain, TerrainQuadTreeNode parent, ushort xOff, ushort yOff, ushort size, ushort lod, ushort depth, ushort quadrant ) : System
terrain Axiom.Components.Terrain.Terrain The ultimate parent terrain
parent TerrainQuadTreeNode ptional parent node (in which case xoff, yoff are 0 and size must be entire terrain)
xOff ushort Offsets from the start of the terrain data in 2D
yOff ushort Offsets from the start of the terrain data in 2D
size ushort The size of the node in vertices at the highest LOD
lod ushort The base LOD level
depth ushort The depth that this node is at in the tree (or convenience)
quadrant ushort The index of the quadrant (0, 1, 2, 3)
리턴 System

Unload() 공개 메소드

Unload node and children (perform GPU tasks, will be render thread)
public Unload ( ) : void
리턴 void

Unprepare() 공개 메소드

Unprepare node and children (perform CPU tasks, may be background thread)
public Unprepare ( ) : void
리턴 void

UpdateGpuVertexData() 보호된 메소드

protected UpdateGpuVertexData ( ) : void
리턴 void

UpdateRenderQueue() 공개 메소드

public UpdateRenderQueue ( RenderQueue queue ) : void
queue Axiom.Graphics.RenderQueue
리턴 void

UpdateVertexBuffer() 보호된 메소드

protected UpdateVertexBuffer ( HardwareVertexBuffer posBuff, HardwareVertexBuffer deltaBuf, Rectangle rect ) : void
posBuff Axiom.Graphics.HardwareVertexBuffer
deltaBuf Axiom.Graphics.HardwareVertexBuffer
rect Axiom.Core.Rectangle
리턴 void

UpdateVertexData() 공개 메소드

Tell the node to update its vertex data for a given region.
public UpdateVertexData ( bool positions, bool deltas, Rectangle rect, bool cpuData ) : void
positions bool
deltas bool
rect Axiom.Core.Rectangle
cpuData bool
리턴 void

UseAncestorVertexData() 공개 메소드

Tell a node that it should use an anscestor's vertex data.
public UseAncestorVertexData ( TerrainQuadTreeNode owner, int treeDepthEnd, int resolution ) : void
owner TerrainQuadTreeNode
treeDepthEnd int The end of the depth that should use this data (exclusive)
resolution int The resolution of the data to use
리턴 void

VisitRenderables() 공개 메소드

public VisitRenderables ( bool debugRenderables ) : void
debugRenderables bool
리턴 void

프로퍼티 상세

DELTA_BUFFER 공개적으로 정적으로 프로퍼티

Buffer binding used for holding delta values
public static short DELTA_BUFFER
리턴 short

POSITION_BUFFER 공개적으로 정적으로 프로퍼티

Buffer binding used for holding positions.
public static short POSITION_BUFFER
리턴 short

mAABB 보호되어 있는 프로퍼티

relative to mLocalCentre
protected AxisAlignedBox,Axiom.Math mAABB
리턴 Axiom.Math.AxisAlignedBox

mBaseLod 보호되어 있는 프로퍼티

protected ushort mBaseLod
리턴 ushort

mBoundaryX 보호되어 있는 프로퍼티

protected ushort mBoundaryX
리턴 ushort

mBoundaryY 보호되어 있는 프로퍼티

protected ushort mBoundaryY
리턴 ushort

mBoundingRadius 보호되어 있는 프로퍼티

relative to mLocalCentre
protected float mBoundingRadius
리턴 float

mChildWithMaxHeightDelta 보호되어 있는 프로퍼티

The child with the largest height delta
protected TerrainQuadTreeNode mChildWithMaxHeightDelta
리턴 TerrainQuadTreeNode

mChildren 보호되어 있는 프로퍼티

protected TerrainQuadTreeNode[] mChildren
리턴 TerrainQuadTreeNode[]

mCurrentLod 보호되어 있는 프로퍼티

-1 = none (do not render)
protected int mCurrentLod
리턴 int

mDepth 보호되어 있는 프로퍼티

protected ushort mDepth
리턴 ushort

mLocalCentre 보호되어 있는 프로퍼티

relative to terrain centre
protected Vector3 mLocalCentre
리턴 Vector3

mLodLevels 보호되어 있는 프로퍼티

protected List mLodLevels
리턴 List

mLodTransition 보호되어 있는 프로퍼티

// 0-1 transition to lower LOD
protected float mLodTransition
리턴 float

mMaterialLodIndex 보호되어 있는 프로퍼티

protected ushort mMaterialLodIndex
리턴 ushort

mNodeWithVertexData 보호되어 있는 프로퍼티

protected TerrainQuadTreeNode mNodeWithVertexData
리턴 TerrainQuadTreeNode

mOffsetX 보호되어 있는 프로퍼티

protected ushort mOffsetX
리턴 ushort

mOffsetY 보호되어 있는 프로퍼티

protected ushort mOffsetY
리턴 ushort

mParent 보호되어 있는 프로퍼티

protected TerrainQuadTreeNode mParent
리턴 TerrainQuadTreeNode

mQuadrant 보호되어 있는 프로퍼티

protected ushort mQuadrant
리턴 ushort

mRend 보호되어 있는 프로퍼티

protected TerrainRendable mRend
리턴 TerrainRendable

mSelfOrChildRendered 보호되어 있는 프로퍼티

protected bool mSelfOrChildRendered
리턴 bool

mSize 보호되어 있는 프로퍼티

protected ushort mSize
리턴 ushort

mTerrain 보호되어 있는 프로퍼티

protected Terrain mTerrain
리턴 Terrain

mVertexDataRecord 보호되어 있는 프로퍼티

protected VertexDataRecord mVertexDataRecord
리턴 VertexDataRecord