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

An area of ground fog patch items and effects. One ground fog patch area is associated with a non-infinite ground fog cloud layer in the user interface. The area is made up of a rectangular 2d grid of ground fog patch items.

Optionally, ground fog particle effects are added to the area and activated as the camera moves through the area. This area object can be thought of as a manager for fog patches and effects that are within a specified bounds.

Note that sandstorms are also created using a ground fog patch area. The main differences between ground fog and sandstorms are the way the areas are configured such as base color and effects.

Classes

struct  BoneWeight
 
struct  DrawData
 
struct  MeshGroup
 

Public Types

enum  AreaType { AreaTypePatchyGroundFog, AreaTypeSandstorm }
 

Public Member Functions

 DtGroundFogPatchArea (makVrv::DtDe &de)
 
virtual ~DtGroundFogPatchArea ()
 
virtual void init (float worldSize, float thickness)
 
virtual void addEffect (DtGroundFogEffect *effect)
 
virtual void releaseFogPatchGLObjects (osg::State *state) const
 
virtual void releaseFogEffectGLObjects (osg::State *state) const
 
virtual bool cullUpdate (const osg::Vec3d &camPos, const osg::Matrixd &viewMatrixI, const std::vector< osg::Vec4d > &cullingPlanes, DtJobSplitter *jobSplitter)
 
virtual bool shouldDrawFogPatches ()
 
virtual void drawFogPatches (DtGroundFogPatchArea::DrawData &drawData)
 
virtual void drawFogEffects (DtGroundFogEffect::DrawData &drawData)
 
virtual void setDensity (float density)
 
virtual float density () const
 
virtual void setTransform (const DtVector &position, float orientation, bool relativeToCamera=false)
 
virtual void computeWorldTransform (osg::Vec3d &position, osg::Matrixf &rotation) const
 
virtual void setEnabled (bool enabled)
 
virtual bool enabled () const
 
virtual void setClampingEnabled (bool enabled)
 
virtual bool clampingEnabled () const
 
virtual float worldSize () const
 
virtual float computeParticleSize () const
 
virtual void setBounds (const DtVector &bounds, float cornerRadius)
 
virtual bool isPositionAboveArea (const osg::Vec3d &position)
 
virtual void setBaseColor (float red, float green, float blue)
 
virtual void setParticleSizeVariation (float variation)
 
virtual void setPatternedLook (bool patternedEnable)
 
virtual void setAreaType (DtGroundFogPatchArea::AreaType areaType)
 
virtual
DtGroundFogPatchArea::AreaType 
areaType () const
 
virtual void computeBounds (osg::Vec4 &bounds, osg::Vec3d &position, osg::Matrixd &rotation) const
 

Protected Member Functions

virtual void freeData (void)
 
virtual void computeWeights (float x, float y, float patchSize, float *bones, float *weights)
 
virtual void initLod (int gridSize, float patchSize)
 
virtual bool bindMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const
 
virtual bool bindVaoToMeshGroup (GLuint vao, MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const
 
virtual void computeBasis (const osg::Vec3d &inGeocentricPos, osg::Matrixd &rotOut)
 
virtual void computeSortDepth (const osg::Vec3 &camPos)
 
virtual void inverseTransformPlane (osg::Vec4d &plane, const osg::Vec3d &position, const osg::Matrixd &rotation)
 
virtual bool isSphereVisible (const std::vector< osg::Vec4d > &planes, const osg::Vec3d &center, double radius)
 
virtual void computeBoundsCulling ()
 
virtual float computeEffectFade (const osg::Vec3 &localCam)
 
virtual double clampDistance () const
 
virtual bool clampPosition (osg::Vec3d &position)
 
virtual float computePatchCellSize () const
 

Static Protected Member Functions

static int theSortWeights (const void *arg0, const void *arg1)
 
static int theSortBackToFront (const void *arg0, const void *arg1)
 

Protected Attributes

DtDemyDe
 
float myDensity
 
bool myEnabled
 
float myWindU
 
float myWindV
 
double myLastWindTime
 
bool myCameraBasisDirty
 
bool myInitialized
 
bool myClampingEnabled
 
int myClampIndex
 
int myClampBoneIndex
 
float myMaxClampOffset
 
float myBaseColorR
 
float myBaseColorG
 
float myBaseColorB
 
float myParticleSizeVariation
 
float myPatternedLook
 
AreaType myAreaType
 
MeshGroupmyMeshGroup
 
DtGlVaoManagermyVaoManager
 
osg::Vec3d myPosition
 
float myOrientation
 
osg::Vec3d myBasisPos
 
osg::Matrixd myBasisRot
 
float myBoundsX
 
float myBoundsY
 
float myBoundsCornerRadius
 
int myGridSize
 
float myPatchWorldSize
 
std::vector< DtGroundFogPatch * > myPatches
 
int myPatchCount
 
DtGroundFogPatch ** myRenderPatches
 
int myRenderPatchCount
 
std::vector< DtGroundFogEffect * > myEffects
 

Static Protected Attributes

static const double DT_GFP_CLAMP_DISTANCE
 
static const int DT_GFP_CELL_SIZE
 

Private Member Functions

 DtGroundFogPatchArea ()
 
 DtGroundFogPatchArea (const DtGroundFogPatchArea &other)
 
DtGroundFogPatchAreaoperator= (const DtGroundFogPatchArea &other)
 

Member Enumeration Documentation

brief Area type enumerations. Area types help with descibing the area for items like sensors.

Enumerator
AreaTypePatchyGroundFog 
AreaTypeSandstorm 

Constructor & Destructor Documentation

makVrv::DtGroundFogPatchArea::DtGroundFogPatchArea ( makVrv::DtDe de)

CTOR.

virtual makVrv::DtGroundFogPatchArea::~DtGroundFogPatchArea ( )
virtual

DTOR.

makVrv::DtGroundFogPatchArea::DtGroundFogPatchArea ( )
private

Default Constructor not implemented.

makVrv::DtGroundFogPatchArea::DtGroundFogPatchArea ( const DtGroundFogPatchArea other)
private

Copy Constructor not implemented - Copy not allowed.

Member Function Documentation

DtGroundFogPatchArea& makVrv::DtGroundFogPatchArea::operator= ( const DtGroundFogPatchArea other)
private

Assignment Operator not implemented - Assignment not allowed.

virtual void makVrv::DtGroundFogPatchArea::init ( float  worldSize,
float  thickness 
)
virtual

Initializes the area.

Parameters
worldSizeThe world size of 1 horizontal square side (meters).
thicknessThe vertical height of the area (meters).
virtual void makVrv::DtGroundFogPatchArea::addEffect ( DtGroundFogEffect effect)
virtual

brief Adds an effect to this area.

Parameters
effectThis effect object to add.
virtual void makVrv::DtGroundFogPatchArea::releaseFogPatchGLObjects ( osg::State *  state) const
virtual

Release all gl objects used by fog patches in this area.

virtual void makVrv::DtGroundFogPatchArea::releaseFogEffectGLObjects ( osg::State *  state) const
virtual

Release all gl objects used by fog effects in this area.

virtual bool makVrv::DtGroundFogPatchArea::cullUpdate ( const osg::Vec3d &  camPos,
const osg::Matrixd &  viewMatrixI,
const std::vector< osg::Vec4d > &  cullingPlanes,
DtJobSplitter jobSplitter 
)
virtual

Updates ground fog area based on the current camera.

Parameters
camThe current camera being drawn.
jobSplitterA job splitter to add predraw jobs to. returns true if visible.
virtual bool makVrv::DtGroundFogPatchArea::shouldDrawFogPatches ( )
virtual

Returns true if drawing of fog patches is allowed this draw.

virtual void makVrv::DtGroundFogPatchArea::drawFogPatches ( DtGroundFogPatchArea::DrawData drawData)
virtual

Do the drawing of fog patches.

virtual void makVrv::DtGroundFogPatchArea::drawFogEffects ( DtGroundFogEffect::DrawData drawData)
virtual

Do the drawing of fog effects.

virtual void makVrv::DtGroundFogPatchArea::setDensity ( float  density)
virtual

brief Set the fog density.

Parameters
densityThis fog density exp() control.
virtual float makVrv::DtGroundFogPatchArea::density ( ) const
virtual

brief Returns the fog density.

virtual void makVrv::DtGroundFogPatchArea::setTransform ( const DtVector position,
float  orientation,
bool  relativeToCamera = false 
)
virtual

Sets the fog area transform.

Parameters
positionThe transform position in world space.
oritantationThe yaw orientation in degrees (0 = north).
relativeToCameraSet to true if the position is relative to the current camera.
virtual void makVrv::DtGroundFogPatchArea::computeWorldTransform ( osg::Vec3d &  position,
osg::Matrixf &  rotation 
) const
virtual

brief Computes the world transform for the fog volume origin. This includes any local tranform and geocentric transform.

virtual void makVrv::DtGroundFogPatchArea::setEnabled ( bool  enabled)
virtual

Enables or disables the fog patch area.

Parameters
enabledSet to true to enable the area.
virtual bool makVrv::DtGroundFogPatchArea::enabled ( ) const
virtual

Returns the enabled state.

virtual void makVrv::DtGroundFogPatchArea::setClampingEnabled ( bool  enabled)
virtual

Enables or disables fog clamping to terrain.

Parameters
enabledSet to true to enable clamping.
virtual bool makVrv::DtGroundFogPatchArea::clampingEnabled ( ) const
virtual

Returns the clamping enabled state.

virtual float makVrv::DtGroundFogPatchArea::worldSize ( ) const
virtual

Returns the world size of 1 side of the square area.

virtual float makVrv::DtGroundFogPatchArea::computeParticleSize ( ) const
virtual

Computes the particle size used for voxel filling.

virtual void makVrv::DtGroundFogPatchArea::setBounds ( const DtVector bounds,
float  cornerRadius 
)
virtual

Sets the bounds of the area.

Parameters
boundsThe (x,y,z) of the bounds.
cornerRadiusThe radius at each corner of the bounds.
virtual bool makVrv::DtGroundFogPatchArea::isPositionAboveArea ( const osg::Vec3d &  position)
virtual

Returns true if the given position is above the area peak.

Parameters
positionThe position to test.
virtual void makVrv::DtGroundFogPatchArea::setBaseColor ( float  red,
float  green,
float  blue 
)
virtual

Sets the base material color for the area.

Parameters
redThe red component color to set in the range of (0.0 - 1.0).
greenThe green component color to set in the range of (0.0 - 1.0).
blueThe blue component color to set in the range of (0.0 - 1.0).
virtual void makVrv::DtGroundFogPatchArea::setParticleSizeVariation ( float  variation)
virtual

Sets a size variation for particles used to fill voxel space.

Parameters
variationThe random variation (typically 0.0 to 0.5).
virtual void makVrv::DtGroundFogPatchArea::setPatternedLook ( bool  patternedEnable)
virtual

Enables or disables a patterned look (typically "true" for sandstorms). Setting this to true or false will determine how shading and patchiness are applied in the ground fog patch shader.

Parameters
patternedEnableIf true, enables a patterned look.
virtual void makVrv::DtGroundFogPatchArea::setAreaType ( DtGroundFogPatchArea::AreaType  areaType)
virtual

Sets a type for this area. The type is used for determining things like how the area looks in sensors. areaType The area type enumeration.

virtual DtGroundFogPatchArea::AreaType makVrv::DtGroundFogPatchArea::areaType ( ) const
virtual

Gets a area type for this area. The area type is used for determining things like how the area looks in sensors.

virtual void makVrv::DtGroundFogPatchArea::computeBounds ( osg::Vec4 &  bounds,
osg::Vec3d &  position,
osg::Matrixd &  rotation 
) const
virtual

Computes the bounds of the area.

Parameters
boundsThe output (width, length, height, corner radius).
positionThe output world postition.
rotationThe output world rotation.
virtual void makVrv::DtGroundFogPatchArea::freeData ( void  )
protectedvirtual

Frees resources associated with patches.

virtual void makVrv::DtGroundFogPatchArea::computeWeights ( float  x,
float  y,
float  patchSize,
float *  bones,
float *  weights 
)
protectedvirtual

Computes a skeletal weights for a local cell position.

Parameters
xThe x cell position.
yThe y cell position.
patchSizeThe world size of a patch row.
weightsAn array of 4 floats to be filled with best bone indices.
weightsAn array of 4 floats to be filled with best best weights.
virtual void makVrv::DtGroundFogPatchArea::initLod ( int  gridSize,
float  patchSize 
)
protectedvirtual

Initializes an lod for a patch.

Parameters
gridSizeThe number of cells in 1 row of a patch.
patchSizeThe world size of a patch row.
virtual bool makVrv::DtGroundFogPatchArea::bindMeshGroupData ( MeshGroup meshGroup,
osg::RenderInfo &  renderInfo 
) const
protectedvirtual

Binds the mesh group data to the vbo's.

Parameters
meshGroupThe mesh group object to bind.
renderInfoThe current rendering info.
virtual bool makVrv::DtGroundFogPatchArea::bindVaoToMeshGroup ( GLuint  vao,
MeshGroup meshGroup,
osg::RenderInfo &  renderInfo 
) const
protectedvirtual

Binds the given voa to vbo's for a mesh group.

Parameters
vaoThe GL VAO handle.
meshGroupThe mesh group to bind.
renderInfoThe current rendering info.
virtual void makVrv::DtGroundFogPatchArea::computeBasis ( const osg::Vec3d &  inGeocentricPos,
osg::Matrixd &  rotOut 
)
protectedvirtual

Ccomputes a basis rotation matrix for the given geocentric position.

Parameters
inGeocentricPosThe geocentric reference position.
rotOutThe computed basis rotation transform.
virtual void makVrv::DtGroundFogPatchArea::computeSortDepth ( const osg::Vec3 &  camPos)
protectedvirtual

Computes the sort depth for all patches.

Parameters
camPosThe camera position in local fog system space.
virtual void makVrv::DtGroundFogPatchArea::inverseTransformPlane ( osg::Vec4d &  plane,
const osg::Vec3d &  position,
const osg::Matrixd &  rotation 
)
protectedvirtual

Transforms a plane into a local transform space.

Parameters
planeThe plane to transform.
positionThe transform position.
rotationthe transform rotation.
virtual bool makVrv::DtGroundFogPatchArea::isSphereVisible ( const std::vector< osg::Vec4d > &  planes,
const osg::Vec3d &  center,
double  radius 
)
protectedvirtual

Tests to see if a sphere is visible using the given frustum planes.

Parameters
planesThe frustum planes to test the sphere against.
centerThe sphere center position.
radiusthe sphere radius.
virtual void makVrv::DtGroundFogPatchArea::computeBoundsCulling ( )
protectedvirtual

For each patch, computes if it is culled from the bounds and stores results.

virtual float makVrv::DtGroundFogPatchArea::computeEffectFade ( const osg::Vec3 &  localCam)
protectedvirtual

Computes and returns a (0.0 - 1.0) base on camera position inside the bounds.

virtual double makVrv::DtGroundFogPatchArea::clampDistance ( ) const
protectedvirtual

Returns the distance used for bone clamping to the terrain.

virtual bool makVrv::DtGroundFogPatchArea::clampPosition ( osg::Vec3d &  position)
protectedvirtual

Clamps a position to the terrain. Returns true on success.

Parameters
positionThe position to clamp.
virtual float makVrv::DtGroundFogPatchArea::computePatchCellSize ( ) const
protectedvirtual

Computes the cell size used in a fog patch.

static int makVrv::DtGroundFogPatchArea::theSortWeights ( const void *  arg0,
const void *  arg1 
)
staticprotected

Sort function used for sorting skeletal weights.

static int makVrv::DtGroundFogPatchArea::theSortBackToFront ( const void *  arg0,
const void *  arg1 
)
staticprotected

Sort function used for qsorting patches.

Member Data Documentation

DtDe& makVrv::DtGroundFogPatchArea::myDe
protected
float makVrv::DtGroundFogPatchArea::myDensity
protected
bool makVrv::DtGroundFogPatchArea::myEnabled
protected
float makVrv::DtGroundFogPatchArea::myWindU
protected
float makVrv::DtGroundFogPatchArea::myWindV
protected
double makVrv::DtGroundFogPatchArea::myLastWindTime
protected
bool makVrv::DtGroundFogPatchArea::myCameraBasisDirty
protected
bool makVrv::DtGroundFogPatchArea::myInitialized
protected
bool makVrv::DtGroundFogPatchArea::myClampingEnabled
protected
int makVrv::DtGroundFogPatchArea::myClampIndex
protected
int makVrv::DtGroundFogPatchArea::myClampBoneIndex
protected
float makVrv::DtGroundFogPatchArea::myMaxClampOffset
protected
float makVrv::DtGroundFogPatchArea::myBaseColorR
protected
float makVrv::DtGroundFogPatchArea::myBaseColorG
protected
float makVrv::DtGroundFogPatchArea::myBaseColorB
protected
float makVrv::DtGroundFogPatchArea::myParticleSizeVariation
protected
float makVrv::DtGroundFogPatchArea::myPatternedLook
protected
AreaType makVrv::DtGroundFogPatchArea::myAreaType
protected
MeshGroup* makVrv::DtGroundFogPatchArea::myMeshGroup
protected
DtGlVaoManager* makVrv::DtGroundFogPatchArea::myVaoManager
protected
osg::Vec3d makVrv::DtGroundFogPatchArea::myPosition
protected
float makVrv::DtGroundFogPatchArea::myOrientation
protected
osg::Vec3d makVrv::DtGroundFogPatchArea::myBasisPos
protected
osg::Matrixd makVrv::DtGroundFogPatchArea::myBasisRot
protected
float makVrv::DtGroundFogPatchArea::myBoundsX
protected
float makVrv::DtGroundFogPatchArea::myBoundsY
protected
float makVrv::DtGroundFogPatchArea::myBoundsCornerRadius
protected
const double makVrv::DtGroundFogPatchArea::DT_GFP_CLAMP_DISTANCE
staticprotected
const int makVrv::DtGroundFogPatchArea::DT_GFP_CELL_SIZE
staticprotected
int makVrv::DtGroundFogPatchArea::myGridSize
protected
float makVrv::DtGroundFogPatchArea::myPatchWorldSize
protected
std::vector<DtGroundFogPatch*> makVrv::DtGroundFogPatchArea::myPatches
protected
int makVrv::DtGroundFogPatchArea::myPatchCount
protected
DtGroundFogPatch** makVrv::DtGroundFogPatchArea::myRenderPatches
protected
int makVrv::DtGroundFogPatchArea::myRenderPatchCount
protected
std::vector<DtGroundFogEffect*> makVrv::DtGroundFogPatchArea::myEffects
protected

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

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)