VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtWeatherSurfaceGrid Class Reference

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.

Inheritance diagram for makVrv::DtWeatherSurfaceGrid:
Inheritance graph
[legend]

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 intpackedData (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

DtDemyDe
 
int myClampIndex
 
float myMinClampOffset
 
float myMaxClampOffset
 
osg::Vec3d myPosition
 
osg::Matrixd myRotation
 
float myBoundsX
 
float myBoundsY
 
int myPointCountX
 
int myPointCountY
 
float * myHeights
 
unsigned intmyPackedData
 
DtIntersectormyIntersector = nullptr
 

Private Member Functions

 DtWeatherSurfaceGrid ()=delete
 
 DtWeatherSurfaceGrid (const DtWeatherSurfaceGrid &other)=delete
 
DtWeatherSurfaceGridoperator= (const DtWeatherSurfaceGrid &other)=delete
 

Constructor & Destructor Documentation

makVrv::DtWeatherSurfaceGrid::DtWeatherSurfaceGrid ( makVrv::DtDe de)

CTOR.

virtual makVrv::DtWeatherSurfaceGrid::~DtWeatherSurfaceGrid ( )
virtual

DTOR.

makVrv::DtWeatherSurfaceGrid::DtWeatherSurfaceGrid ( )
privatedelete

Default Constructor not implemented.

makVrv::DtWeatherSurfaceGrid::DtWeatherSurfaceGrid ( const DtWeatherSurfaceGrid other)
privatedelete

Copy Constructor not implemented - Copy not allowed.

Member Function Documentation

DtWeatherSurfaceGrid& makVrv::DtWeatherSurfaceGrid::operator= ( const DtWeatherSurfaceGrid other)
privatedelete

Assignment Operator not implemented - Assignment not allowed.

virtual void makVrv::DtWeatherSurfaceGrid::setBounds ( float  boundsX,
float  boundsY 
)
virtual

Sets the rectangular bounds of the area.

Parameters
boundsXThe x size of the bounds.
boundsYThe y size of the bounds.
virtual void makVrv::DtWeatherSurfaceGrid::setGridSize ( int  sizeX,
int  sizeY 
)
virtual

Sets the number of points in the x and y directions of the grid. Calling this method re-creates the grid.

Parameters
sizeXThe x count of points on the rectangular grid (must be > 1).
sizeYThe y count of points on the rectangular grid (must be > 1).
virtual void makVrv::DtWeatherSurfaceGrid::setTransform ( const osg::Vec3d &  position,
osg::Matrixd &  rotation 
)
virtual

Sets the grid transform.

Parameters
positionThe transform position in world space.
rotationThe transform rotation in world space.
virtual const float* makVrv::DtWeatherSurfaceGrid::heights ( int sizeX,
int sizeY 
) const
virtual

Returns the grid heights array used for terrain clamping.

Parameters
sizeXFilled in output for the grid size in the x direction.
sizeYFilled in output for the grid size in the y direction.
virtual const unsigned int* makVrv::DtWeatherSurfaceGrid::packedData ( int sizeX,
int sizeY 
) const
virtual

Returns the grid heights/blend packedData array used for terrain clamping.

Parameters
sizeXFilled in output for the grid size in the x direction.
sizeYFilled in output for the grid size in the y direction.
virtual void makVrv::DtWeatherSurfaceGrid::getPosition ( int  gridX,
int  gridY,
osg::Vec3d &  position 
)
virtual

Gets a grid 3D position at the given grid index.

Parameters
gridXThe X grid index to get the position for.
gridYThe Y grid index to get the position for.
positionThe filled out position.
virtual double makVrv::DtWeatherSurfaceGrid::clampDistance ( ) const
virtual

Returns the distance used for clamping to the terrain.

virtual bool makVrv::DtWeatherSurfaceGrid::clampPositionToTerrain ( osg::Vec3d &  position,
float  clampDistance 
)
virtual

Clamps the given position to the terrain surface. Returns true if successful.

Parameters
positionThe input/output position to clamp.
clampDistanceThe above/below distance to search for a surface.
virtual bool makVrv::DtWeatherSurfaceGrid::simulationUpdate ( float  timeStep)
virtual

Updates the grid clamping. Returns false when all points have been clamped and no more updates are required.

Parameters
timeStepThe update timestep.
virtual void makVrv::DtWeatherSurfaceGrid::onAreaChanged ( )
virtual

Called to indicate the area bounds or transform has changed. This will reset the clamping process.

virtual float makVrv::DtWeatherSurfaceGrid::minClampOffset ( ) const
virtual

Returns the minimum calculated clamp offset value.

virtual float makVrv::DtWeatherSurfaceGrid::maxClampOffset ( ) const
virtual

Returns the maximum calculated clamp offset value.

virtual void makVrv::DtWeatherSurfaceGrid::computeBlendingData ( float  maxDiffPerMeter)
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.

virtual unsigned int makVrv::DtWeatherSurfaceGrid::packData ( float  height,
float  blend 
)
protectedvirtual

Packs the given height and blend values into an unsigned int.

Parameters
heightA height value stored in 24 bits.
blendA blend value in the range of (0.0f to 1.0f) stored in 8 bits.

Member Data Documentation

DtDe& makVrv::DtWeatherSurfaceGrid::myDe
protected
int makVrv::DtWeatherSurfaceGrid::myClampIndex
protected
float makVrv::DtWeatherSurfaceGrid::myMinClampOffset
protected
float makVrv::DtWeatherSurfaceGrid::myMaxClampOffset
protected
osg::Vec3d makVrv::DtWeatherSurfaceGrid::myPosition
protected
osg::Matrixd makVrv::DtWeatherSurfaceGrid::myRotation
protected
float makVrv::DtWeatherSurfaceGrid::myBoundsX
protected
float makVrv::DtWeatherSurfaceGrid::myBoundsY
protected
int makVrv::DtWeatherSurfaceGrid::myPointCountX
protected
int makVrv::DtWeatherSurfaceGrid::myPointCountY
protected
float* makVrv::DtWeatherSurfaceGrid::myHeights
protected
unsigned int* makVrv::DtWeatherSurfaceGrid::myPackedData
protected
DtIntersector* makVrv::DtWeatherSurfaceGrid::myIntersector = nullptr
protected

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

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)