# DXGfxLib.TerrainTile Class Reference

TerrainTile class is used by the terrain class. A terrain is built of a multitude of terraintile. TerrainTile derives from SceneObject, it has bounding information, and frustrum culling will be performed to know if the tile need to be rendered or not! You should not have to mess directly with Terrain tiles, this is why this class is marked as internal. Also if one day this assembly would need to be obfuscated, this would help obfuscation tools perform a better obfuscation. More...

Inherits DXGfxLib::MeshObject, and DXGfxLib::MeshObject.

Collaboration diagram for DXGfxLib.TerrainTile:

[legend]

List of all members.

## Public Member Functions
override void | Dispose ()
| Will dispose all resources used by the terrain tile.
override void | SetEffectsValues (Device d3ddevice, Effect eff, int pass)
| Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.
override void | Draw (Device d3ddevice)
| Actual rendering of the tile. As always for the render method and as for the attach method, that method is called when needed on objects by the scene manager.
override void | AttachForRendering (Frustrum frustrum, List< IDrawable > objectsToBeRendered)
| When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.
override void | Update (Frustrum frustrum, float elapsedTime, double appTime, List< IDrawable > objectsToBeRendered)
| This is the method that should be called by any external code willing to update the scene. When looking in the details this method does ask the nodes to update and then call the AttachForRendering method that will add SceneObjects to the list of objets to be rendered.
float | GetHeigth (float x, float z)
| If the x and z is above the terrain tile you will get the associated terrain heigth.
float | GetHeigth (float x, float y, float z)
| If the x y and z is above the terrain tile you will get the associated terrain heigth.
float | GetHeigth (Vector3 underPoint)
| Get the heigth of the tile under the point given in parameter. If the point is under the terrain level at that x and z 65536 is returned.
BBox | CalculateBBox ()
| Calculate the bounding box for the terrain tile, same remark as for the bounding sphere.
override bool | Intersect (Vector3 rayPos, Vector3 rayDir, out IntersectInformation closestHit)
| This will determine if the ray intersect with the tile and where!
void | AddInstances (FrameworkMesh mesh, InstanceInfo[] instancesInfo)
override void | Dispose ()
| Will dispose all resources used by the terrain tile.
override void | SetEffectsValues (Device d3ddevice, Effect eff, int pass)
| Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.
override void | Draw (Device d3ddevice)
| Actual rendering of the tile. As always for the render method and as for the attach method, that method is called when needed on objects by the scene manager.
override void | AttachForRendering (Frustrum frustrum, List< IDrawable > objectsToBeRendered)
| When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.
override void | Update (Frustrum frustrum, float elapsedTime, double appTime, List< IDrawable > objectsToBeRendered)
| This is the method that should be called by any external code willing to update the scene. When looking in the details this method does ask the nodes to update and then call the AttachForRendering method that will add SceneObjects to the list of objets to be rendered.
float | GetHeigth (float x, float z)
| If the x and z is above the terrain tile you will get the associated terrain heigth.
float | GetHeigth (float x, float y, float z)
| If the x y and z is above the terrain tile you will get the associated terrain heigth.
float | GetHeigth (Vector3 underPoint)
| Get the heigth of the tile under the point given in parameter. If the point is under the terrain level at that x and z 65536 is returned.
BBox | CalculateBBox ()
| Calculate the bounding box for the terrain tile, same remark as for the bounding sphere.
override bool | Intersect (Vector3 rayPos, Vector3 rayDir, out IntersectInformation closestHit)
| This will determine if the ray intersect with the tile and where!
void | AddInstances (FrameworkMesh mesh, InstanceInfo[] instancesInfo)
## Public Attributes
bool | far = false
Mesh | collMesh = null
| We keep another mesh object to keep vertex information for this tile and that will be used by DX functions calculating intersection. This allow us to perform intersection queries without affecting rendering.
Texture | texture = null
Material | material
float | maxTerrainHeigth
float | minTerrainHeigth
float | secondTexHeigth
Texture | secondTexture = null
int | width
int | heigth
float | spacing
float | stretchFactor
List< Batch > | batches
## Static Public Attributes
static int | settedPass = -1
| We use this variable to know for which pass render state values are currently setted!
static float | near = 500.0f
| Below this value the object is judge near to the camera.
static float | mid = 700.0f
| Above near and below mid the object is at 'mid' distance to the view point.
## Protected Attributes
Mesh | localMemMesh = null
int | currentTriCount = 0
IndexBuffer | currentIndexBuff = null
bool | useLOD = false
int | LOD2TriCount = 0
IndexBuffer | indexBuffLOD2 = null
int | LOD3TriCount = 0
IndexBuffer | indexBuffLOD3 = null

## Detailed Description

TerrainTile class is used by the terrain class. A terrain is built of a multitude of terraintile. TerrainTile derives from SceneObject, it has bounding information, and frustrum culling will be performed to know if the tile need to be rendered or not! You should not have to mess directly with Terrain tiles, this is why this class is marked as internal. Also if one day this assembly would need to be obfuscated, this would help obfuscation tools perform a better obfuscation.

Definition at line 50 of file TerrainTile.cs.

## Member Function Documentation

void DXGfxLib.TerrainTile.AddInstances | ( | FrameworkMesh | mesh,
|  | InstanceInfo[] | instancesInfo |
| ) |  |  |

Definition at line 610 of file TerrainTile.cs.

void DXGfxLib.TerrainTile.AddInstances | ( | FrameworkMesh | mesh,
|  | InstanceInfo[] | instancesInfo |
| ) |  |  |

Definition at line 610 of file TerrainTile.cs.

Here is the caller graph for this function:

override void DXGfxLib.TerrainTile.AttachForRendering | ( | Frustrum | frustrum,
|  | List< IDrawable > | objectsToBeRendered |
| ) |  |  | `[virtual]`

When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.

Parameters:

  | frustrum |
  | objectsToBeRendered |

Reimplemented from DXGfxLib.SceneObject.

Definition at line 450 of file TerrainTile.cs.

Here is the call graph for this function:

override void DXGfxLib.TerrainTile.AttachForRendering | ( | Frustrum | frustrum,
|  | List< IDrawable > | objectsToBeRendered |
| ) |  |  | `[virtual]`

When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.

Parameters:

  | frustrum |
  | objectsToBeRendered |

Reimplemented from DXGfxLib.SceneObject.

Definition at line 450 of file TerrainTile.cs.

Here is the call graph for this function:

BBox DXGfxLib.TerrainTile.CalculateBBox | ( |  | ) |

Calculate the bounding box for the terrain tile, same remark as for the bounding sphere.

Returns:

Definition at line 566 of file TerrainTile.cs.

Here is the call graph for this function:

BBox DXGfxLib.TerrainTile.CalculateBBox | ( |  | ) |

Calculate the bounding box for the terrain tile, same remark as for the bounding sphere.

Returns:

Definition at line 566 of file TerrainTile.cs.

Here is the call graph for this function:

override void DXGfxLib.TerrainTile.Dispose | ( |  | ) | `[virtual]`

Will dispose all resources used by the terrain tile.

Reimplemented from DXGfxLib.SceneObject.

Definition at line 136 of file TerrainTile.cs.

Here is the call graph for this function:

override void DXGfxLib.TerrainTile.Dispose | ( |  | ) | `[virtual]`

Will dispose all resources used by the terrain tile.

Reimplemented from DXGfxLib.SceneObject.

Definition at line 136 of file TerrainTile.cs.

Here is the call graph for this function:

override void DXGfxLib.TerrainTile.Draw | ( | Device | d3ddevice | ) | `[virtual]`

Actual rendering of the tile. As always for the render method and as for the attach method, that method is called when needed on objects by the scene manager.

Reimplemented from DXGfxLib.MeshObject.

Definition at line 170 of file TerrainTile.cs.

override void DXGfxLib.TerrainTile.Draw | ( | Device | d3ddevice | ) | `[virtual]`

Actual rendering of the tile. As always for the render method and as for the attach method, that method is called when needed on objects by the scene manager.

Reimplemented from DXGfxLib.MeshObject.

Definition at line 170 of file TerrainTile.cs.

float DXGfxLib.TerrainTile.GetHeigth | ( | Vector3 | underPoint | ) |

Get the heigth of the tile under the point given in parameter. If the point is under the terrain level at that x and z 65536 is returned.

Parameters:

  | underPoint |

Returns:

Definition at line 550 of file TerrainTile.cs.

float DXGfxLib.TerrainTile.GetHeigth | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  |

If the x y and z is above the terrain tile you will get the associated terrain heigth.

Parameters:

  | x |
  | z |

Returns:

Definition at line 531 of file TerrainTile.cs.

float DXGfxLib.TerrainTile.GetHeigth | ( | float | x,
|  | float | z |
| ) |  |  |

If the x and z is above the terrain tile you will get the associated terrain heigth.

Parameters:

  | x |
  | z |

Returns:

Definition at line 511 of file TerrainTile.cs.

float DXGfxLib.TerrainTile.GetHeigth | ( | Vector3 | underPoint | ) |

Get the heigth of the tile under the point given in parameter. If the point is under the terrain level at that x and z 65536 is returned.

Parameters:

  | underPoint |

Returns:

Definition at line 550 of file TerrainTile.cs.

float DXGfxLib.TerrainTile.GetHeigth | ( | float | x,
|  | float | y,
|  | float | z |
| ) |  |  |

If the x y and z is above the terrain tile you will get the associated terrain heigth.

Parameters:

  | x |
  | z |

Returns:

Definition at line 531 of file TerrainTile.cs.

float DXGfxLib.TerrainTile.GetHeigth | ( | float | x,
|  | float | z |
| ) |  |  |

If the x and z is above the terrain tile you will get the associated terrain heigth.

Parameters:

  | x |
  | z |

Returns:

Definition at line 511 of file TerrainTile.cs.

Here is the caller graph for this function:

override bool DXGfxLib.TerrainTile.Intersect | ( | Vector3 | rayPos,
|  | Vector3 | rayDir,
|  | out IntersectInformation | closestHit |
| ) |  |  | `[virtual]`

This will determine if the ray intersect with the tile and where!

Parameters:

  | rayPos |
  | rayDir |
  | closestHit |

Returns:

Reimplemented from DXGfxLib.MeshObject.

Definition at line 595 of file TerrainTile.cs.

override bool DXGfxLib.TerrainTile.Intersect | ( | Vector3 | rayPos,
|  | Vector3 | rayDir,
|  | out IntersectInformation | closestHit |
| ) |  |  | `[virtual]`

This will determine if the ray intersect with the tile and where!

Parameters:

  | rayPos |
  | rayDir |
  | closestHit |

Returns:

Reimplemented from DXGfxLib.MeshObject.

Definition at line 595 of file TerrainTile.cs.

Here is the caller graph for this function:

override void DXGfxLib.TerrainTile.SetEffectsValues | ( | Device | d3ddevice,
|  | Effect | eff,
|  | int | pass |
| ) |  |  | `[virtual]`

Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.

Parameters:

  | d3ddevice |
  | eff |
  | pass |

Reimplemented from DXGfxLib.SceneObject.

Definition at line 155 of file TerrainTile.cs.

override void DXGfxLib.TerrainTile.SetEffectsValues | ( | Device | d3ddevice,
|  | Effect | eff,
|  | int | pass |
| ) |  |  | `[virtual]`

Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.

Parameters:

  | d3ddevice |
  | eff |
  | pass |

Reimplemented from DXGfxLib.SceneObject.

Definition at line 155 of file TerrainTile.cs.

override void DXGfxLib.TerrainTile.Update | ( | Frustrum | frustrum,
|  | float | elapsedTime,
|  | double | appTime,
|  | List< IDrawable > | objectsToBeRendered |
| ) |  |  | `[virtual]`

This is the method that should be called by any external code willing to update the scene. When looking in the details this method does ask the nodes to update and then call the AttachForRendering method that will add SceneObjects to the list of objets to be rendered.

Parameters:

  | frustrum |
  | elapsedTime |
  | appTime |
  | objectsToBeRendered |

Reimplemented from DXGfxLib.SceneNode.

Definition at line 476 of file TerrainTile.cs.

override void DXGfxLib.TerrainTile.Update | ( | Frustrum | frustrum,
|  | float | elapsedTime,
|  | double | appTime,
|  | List< IDrawable > | objectsToBeRendered |
| ) |  |  | `[virtual]`

This is the method that should be called by any external code willing to update the scene. When looking in the details this method does ask the nodes to update and then call the AttachForRendering method that will add SceneObjects to the list of objets to be rendered.

Parameters:

  | frustrum |
  | elapsedTime |
  | appTime |
  | objectsToBeRendered |

Reimplemented from DXGfxLib.SceneNode.

Definition at line 476 of file TerrainTile.cs.

## Member Data Documentation

List< Batch > DXGfxLib.TerrainTile::batches

Definition at line 102 of file TerrainTile.cs.

Mesh DXGfxLib.TerrainTile::collMesh = null

We keep another mesh object to keep vertex information for this tile and that will be used by DX functions calculating intersection. This allow us to perform intersection queries without affecting rendering.

Definition at line 73 of file TerrainTile.cs.

IndexBuffer DXGfxLib.TerrainTile::currentIndexBuff = null`[protected]`

Definition at line 92 of file TerrainTile.cs.

int DXGfxLib.TerrainTile::currentTriCount = 0`[protected]`

Definition at line 91 of file TerrainTile.cs.

bool DXGfxLib.TerrainTile::far = false

Definition at line 67 of file TerrainTile.cs.

int DXGfxLib.TerrainTile::heigth

Definition at line 87 of file TerrainTile.cs.

IndexBuffer DXGfxLib.TerrainTile::indexBuffLOD2 = null`[protected]`

Definition at line 95 of file TerrainTile.cs.

IndexBuffer DXGfxLib.TerrainTile::indexBuffLOD3 = null`[protected]`

Definition at line 97 of file TerrainTile.cs.

Mesh DXGfxLib.TerrainTile::localMemMesh = null`[protected]`

Definition at line 75 of file TerrainTile.cs.

int DXGfxLib.TerrainTile::LOD2TriCount = 0`[protected]`

Definition at line 94 of file TerrainTile.cs.

int DXGfxLib.TerrainTile::LOD3TriCount = 0`[protected]`

Definition at line 96 of file TerrainTile.cs.

Material DXGfxLib.TerrainTile::material

Definition at line 78 of file TerrainTile.cs.

float DXGfxLib.TerrainTile::maxTerrainHeigth

Definition at line 79 of file TerrainTile.cs.

static float DXGfxLib.TerrainTile::mid = 700.0f`[static]`

Above near and below mid the object is at 'mid' distance to the view point.

Definition at line 65 of file TerrainTile.cs.

float DXGfxLib.TerrainTile::minTerrainHeigth

Definition at line 80 of file TerrainTile.cs.

static float DXGfxLib.TerrainTile::near = 500.0f`[static]`

Below this value the object is judge near to the camera.

Definition at line 60 of file TerrainTile.cs.

float DXGfxLib.TerrainTile::secondTexHeigth

Definition at line 82 of file TerrainTile.cs.

Texture DXGfxLib.TerrainTile::secondTexture = null

Definition at line 83 of file TerrainTile.cs.

static int DXGfxLib.TerrainTile::settedPass = -1`[static]`

We use this variable to know for which pass render state values are currently setted!

Definition at line 55 of file TerrainTile.cs.

float DXGfxLib.TerrainTile::spacing

Definition at line 88 of file TerrainTile.cs.

float DXGfxLib.TerrainTile::stretchFactor

Definition at line 89 of file TerrainTile.cs.

Texture DXGfxLib.TerrainTile::texture = null

Definition at line 77 of file TerrainTile.cs.

bool DXGfxLib.TerrainTile::useLOD = false`[protected]`

Definition at line 93 of file TerrainTile.cs.

int DXGfxLib.TerrainTile::width

Definition at line 86 of file TerrainTile.cs.

The documentation for this class was generated from the following files:

- D:/guillaume/guillara/3D/DXGfx/Backup/DXGfxLib/TerrainTile.cs
- D:/guillaume/guillara/3D/DXGfx/DXGfxLib/TerrainTile.cs