dtCore::InfiniteTerrain Class Reference

An infinite terrain surface. More...

#include <infiniteterrain.h>

Inheritance diagram for dtCore::InfiniteTerrain:

dtCore::Transformable dtCore::DeltaDrawable dtCore::Base

List of all members.

Public Member Functions

 InfiniteTerrain (const std::string &name="infiniteTerrain", osg::Image *textureImage=0)
 Constructor.
void Regenerate ()
 Regenerates the terrain surface.
void SetSegmentSize (float segmentSize)
 Sets the size of the terrain segments.
float GetSegmentSize () const
 Returns the size of the terrain segments.
void SetSegmentDivisions (int segmentDivisions)
 Sets the number of divisions in each segment.
int GetSegmentDivisions () const
 Returns the number of divisions in each segment.
void SetHorizontalScale (float horizontalScale)
 Sets the horizontal scale, which affects the feature frequency.
float GetHorizontalScale () const
 Returns the horizontal scale.
void SetVerticalScale (float verticalScale)
 Sets the vertical scale, which affects the feature amplitude.
float GetVerticalScale () const
 Returns the vertical scale.
void SetBuildDistance (float buildDistance)
 Sets the build distance: the distance from the eyepoint for which terrain is guaranteed to be generated.
float GetBuildDistance () const
 Returns the build distance.
void EnableSmoothCollisions (bool enable)
 Enables or disables smooth collision detection (collision detection based on the underlying noise function, rather than the triangle mesh).
bool SmoothCollisionsEnabled () const
 Checks whether smooth collision detection is enabled.
float GetHeight (float x, float y, bool smooth=false)
 Determines the height of the terrain at the specified location.
void GetNormal (float x, float y, osg::Vec3 &normal, bool smooth=false)
 Retrieves the normal of the terrain at the specified location.
virtual bool FilterContact (dContact *contact, Transformable *collider)
 We want we collision to happen by default with this class.
bool IsClearLineOfSight (const osg::Vec3 &pointOne, const osg::Vec3 &pointTwo)
 Given pointOne and pointTwo, both in world space and with all coordinates in Cartesian space (essentially in meters along X, Y and Z), returns true if there is a clear line of sight and false if the view is blocked.
void SetLineOfSightSpacing (float spacing)
 Set the stepping distance to sample points for the line of sight calculation (meters).
float GetLineOfSightSpacing () const
void SetMinColor (const osg::Vec3 &rgb)
 Set the color used for low areas of the terrain.
void SetMaxColor (const osg::Vec3 &rgb)
 Set the color used for high areas of the terrain.

Protected Member Functions

virtual ~InfiniteTerrain ()
 Destructor.

Friends

class InfiniteTerrainCallback

Classes

struct  Segment
 Identifies a single terrain segment.


Detailed Description

An infinite terrain surface.

Constructor & Destructor Documentation

dtCore::InfiniteTerrain::InfiniteTerrain ( const std::string &  name = "infiniteTerrain",
osg::Image *  textureImage = 0 
)

Constructor.

Parameters:
name the instance name
textureImage An image to apply to the terrain. The appearance of this texture will be effected by HighColor and LowColor
name the instance name
textureImage An image to apply to the terrain.

dtCore::InfiniteTerrain::~InfiniteTerrain (  )  [protected, virtual]

Destructor.


Member Function Documentation

void dtCore::InfiniteTerrain::Regenerate (  ) 

Regenerates the terrain surface.

void dtCore::InfiniteTerrain::SetSegmentSize ( float  segmentSize  ) 

Sets the size of the terrain segments.

(def = 1000.0)

Parameters:
segmentSize the new segment size
segmentSize the new segment size

float dtCore::InfiniteTerrain::GetSegmentSize (  )  const

Returns the size of the terrain segments.

Returns:
the current segment size

void dtCore::InfiniteTerrain::SetSegmentDivisions ( int  segmentDivisions  ) 

Sets the number of divisions in each segment.

(def = 128)

Parameters:
segmentDivisions the new segment divisions
segmentDivisions the new segment divisions

int dtCore::InfiniteTerrain::GetSegmentDivisions (  )  const

Returns the number of divisions in each segment.

Returns:
the current segment divisions

void dtCore::InfiniteTerrain::SetHorizontalScale ( float  horizontalScale  ) 

Sets the horizontal scale, which affects the feature frequency.

(def = 0.01)

Parameters:
horizontalScale the new horizontal scale
horizontalScale the new horizontal scale

float dtCore::InfiniteTerrain::GetHorizontalScale (  )  const

Returns the horizontal scale.

Returns:
the horizontal scale

void dtCore::InfiniteTerrain::SetVerticalScale ( float  verticalScale  ) 

Sets the vertical scale, which affects the feature amplitude.

(def = 25.0)

Parameters:
verticalScale the new vertical scale
verticalScale the new vertical scale

float dtCore::InfiniteTerrain::GetVerticalScale (  )  const

Returns the vertical scale.

Returns:
the vertical scale

void dtCore::InfiniteTerrain::SetBuildDistance ( float  buildDistance  ) 

Sets the build distance: the distance from the eyepoint for which terrain is guaranteed to be generated.

(def = 3000.0)

Parameters:
buildDistance the new build distance
buildDistance the new build distance

float dtCore::InfiniteTerrain::GetBuildDistance (  )  const

Returns the build distance.

Returns:
the build distance

void dtCore::InfiniteTerrain::EnableSmoothCollisions ( bool  enable  ) 

Enables or disables smooth collision detection (collision detection based on the underlying noise function, rather than the triangle mesh).

Parameters:
enable true to enable, false to disable

bool dtCore::InfiniteTerrain::SmoothCollisionsEnabled (  )  const

Checks whether smooth collision detection is enabled.

Returns:
true if enabled, false if disabled

float dtCore::InfiniteTerrain::GetHeight ( float  x,
float  y,
bool  smooth = false 
)

Determines the height of the terrain at the specified location.

Parameters:
x the x coordinate to check
y the y coordinate to check
smooth if true, use height of underlying noise function instead of triangle mesh height
Returns:
the height at the specified location

void dtCore::InfiniteTerrain::GetNormal ( float  x,
float  y,
osg::Vec3 &  normal,
bool  smooth = false 
)

Retrieves the normal of the terrain at the specified location.

Parameters:
x the x coordinate to check
y the y coordinate to check
normal the location at which to store the normal
smooth if true, use height of underlying noise function instead of triangle mesh height

virtual bool dtCore::InfiniteTerrain::FilterContact ( dContact *  contact,
Transformable collider 
) [inline, virtual]

We want we collision to happen by default with this class.

Reimplemented from dtCore::Transformable.

bool dtCore::InfiniteTerrain::IsClearLineOfSight ( const osg::Vec3 &  pointOne,
const osg::Vec3 &  pointTwo 
)

Given pointOne and pointTwo, both in world space and with all coordinates in Cartesian space (essentially in meters along X, Y and Z), returns true if there is a clear line of sight and false if the view is blocked.

Note:
This method only samples points at a predetermined distance from pointOne to pointTwo and not be 100% accurate with actual terrrain.
Parameters:
pointOne The start point.
pointTwo The end point.
Returns:
Returns true if there is a clear line of sight from pointOne to pointTwo and false if the view is blocked.
See also:
SetLineOfSightSpacing()

void dtCore::InfiniteTerrain::SetLineOfSightSpacing ( float  spacing  )  [inline]

Set the stepping distance to sample points for the line of sight calculation (meters).

Defaults to 25 meters.

float dtCore::InfiniteTerrain::GetLineOfSightSpacing (  )  const [inline]

void dtCore::InfiniteTerrain::SetMinColor ( const osg::Vec3 &  rgb  ) 

Set the color used for low areas of the terrain.

Parameters:
rgb The colour (0..255, 0..255, 0..255) of the low areas.

void dtCore::InfiniteTerrain::SetMaxColor ( const osg::Vec3 &  rgb  ) 

Set the color used for high areas of the terrain.

Parameters:
rgb The colour (0..255, 0..255, 0..255) of the high areas.


Friends And Related Function Documentation

friend class InfiniteTerrainCallback [friend]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008