|
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 |
HeightType & | sample (const Point2I pos) const |
const HeightType & | sampleRead (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 | |
HeightType * | mHeight |
Heightfield buffer. | |
Point3F * | mNormal |
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. |
typedef S16 AtlasOldHeightfield::HeightType |
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] |
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.
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] |
bool AtlasOldHeightfield::saveJpeg | ( | const char * | filename | ) |
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.)
Returns the normal for the given coordinate.
void AtlasOldHeightfield::generateNormals | ( | ) |
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.