AtlasOldHeightfield Class Reference [Old Atlas Editor Code]

#include <atlasOldHeightfield.h>

Inheritance diagram for AtlasOldHeightfield:

Inheritance graph
[legend]
List of all members.

Detailed Description

An unsigned 16bit heightfield, used in situations where we need to manipulate heightfield information directly (ie, mesh generation, collision, and so forth).


Public Types

typedef S16 HeightType

Public Member Functions

 AtlasOldHeightfield (const U32 sizeLog2, const F32 sampleSpacing, const F32 heightScale)
 Create a new heightfield.
virtual ~AtlasOldHeightfield ()
const U32 nodeIndex (const Point2I pos) const
 Given the coordinates of the center of a quadtree node, this function returns its node index.
const U32 indexOf (const Point2I pos) const
 Determine the index for a given location.
const U32 size () const
const U32 realSize () const
HeightTypesample (const Point2I pos) const
const HeightTypesampleRead (const Point2I pos) const
const F32 sampleScaled (const Point2I pos) const
bool loadRawU16 (Stream &s)
bool saveJpeg (const char *filename)
bool saveJpeg (Stream &s)
bool write (Stream &s)
bool read (Stream &s)
S32 minimumEdgeLod (S32 coord)
 Given an x or z coordinate, along which an edge runs, this function returns the lowest LOD level that the edge divides.
Point3F getNormal (const Point2I pos) const
 Returns the normal for the given coordinate.
void generateNormals ()

Public Attributes

HeightTypemHeight
 Heightfield buffer.
Point3FmNormal
 Sometimes we want a normal buffer.
U32 mFieldShift
 Log 2 of the buffer size.
U32 mFieldShiftMinusOne
U32 mRootChunkLevel
F32 mSampleSpacing
 Horizontal spacing. The distance from one point to the next on the grid.
F32 mVerticalScale
 The scale factor for vertical samples.


Member Typedef Documentation


Constructor & Destructor Documentation

AtlasOldHeightfield::AtlasOldHeightfield ( const U32  sizeLog2,
const F32  sampleSpacing,
const F32  heightScale 
)

Create a new heightfield.

Specify the size as a logarithm of 2. So, 8 = 256x256, 9 = 512x512, etc.

virtual AtlasOldHeightfield::~AtlasOldHeightfield (  )  [virtual]


Member Function Documentation

const U32 AtlasOldHeightfield::nodeIndex ( const Point2I  pos  )  const [inline]

Given the coordinates of the center of a quadtree node, this function returns its node index.

The node index is essentially the node's rank in a breadth-first quadtree traversal. Assumes a [nw, ne, sw, se] traversal order.

If the coordinates don't specify a valid node (e.g. if the coords are outside the heightfield) then returns -1.

const U32 AtlasOldHeightfield::indexOf ( const Point2I  pos  )  const [inline]

Determine the index for a given location.

const U32 AtlasOldHeightfield::size (  )  const [inline]

const U32 AtlasOldHeightfield::realSize (  )  const [inline]

HeightType& AtlasOldHeightfield::sample ( const Point2I  pos  )  const [inline]

const HeightType& AtlasOldHeightfield::sampleRead ( const Point2I  pos  )  const [inline]

const F32 AtlasOldHeightfield::sampleScaled ( const Point2I  pos  )  const [inline]

bool AtlasOldHeightfield::loadRawU16 ( Stream s  ) 

bool AtlasOldHeightfield::saveJpeg ( const char *  filename  ) 

bool AtlasOldHeightfield::saveJpeg ( Stream s  ) 

bool AtlasOldHeightfield::write ( Stream s  ) 

bool AtlasOldHeightfield::read ( Stream s  ) 

S32 AtlasOldHeightfield::minimumEdgeLod ( S32  coord  )  [inline]

Given an x or z coordinate, along which an edge runs, this function returns the lowest LOD level that the edge divides.

(This is useful for determining how conservative we need to be with edge skirts.)

Point3F AtlasOldHeightfield::getNormal ( const Point2I  pos  )  const [inline]

Returns the normal for the given coordinate.

void AtlasOldHeightfield::generateNormals (  ) 


Member Data Documentation

Sometimes we want a normal buffer.

Log 2 of the buffer size.

Horizontal spacing. The distance from one point to the next on the grid.

The scale factor for vertical samples.