VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtStreamedSpeedTreeThread Class Reference

Thread object to convert tree marker requests into tree records in a worker thread. More...

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

Classes

class  TreeRequestMsg
 A message to convert some tree requests into tree records. More...
 
struct  TreeRequestOutput
 Output of a processed set of marker requests. More...
 

Public Types

enum  RequestStatus { UNUSED, WORKING, DONE }
 Status of a request to convert markers. More...
 
typedef std::list
< TreeRequestOutput
RequestOutputList
 List type for output objects. More...
 
typedef boost::unordered_set
< const osg::Node * > 
NodeSet
 Set of request nodes. More...
 
typedef boost::unordered_set
< DtStreamedSpeedTreeForest * > 
ForestSet
 Set of forests. More...
 
typedef boost::unordered_set
< std::string > 
StringSet
 Set of model definition names. More...
 

Public Member Functions

virtual ~DtStreamedSpeedTreeThread ()
 DTOR. More...
 
RequestOutputListrequestOutput ()
 List of allocated output objects. More...
 
NodeSetunloaded ()
 Set of unloaded feature request nodes. More...
 
void setForestDeleted (DtStreamedSpeedTreeForest *forest)
 Add a forest object to the deleted set. More...
 
void setNodeUnloaded (const osg::Node *node)
 Add a node to the unloaded set. More...
 
void enqueue (const osgEarth::CustomFeatureNode *featureNode, TreeRequestOutput *out, DtStreamedSpeedTreeForest *forest, const osg::Node *dataNode, bool useScaleRandomization, bool useOrientationRandomization, float treeMinScale, float treeMaxScale)
 Enqueue a new request message. More...
 
virtual void run ()
 Thread main loop. More...
 
void handleRequest (const TreeRequestMsg &msg)
 Process the message into tree records. More...
 
bool isForestDeleted (DtStreamedSpeedTreeForest *forest)
 Check whether a forest is in the deleted set. More...
 
bool isNodeUnloaded (const osg::Node *node)
 Check whether a node is in the unloaded set. More...
 
void mergeTreeRequests (osg::RenderInfo &renderInfo)
 Callback to merge processed tree requests into a SpeedTree forest called by persistent job. More...
 
void block ()
 Wait, don't process more trees. More...
 
void release ()
 Allow more tree processing. More...
 
virtual void updateBlock ()
 Tell the SpeedTreeThread there are more trees to process. More...
 
virtual void stopMergingWork ()
 Tell the SpeedTreeThread merging code to wait till next frame. More...
 
virtual bool workToDo ()
 check if there is work for this thread to merge More...
 
virtual bool fetchAndActivateTask ()
 Return the current task active value and set it to true. More...
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 Do nothing constructor. More...
 
virtual ~DtVirtualBaseClass ()
 Virtual do nothing destructor. More...
 

Static Public Member Functions

static DtStreamedSpeedTreeThreadinstance (DtDe &de)
 Get the instance of the thread object from its owner de. More...
 
static std::size_t hash_value (const std::string &modelDefName, const osgEarth::CustomFeatureNode::OsgEarthMarkerRequest &val)
 Marker request hash function. More...
 

Protected Member Functions

 DtStreamedSpeedTreeThread (DtDe &de)
 CTOR. More...
 
virtual double rotationAngleFromGeocentricQuaternion (const osg::Quat &rotation, const osg::Vec3d &location)
 

Protected Attributes

DtDemyDe
 
std::deque< TreeRequestMsg * > myMessageQueue
 Queue of marker request messages. More...
 
OpenThreads::Block myBlock
 
boost::mutex myMessageQueueMutex
 Mutex controlling access to q. More...
 
StringSet myValidModelDefinitions
 Cache of valid SpeedTree model definitions. More...
 
ForestSet myDeletedForests
 Set of deleted forest objects. More...
 
RequestOutputList myTreeRequestOutput
 List of allocated output objects. More...
 
NodeSet myUnloadedNodes
 Set of unloaded feature request nodes. More...
 
bool myTimeToStop
 Flag to tell the thread to stop. More...
 
osg::EllipsoidModel * myEllipsoidModel
 
tbb::atomic< boolmyStopWork
 Flag to tell the merging to stop. More...
 
tbb::atomic< boolmyWorkToDo
 
tbb::atomic< boolmyTbbTaskActive
 

Private Member Functions

 DtStreamedSpeedTreeThread ()
 Unimplemented default CTOR. More...
 

Detailed Description

Thread object to convert tree marker requests into tree records in a worker thread.

Member Typedef Documentation

List type for output objects.

typedef boost::unordered_set<const osg::Node*> makVrv::DtStreamedSpeedTreeThread::NodeSet

Set of request nodes.

Set of forests.

typedef boost::unordered_set<std::string> makVrv::DtStreamedSpeedTreeThread::StringSet

Set of model definition names.

Member Enumeration Documentation

Status of a request to convert markers.

Enumerator
UNUSED 
WORKING 
DONE 

Constructor & Destructor Documentation

virtual makVrv::DtStreamedSpeedTreeThread::~DtStreamedSpeedTreeThread ( )
virtual

DTOR.

makVrv::DtStreamedSpeedTreeThread::DtStreamedSpeedTreeThread ( DtDe de)
protected

CTOR.

makVrv::DtStreamedSpeedTreeThread::DtStreamedSpeedTreeThread ( )
private

Unimplemented default CTOR.

Member Function Documentation

static DtStreamedSpeedTreeThread& makVrv::DtStreamedSpeedTreeThread::instance ( DtDe de)
static

Get the instance of the thread object from its owner de.

RequestOutputList& makVrv::DtStreamedSpeedTreeThread::requestOutput ( )

List of allocated output objects.

Requestors should find an unused output object if possible and if not, push a new one to the end of the list

NodeSet& makVrv::DtStreamedSpeedTreeThread::unloaded ( )

Set of unloaded feature request nodes.

Requestors should add nodes to this set when they are deleted to prevent adding trees after deletion

void makVrv::DtStreamedSpeedTreeThread::setForestDeleted ( DtStreamedSpeedTreeForest forest)

Add a forest object to the deleted set.

void makVrv::DtStreamedSpeedTreeThread::setNodeUnloaded ( const osg::Node *  node)

Add a node to the unloaded set.

void makVrv::DtStreamedSpeedTreeThread::enqueue ( const osgEarth::CustomFeatureNode featureNode,
TreeRequestOutput out,
DtStreamedSpeedTreeForest forest,
const osg::Node *  dataNode,
bool  useScaleRandomization,
bool  useOrientationRandomization,
float  treeMinScale,
float  treeMaxScale 
)

Enqueue a new request message.

virtual void makVrv::DtStreamedSpeedTreeThread::run ( )
virtual

Thread main loop.

void makVrv::DtStreamedSpeedTreeThread::handleRequest ( const TreeRequestMsg msg)

Process the message into tree records.

bool makVrv::DtStreamedSpeedTreeThread::isForestDeleted ( DtStreamedSpeedTreeForest forest)

Check whether a forest is in the deleted set.

bool makVrv::DtStreamedSpeedTreeThread::isNodeUnloaded ( const osg::Node *  node)

Check whether a node is in the unloaded set.

static std::size_t makVrv::DtStreamedSpeedTreeThread::hash_value ( const std::string &  modelDefName,
const osgEarth::CustomFeatureNode::OsgEarthMarkerRequest val 
)
static

Marker request hash function.

Hashes on request name and XYZ position

void makVrv::DtStreamedSpeedTreeThread::mergeTreeRequests ( osg::RenderInfo &  renderInfo)

Callback to merge processed tree requests into a SpeedTree forest called by persistent job.

void makVrv::DtStreamedSpeedTreeThread::block ( )

Wait, don't process more trees.

void makVrv::DtStreamedSpeedTreeThread::release ( )

Allow more tree processing.

virtual void makVrv::DtStreamedSpeedTreeThread::updateBlock ( )
virtual

Tell the SpeedTreeThread there are more trees to process.

virtual void makVrv::DtStreamedSpeedTreeThread::stopMergingWork ( )
virtual

Tell the SpeedTreeThread merging code to wait till next frame.

virtual bool makVrv::DtStreamedSpeedTreeThread::workToDo ( )
virtual

check if there is work for this thread to merge

virtual bool makVrv::DtStreamedSpeedTreeThread::fetchAndActivateTask ( )
virtual

Return the current task active value and set it to true.

virtual double makVrv::DtStreamedSpeedTreeThread::rotationAngleFromGeocentricQuaternion ( const osg::Quat &  rotation,
const osg::Vec3d &  location 
)
protectedvirtual

Member Data Documentation

DtDe& makVrv::DtStreamedSpeedTreeThread::myDe
protected
std::deque<TreeRequestMsg*> makVrv::DtStreamedSpeedTreeThread::myMessageQueue
protected

Queue of marker request messages.

Lock qm before using

OpenThreads::Block makVrv::DtStreamedSpeedTreeThread::myBlock
protected
boost::mutex makVrv::DtStreamedSpeedTreeThread::myMessageQueueMutex
protected

Mutex controlling access to q.

StringSet makVrv::DtStreamedSpeedTreeThread::myValidModelDefinitions
protected

Cache of valid SpeedTree model definitions.

Allows filtering out requests with invalid model definitions

ForestSet makVrv::DtStreamedSpeedTreeThread::myDeletedForests
protected

Set of deleted forest objects.

The forest object adds itself here on deletion to avoid adding trees to a deleted forest

RequestOutputList makVrv::DtStreamedSpeedTreeThread::myTreeRequestOutput
protected

List of allocated output objects.

Requestors should find an unused output object if possible and if not, push a new one to the end of the list

NodeSet makVrv::DtStreamedSpeedTreeThread::myUnloadedNodes
protected

Set of unloaded feature request nodes.

Requestors should add nodes to this set when they are deleted to prevent adding trees after deletion

bool makVrv::DtStreamedSpeedTreeThread::myTimeToStop
protected

Flag to tell the thread to stop.

osg::EllipsoidModel* makVrv::DtStreamedSpeedTreeThread::myEllipsoidModel
protected
tbb::atomic< bool> makVrv::DtStreamedSpeedTreeThread::myStopWork
protected

Flag to tell the merging to stop.

tbb::atomic< bool> makVrv::DtStreamedSpeedTreeThread::myWorkToDo
protected
tbb::atomic< bool> makVrv::DtStreamedSpeedTreeThread::myTbbTaskActive
protected

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

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)