#include <TeHeightMap.h>
This class provides many methods that cover all relevant operations that can be done with heightmap values.
The methods can be devided into several categories:
Public Member Functions | |
TeHeightMap () | |
TeHeightMap (const SbVec2s resolution) | |
TeHeightMap (const int resx, const int resy) | |
TeHeightMap (const TeHeightMap &hmap) | |
TeHeightMap (const TeHeightMap *hmap, const SbVec2s origin, const SbVec2s size) | |
~TeHeightMap () | |
TeHeightMap & | operator= (const TeHeightMap &hmap) |
SbVec2s | getResolution () const |
void | getResolution (int &x, int &y) const |
void | setResolution (const SbVec2s &newRes) |
void | setValue (const int x, const int y, const float value) |
void | setAllValues (const float value) |
float | getValue (const int x, const int y) const |
const float * | getValues () const |
const float * | operator[] (int i) const |
float * | startEditing () |
void | finishEditing () |
void | getStats (float *min, float *max, float *average) |
float | getMinValue () |
float | getMaxValue () |
float | getAverageValue () |
void | shift (const float delta) |
void | shiftMinValue (const float value) |
void | shiftMinValue (const float value, const float old) |
void | shiftMaxValue (const float value) |
void | shiftMaxValue (const float value, const float old) |
void | shiftAverageValue (const float value) |
void | shiftAverageValue (const float value, const float old) |
void | copyFrom (const TeHeightMap *hmap) |
void | copyFrom (const TeHeightMap *hmap, const SbVec2s &sorigin, const SbVec2s &size, const SbVec2s &dorigin=SbVec2s(0, 0)) |
void | addFrom (const TeHeightMap *hmap, const float rate) |
void | addFrom (const TeHeightMap *hmap, const SbVec2s &sorigin, const SbVec2s &size, const SbVec2s &dorigin, const float rate) |
void | addAll (const float value) |
void | subtractFrom (const TeHeightMap *hmap, const float rate) |
void | subtractFrom (const TeHeightMap *hmap, const SbVec2s &sorigin, const SbVec2s &size, const SbVec2s &dorigin, const float rate) |
void | subtractAll (const float value) |
void | multiplyFrom (const TeHeightMap *hmap, const float rate) |
void | multiplyFrom (const TeHeightMap *hmap, const SbVec2s &sorigin, const SbVec2s &size, const SbVec2s &dorigin, const float rate) |
void | multiplyAll (const float value) |
void | filter_Linear (const float coef, const int times) |
void | generate_FaultFormation (const unsigned int seed, const int num_faults, const float min_delta, const float max_delta) |
void | generate_4HMOverlap_Mask () |
void | dump () |
Private Member Functions | |
void | resetFlags () |
Private Attributes | |
int | resx |
int | resy |
float * | values |
float | minValue |
float | maxValue |
float | averageValue |
struct { | |
unsigned int minUpdated: 1 | |
unsigned int maxUpdated: 1 | |
unsigned int averageUpdated: 1 | |
} | flags |
Friends | |
class | TeFaultFormation |
class | TeLinearFilter |
|
Simple default constructor. Creates empty object (zero dimensions, no allocated memory). |
|
Constructor that sets dimensions and allocates memory. Creates initialized object with known dimensions and allocated memory to store generated values.
|
|
Constructor that sets dimensions and allocates memory. Creates initialized object with known dimensions and allocated memory to store generated values.
|
|
Copy-constructor. Creates new heightmap as a copy of source heightmap.
|
|
Constructor that copies only specified part of source heightmap. New heightmap will have the same resolution as the source hmap. Values are copied from the source hmap. The rectangular area of values being copied is defined by origin and asize parameters. The values are pasted at (0,0) coordinates.
|
|
Destructor. Releases memory. |
|
Adds constant to all heightmap values. Same as shift(value).
|
|
Two heightmaps specified-values adding. Values from source heightmap will be added to "this" heightmap according to a "blend-rate" rate. This should be greater than 0.0f. All source values are multiplied by rate before adding to target values. Selected source area is specified by its top-left corner sorogin and its size. Target area is specified by its top-left corner dorogin.
|
|
Two heightmaps all-values adding. Values from source heightmap will be added to "this" heightmap according to a "blend-rate" rate. This should be greater than 0.0f. All source values are multiplied by rate before adding to target values. All possible values will be added, both source and target top-left corners are in (0,0) coordinates.
|
|
Copies selected part of source heightmap. Copied area is specified by its top-left corner sorigin and size, values are pasted at dorigin coordinates.
|
|
Copies all possible values from source heightmap. Does NOT CHANGE SIZE of the heightmap. If size of heightmaps differs, only subset is copied.
|
|
Dumps itself to stdout. This method is meant to be for DEBUGGING only and can be removed at any time. |
|
Linear filtering of heightmap values. In one cycle, the filter goes through the data in all rows and columns in both directions and changes the values according to the neighbours and filtration coefficient coef. This value should be between (0.0f-1.0f). When large - smaller changes, when small - huge filtering will be done. This cycle will be done times -times.
|
|
Finishes editing. It performs resetFlags(). |
|
Generates mask that can used when building heightmap from 4 others. Heightmaps have to be squares sized (2^x)+1 !!!
|
|
Generates heightmap values using fault-formation algorithm. The algorithm works as follows:
|
|
Computes average value from entire heightmap. Uses TeHeightMap::flags for speedup.
|
|
Finds maximal value in entire heightmap. Uses TeHeightMap::flags for speedup.
|
|
Finds minimal value in entire heightmap. Uses TeHeightMap::flags for speedup.
|
|
Returns size.
|
|
Returns size.
|
|
Statistics gathering (fast single-pass). Returns stats faster than when calling standalone routines, uses TeHeightMap::flags so we can save even more time. If you do not need all the values, pass NULL as no-wanted args when calling this function.
|
|
Returns value at specified coordinates.
|
|
Returns values array.
|
|
Multiplies all heightmap values by a constant.
|
|
Two heightmaps specified-values multiplying. Values in target heightmap will be multiplied by values in the source heightmap according to a "blend-rate" rate. This should be greater than 0.0f. All source values are multiplied by rate before multiplying the target values. Selected source area is specified by its top-left corner sorogin and its size. Target area is specified by its top-left corner dorogin.
|
|
Two heightmaps all-values multiplying. Values in target heightmap will be multiplied by values in the source heightmap according to a "blend-rate" rate. This should be greater than 0.0f. All source values are multiplied by rate before multiplying the target values. All possible values will be multiplied, both source and target top-left corners are in (0,0) coordinates.
|
|
Assignment operator.
|
|
One row getting operator. Useful for coding like height=hmap[y][x].
|
|
Resets TeHeightMap::flags to zero, marks all stored statistics as invalid.
|
|
Sets all heightmap values to specified value.
|
|
Sets new resolution. If map was larger cut off previous values, if map was smaller set new points to zero, old will be in the top-left corner.
|
|
Sets one heightmap value. Sets value at (x, y) to value. If (x, y) is out of bounds does nothing.
|
|
Adds delta to all values.
|
|
Shifts heightmap values, value will become its average value. We know old average value, so we do not have to compute it (it's faster, no check).
|
|
Shifts heightmap values, value will become its average value.
|
|
Shifts heightmap values, value will become its maximal value. We know old maximal value, so we do not have to compute it (it's faster, no check).
|
|
Shifts heightmap values, value will become its maximal value.
|
|
Shifts heightmap values, value will become its minimal value. We know old minimal value, so we do not have to compute it (it's faster, no check).
|
|
Shifts heightmap values, value will become its minimal value.
|
|
Starts editing.
|
|
Subtracts constant from all heightmap values. Same as shift(-value).
|
|
Two heightmaps specified-values subtracting. Values from source heightmap will be subtracted from "this" heightmap according to a "blend-rate" rate. This should be greater than 0.0f. All source values are multiplied by rate before subtracting from target values. Selected source area is specified by its top-left corner sorogin and its size. Target area is specified by its top-left corner dorogin.
|
|
Two heightmaps all-values subtracting. Values from source heightmap will be subtracted from "this" heightmap according to a "blend-rate" rate. This should be greater than 0.0f. All source values are multiplied by rate before subtracting from target values. All possible values will be subtracted, both source and target top-left corners are in (0,0) coordinates.
|
|
Average height storage.
|
|
Bitfield to store flags that indicates which statistics are valid.
|
|
Maximal height storage.
|
|
Minimal height storage.
|
|
Heightmap x size.
|
|
Heightmap y size.
|
|
Array to store heightmap values.
|