C# Class MyGame.Terrain

This class represent the Terrain that draw the terrain and has utility methods to deal with the terrain
Inheritance: Microsoft.Xna.Framework.DrawableGameComponent, IRenderable
Show file Open project: mahmoudbahaa/XNA-Game-project Class Usage Examples

Public Properties

Property Type Description
DetailDistance float
DetailTexture Microsoft.Xna.Framework.Graphics.Texture2D
DetailTextureTiling float
RTexture Microsoft.Xna.Framework.Graphics.Texture2D

Public Methods

Method Description
Draw ( ) : void
Draw ( GameTime gameTime ) : void

This method renders the current state.

GetHeightAtPosition ( float X, float Z ) : float
GetHeightAtPosition ( float X, float Z, float &Steepness ) : float
SetClipPlane ( Vector4 Plane ) : void
Terrain ( Game game, Camera camera, Microsoft.Xna.Framework.Graphics.Texture2D HeightMap, float CellSize, float Height, Microsoft.Xna.Framework.Graphics.Texture2D BaseTexture, float TextureTiling, Vector3 LightDirection ) : System
Update ( GameTime gameTime ) : void

Private Methods

Method Description
createIndices ( ) : void
createVertices ( ) : void
genNormals ( ) : void
getHeights ( ) : void

Method Details

Draw() public method

public Draw ( ) : void
return void

Draw() public method

This method renders the current state.
public Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime The elapsed game time.
return void

GetHeightAtPosition() public method

public GetHeightAtPosition ( float X, float Z ) : float
X float
Z float
return float

GetHeightAtPosition() public method

public GetHeightAtPosition ( float X, float Z, float &Steepness ) : float
X float
Z float
Steepness float
return float

SetClipPlane() public method

public SetClipPlane ( Vector4 Plane ) : void
Plane Vector4
return void

Terrain() public method

public Terrain ( Game game, Camera camera, Microsoft.Xna.Framework.Graphics.Texture2D HeightMap, float CellSize, float Height, Microsoft.Xna.Framework.Graphics.Texture2D BaseTexture, float TextureTiling, Vector3 LightDirection ) : System
game Game
camera Camera
HeightMap Microsoft.Xna.Framework.Graphics.Texture2D
CellSize float
Height float
BaseTexture Microsoft.Xna.Framework.Graphics.Texture2D
TextureTiling float
LightDirection Vector3
return System

Update() public method

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
return void

Property Details

DetailDistance public property

public float DetailDistance
return float

DetailTexture public property

public Texture2D,Microsoft.Xna.Framework.Graphics DetailTexture
return Microsoft.Xna.Framework.Graphics.Texture2D

DetailTextureTiling public property

public float DetailTextureTiling
return float

RTexture public property

public Texture2D,Microsoft.Xna.Framework.Graphics RTexture
return Microsoft.Xna.Framework.Graphics.Texture2D