![]() |
VR-Forces 5.0.2 Developer's Guide
|
Used by the weather system to define a rectangular grid of points. The points can be clamped to the terrain surface for use in constraining weather effects to the terrain. The grid can be thought of as a crude surface height map. The height map has a rectangular bounds that is divided evenly by a rectangular grid.
Optionally, each grid point height can be packed with a blending value into a single unsinged int for better shader memory use.
The owner of this object should call simulationUpdate() to update clamping.

Public Member Functions | |
| DtWeatherSurfaceGrid (makVrv::DtDe &de) | |
| virtual | ~DtWeatherSurfaceGrid () |
| virtual void | setBounds (float boundsX, float boundsY) |
| virtual void | setGridSize (int sizeX, int sizeY) |
| virtual void | setTransform (const osg::Vec3d &position, osg::Matrixd &rotation) |
| virtual const float * | heights (int &sizeX, int &sizeY) const |
| virtual const unsigned int * | packedData (int &sizeX, int &sizeY) const |
| virtual void | getPosition (int gridX, int gridY, osg::Vec3d &position) |
| virtual double | clampDistance () const |
| virtual bool | clampPositionToTerrain (osg::Vec3d &position, float clampDistance) |
| virtual bool | simulationUpdate (float timeStep) |
| virtual void | onAreaChanged () |
| virtual float | minClampOffset () const |
| virtual float | maxClampOffset () const |
| virtual void | computeBlendingData (float maxDiffPerMeter) |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Protected Member Functions | |
| virtual unsigned int | packData (float height, float blend) |
Protected Attributes | |
| DtDe & | myDe |
| int | myClampIndex |
| float | myMinClampOffset |
| float | myMaxClampOffset |
| osg::Vec3d | myPosition |
| osg::Matrixd | myRotation |
| float | myBoundsX |
| float | myBoundsY |
| int | myPointCountX |
| int | myPointCountY |
| float * | myHeights |
| unsigned int * | myPackedData |
| DtIntersector * | myIntersector = nullptr |
Private Member Functions | |
| DtWeatherSurfaceGrid ()=delete | |
| DtWeatherSurfaceGrid (const DtWeatherSurfaceGrid &other)=delete | |
| DtWeatherSurfaceGrid & | operator= (const DtWeatherSurfaceGrid &other)=delete |
| makVrv::DtWeatherSurfaceGrid::DtWeatherSurfaceGrid | ( | makVrv::DtDe & | de | ) |
CTOR.
|
virtual |
DTOR.
|
privatedelete |
Default Constructor not implemented.
|
privatedelete |
Copy Constructor not implemented - Copy not allowed.
|
privatedelete |
Assignment Operator not implemented - Assignment not allowed.
|
virtual |
Sets the rectangular bounds of the area.
| boundsX | The x size of the bounds. |
| boundsY | The y size of the bounds. |
Sets the number of points in the x and y directions of the grid. Calling this method re-creates the grid.
| sizeX | The x count of points on the rectangular grid (must be > 1). |
| sizeY | The y count of points on the rectangular grid (must be > 1). |
|
virtual |
Sets the grid transform.
| position | The transform position in world space. |
| rotation | The transform rotation in world space. |
|
virtual |
Returns the grid heights array used for terrain clamping.
| sizeX | Filled in output for the grid size in the x direction. |
| sizeY | Filled in output for the grid size in the y direction. |
|
virtual |
Returns the grid heights/blend packedData array used for terrain clamping.
| sizeX | Filled in output for the grid size in the x direction. |
| sizeY | Filled in output for the grid size in the y direction. |
|
virtual |
Gets a grid 3D position at the given grid index.
| gridX | The X grid index to get the position for. |
| gridY | The Y grid index to get the position for. |
| position | The filled out position. |
|
virtual |
Returns the distance used for clamping to the terrain.
|
virtual |
Clamps the given position to the terrain surface. Returns true if successful.
| position | The input/output position to clamp. |
| clampDistance | The above/below distance to search for a surface. |
|
virtual |
Updates the grid clamping. Returns false when all points have been clamped and no more updates are required.
| timeStep | The update timestep. |
|
virtual |
Called to indicate the area bounds or transform has changed. This will reset the clamping process.
|
virtual |
Returns the minimum calculated clamp offset value.
|
virtual |
Returns the maximum calculated clamp offset value.
|
virtual |
/brief Computes blending values based on grid point height differences. This packs height and blending data into the unsigned int packed data array. Blend will be linear from 1.0 at no height difference to 0.0f at maximum allowed difference. This operates on the current set of height data. /param maxDiffPerMeter The height difference per meter where blend values will be zero.
|
protectedvirtual |
Packs the given height and blend values into an unsigned int.
| height | A height value stored in 24 bits. |
| blend | A blend value in the range of (0.0f to 1.0f) stored in 8 bits. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |