vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
APNature::Terrain2DSegment Class Reference

Represents a single segment of a two-dimensional terrain which consists of a grid of NxN points (where N >= 2) in the XZ plane (in OSG coordinates) with the value in the Y axis representing height of the point. More...

#include <Terrain2DSegment.h>

Public Member Functions

 Terrain2DSegment ()
 
 ~Terrain2DSegment (void)
 
int Width () const
 
int Height () const
 
const Terrain2DSegmentGetNeighbourNorth () const
 
const Terrain2DSegmentGetNeighbourSouthh () const
 
const Terrain2DSegmentGetNeighbourWest () const
 
const Terrain2DSegmentGetNeighbourEast () const
 
bool IsNeighbourNorth () const
 
bool IsNeighbourSouth () const
 
bool IsNeighbourWest () const
 
bool IsNeighbourEast () const
 
osg::ref_ptr< osg::Geode > GetTerrainSegmentGeode () const
 
const osg::Vec3f & GetPoint (int x, int y) const
 
void SetPoint (int x, int y, const osg::Vec3f &point)
 
void SetSegmentPosition (const osg::Vec2f &position)
 
void InitializeGeode ()
 
void Flatten (float height)
 

Friends

class Terrain2D
 

Detailed Description

Represents a single segment of a two-dimensional terrain which consists of a grid of NxN points (where N >= 2) in the XZ plane (in OSG coordinates) with the value in the Y axis representing height of the point.

Constructor & Destructor Documentation

Terrain2DSegment::Terrain2DSegment ( )

Default constructor - initializes the default safe values for the inner variables.

APNature::Terrain2DSegment::~Terrain2DSegment ( void  )
inline

Default destructor - Releases all memory used by object.

Member Function Documentation

void Terrain2DSegment::Flatten ( float  height)

Sets the same height of the terrain in the whole segment. [in] Height which is set to every point in the segment.

const Terrain2DSegment* APNature::Terrain2DSegment::GetNeighbourEast ( ) const
inline
const Terrain2DSegment* APNature::Terrain2DSegment::GetNeighbourNorth ( ) const
inline
const Terrain2DSegment* APNature::Terrain2DSegment::GetNeighbourSouthh ( ) const
inline
const Terrain2DSegment* APNature::Terrain2DSegment::GetNeighbourWest ( ) const
inline
const osg::Vec3f& APNature::Terrain2DSegment::GetPoint ( int  x,
int  y 
) const
inline

Returns an address of a single point of the terrain. [in] Coordinate of the point in the segment in the X-axis. [in] Coordinate of the point in the segment in the Y-axis.

Returns
Address of the point of the segment.
osg::ref_ptr<osg::Geode> APNature::Terrain2DSegment::GetTerrainSegmentGeode ( ) const
inline

Returns the OSG Geode of the 2D terrain segment.

Returns
OSG Geode of the 2D terrain segment.
int APNature::Terrain2DSegment::Height ( ) const
inline

Actual height (north <-> south distance) of the segment in vertices.

Returns
Height of the terrain in vertices.
void Terrain2DSegment::InitializeGeode ( )

Initializes the segment geode.

bool APNature::Terrain2DSegment::IsNeighbourEast ( ) const
inline
bool APNature::Terrain2DSegment::IsNeighbourNorth ( ) const
inline
bool APNature::Terrain2DSegment::IsNeighbourSouth ( ) const
inline
bool APNature::Terrain2DSegment::IsNeighbourWest ( ) const
inline
void APNature::Terrain2DSegment::SetPoint ( int  x,
int  y,
const osg::Vec3f &  point 
)
inline

Sets the new value of the given point in the segment. [in] Coordinate of the point in the segment in the X-axis. [in] Coordinate of the point in the segment in the Y-axis. [in] New value of terrain point.

void Terrain2DSegment::SetSegmentPosition ( const osg::Vec2f &  position)

Sets the new position of the terrain segment, located in the most NW corner of the segment. Additionally recomputes the position of all segment points. [in] New position of the terrain segment in the XZ plane (in OSG coordinates) which is located in the NW corner of the segment.

int APNature::Terrain2DSegment::Width ( ) const
inline

Actual width (west <-> east distance) of the segment in vertices.

Returns
Width of the terrain in vertices.

Friends And Related Function Documentation

friend class Terrain2D
friend

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