OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
osgDB::SharedStateManager Class Reference

#include <SharedStateManager.h>

Inheritance diagram for osgDB::SharedStateManager:
Inheritance graph
[legend]
Collaboration diagram for osgDB::SharedStateManager:
Collaboration graph
[legend]

Classes

struct  CompareStateAttributes
 
struct  CompareStateSets
 

Public Types

enum  ShareMode {
  SHARE_NONE = 0, SHARE_STATIC_TEXTURES = 1<<0, SHARE_UNSPECIFIED_TEXTURES = 1<<1, SHARE_DYNAMIC_TEXTURES = 1<<2,
  SHARE_STATIC_STATESETS = 1<<3, SHARE_UNSPECIFIED_STATESETS = 1<<4, SHARE_DYNAMIC_STATESETS = 1<<5, SHARE_TEXTURES = SHARE_STATIC_TEXTURES | SHARE_UNSPECIFIED_TEXTURES,
  SHARE_STATESETS = SHARE_STATIC_STATESETS | SHARE_UNSPECIFIED_STATESETS, SHARE_ALL
}
 
- Public Types inherited from osg::NodeVisitor
enum  TraversalMode { TRAVERSE_NONE, TRAVERSE_PARENTS, TRAVERSE_ALL_CHILDREN, TRAVERSE_ACTIVE_CHILDREN }
 
enum  VisitorType {
  NODE_VISITOR = 0, UPDATE_VISITOR, EVENT_VISITOR, COLLECT_OCCLUDER_VISITOR,
  CULL_VISITOR, INTERSECTION_VISITOR
}
 
- Public Types inherited from osg::Object
enum  DataVariance { DYNAMIC, STATIC, UNSPECIFIED }
 

Public Member Functions

 SharedStateManager (unsigned int mode=SHARE_ALL)
 
 META_NodeVisitor (osgDB, SharedStateManager) void setShareMode(unsigned int mode)
 
unsigned int getShareMode ()
 
void prune ()
 
void share (osg::Node *node, OpenThreads::Mutex *mt=0)
 
void apply (osg::Node &node)
 
void apply (osg::Geode &geode)
 
bool isShared (osg::StateSet *stateSet)
 
bool isShared (osg::Texture *texture)
 
void releaseGLObjects (osg::State *state) const
 
- Public Member Functions inherited from osg::NodeVisitor
 NodeVisitor (TraversalMode tm=TRAVERSE_NONE)
 
 NodeVisitor (VisitorType type, TraversalMode tm=TRAVERSE_NONE)
 
 NodeVisitor (const NodeVisitor &nv, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 
virtual ~NodeVisitor ()
 
 META_Object (osg, NodeVisitor) virtual NodeVisitor *asNodeVisitor()
 
virtual const NodeVisitorasNodeVisitor () const
 
virtual void reset ()
 
void setVisitorType (VisitorType type)
 
VisitorType getVisitorType () const
 
void setTraversalNumber (unsigned int fn)
 
unsigned int getTraversalNumber () const
 
void setFrameStamp (FrameStamp *fs)
 
const FrameStampgetFrameStamp () const
 
void setTraversalMask (Node::NodeMask mask)
 
Node::NodeMask getTraversalMask () const
 
void setNodeMaskOverride (Node::NodeMask mask)
 
Node::NodeMask getNodeMaskOverride () const
 
bool validNodeMask (const osg::Node &node) const
 
void setTraversalMode (TraversalMode mode)
 
TraversalMode getTraversalMode () const
 
void traverse (Node &node)
 
void pushOntoNodePath (Node *node)
 
void popFromNodePath ()
 
NodePathgetNodePath ()
 
const NodePathgetNodePath () const
 
virtual osg::Vec3 getEyePoint () const
 
virtual osg::Vec3 getViewPoint () const
 
virtual float getDistanceToEyePoint (const Vec3 &, bool) const
 
virtual float getDistanceFromEyePoint (const Vec3 &, bool) const
 
virtual float getDistanceToViewPoint (const Vec3 &, bool) const
 
virtual void apply (Drawable &drawable)
 
virtual void apply (Geometry &geometry)
 
virtual void apply (Billboard &node)
 
virtual void apply (Group &node)
 
virtual void apply (ProxyNode &node)
 
virtual void apply (Projection &node)
 
virtual void apply (CoordinateSystemNode &node)
 
virtual void apply (ClipNode &node)
 
virtual void apply (TexGenNode &node)
 
virtual void apply (LightSource &node)
 
virtual void apply (Transform &node)
 
virtual void apply (Camera &node)
 
virtual void apply (CameraView &node)
 
virtual void apply (MatrixTransform &node)
 
virtual void apply (PositionAttitudeTransform &node)
 
virtual void apply (Switch &node)
 
virtual void apply (Sequence &node)
 
virtual void apply (LOD &node)
 
virtual void apply (PagedLOD &node)
 
virtual void apply (ClearNode &node)
 
virtual void apply (OccluderNode &node)
 
virtual void apply (OcclusionQueryNode &node)
 
void setDatabaseRequestHandler (DatabaseRequestHandler *handler)
 
DatabaseRequestHandlergetDatabaseRequestHandler ()
 
const DatabaseRequestHandlergetDatabaseRequestHandler () const
 
void setImageRequestHandler (ImageRequestHandler *handler)
 
ImageRequestHandlergetImageRequestHandler ()
 
const ImageRequestHandlergetImageRequestHandler () const
 
- Public Member Functions inherited from osg::Object
 Object ()
 
 Object (bool threadSafeRefUnref)
 
 Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 
virtual ObjectcloneType () const =0
 
virtual Objectclone (const CopyOp &) const =0
 
virtual bool isSameKindAs (const Object *) const
 
virtual const char * libraryName () const =0
 
virtual const char * className () const =0
 
std::string getCompoundClassName () const
 
virtual NodeasNode ()
 
virtual const NodeasNode () const
 
virtual NodeVisitorasNodeVisitor ()
 
virtual StateAttributeasStateAttribute ()
 
virtual const StateAttributeasStateAttribute () const
 
virtual UniformasUniform ()
 
virtual const UniformasUniform () const
 
virtual void setThreadSafeRefUnref (bool threadSafe)
 
virtual void setName (const std::string &name)
 
void setName (const char *name)
 
const std::string & getName () const
 
void setDataVariance (DataVariance dv)
 
DataVariance getDataVariance () const
 
virtual void computeDataVariance ()
 
void setUserDataContainer (osg::UserDataContainer *udc)
 
osg::UserDataContainergetUserDataContainer ()
 
const osg::UserDataContainergetUserDataContainer () const
 
osg::UserDataContainergetOrCreateUserDataContainer ()
 
virtual void setUserData (Referenced *obj)
 
virtual ReferencedgetUserData ()
 
virtual const ReferencedgetUserData () const
 
template<typename T >
bool getUserValue (const std::string &name, T &value) const
 
template<typename T >
void setUserValue (const std::string &name, const T &value)
 
virtual void resizeGLObjectBuffers (unsigned int)
 
template<typename T >
BoolValueObject
UCharValueObject
UShortValueObject
UIntValueObject
DoubleValueObject
Vec3fValueObject
Vec2dValueObject
Vec4dValueObject
PlaneValueObject
MatrixdValueObject
BoundingBoxdValueObject
BoundingSpheredValueObject
bool 
getUserValue (const std::string &name, T &value) const
 
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 
 Referenced (bool threadSafeRefUnref)
 
 Referenced (const Referenced &)
 
Referencedoperator= (const Referenced &)
 
bool getThreadSafeRefUnref () const
 
OpenThreads::MutexgetRefMutex () const
 
int ref () const
 
int unref () const
 
int unref_nodelete () const
 
int referenceCount () const
 
ObserverSetgetObserverSet () const
 
ObserverSetgetOrCreateObserverSet () const
 
void addObserver (Observer *observer) const
 
void removeObserver (Observer *observer) const
 

Protected Types

typedef std::set< osg::ref_ptr
< osg::StateAttribute >
, CompareStateAttributes
TextureSet
 
typedef std::set< osg::ref_ptr
< osg::StateSet >
, CompareStateSets
StateSetSet
 
typedef std::pair
< osg::StateAttribute *, bool > 
TextureSharePair
 
typedef std::map
< osg::StateAttribute
*, TextureSharePair
TextureTextureSharePairMap
 
typedef std::pair
< osg::StateSet *, bool > 
StateSetSharePair
 
typedef std::map
< osg::StateSet
*, StateSetSharePair
StateSetStateSetSharePairMap
 

Protected Member Functions

bool shareTexture (osg::Object::DataVariance variance)
 
bool shareStateSet (osg::Object::DataVariance variance)
 
void process (osg::StateSet *ss, osg::Object *parent)
 
osg::StateAttributefind (osg::StateAttribute *sa)
 
osg::StateSetfind (osg::StateSet *ss)
 
void setStateSet (osg::StateSet *ss, osg::Object *object)
 
void shareTextures (osg::StateSet *ss)
 
- Protected Member Functions inherited from osg::Object
virtual ~Object ()
 
- Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
 
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
 
void deleteUsingDeleteHandler () const
 

Protected Attributes

TextureSet _sharedTextureList
 
StateSetSet _sharedStateSetList
 
TextureTextureSharePairMap tmpSharedTextureList
 
StateSetStateSetSharePairMap tmpSharedStateSetList
 
unsigned int _shareMode
 
bool _shareTexture [3]
 
bool _shareStateSet [3]
 
OpenThreads::Mutex_mutex
 
OpenThreads::Mutex _listMutex
 
- Protected Attributes inherited from osg::NodeVisitor
VisitorType _visitorType
 
unsigned int _traversalNumber
 
ref_ptr< FrameStamp_frameStamp
 
TraversalMode _traversalMode
 
Node::NodeMask _traversalMask
 
Node::NodeMask _nodeMaskOverride
 
NodePath _nodePath
 
ref_ptr< DatabaseRequestHandler_databaseRequestHandler
 
ref_ptr< ImageRequestHandler_imageRequestHandler
 
- Protected Attributes inherited from osg::Object
std::string _name
 
DataVariance _dataVariance
 
osg::UserDataContainer_userDataContainer
 
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
 
OpenThreads::Atomic _refCount
 

Additional Inherited Members

- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::MutexgetGlobalReferencedMutex ()
 
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 
static bool getThreadSafeReferenceCounting ()
 
static void setDeleteHandler (DeleteHandler *handler)
 
static DeleteHandlergetDeleteHandler ()
 

Detailed Description

Definition at line 30 of file SharedStateManager.h.

Member Typedef Documentation

Definition at line 116 of file SharedStateManager.h.

typedef std::pair<osg::StateSet*, bool> osgDB::SharedStateManager::StateSetSharePair
protected

Definition at line 124 of file SharedStateManager.h.

Definition at line 125 of file SharedStateManager.h.

Definition at line 113 of file SharedStateManager.h.

Definition at line 120 of file SharedStateManager.h.

Definition at line 121 of file SharedStateManager.h.

Member Enumeration Documentation

Enumerator
SHARE_NONE 
SHARE_STATIC_TEXTURES 
SHARE_UNSPECIFIED_TEXTURES 
SHARE_DYNAMIC_TEXTURES 
SHARE_STATIC_STATESETS 
SHARE_UNSPECIFIED_STATESETS 
SHARE_DYNAMIC_STATESETS 
SHARE_TEXTURES 
SHARE_STATESETS 
SHARE_ALL 

Definition at line 34 of file SharedStateManager.h.

Constructor & Destructor Documentation

osgDB::SharedStateManager::SharedStateManager ( unsigned int  mode = SHARE_ALL)

Member Function Documentation

void osgDB::SharedStateManager::apply ( osg::Node node)
virtual

Reimplemented from osg::NodeVisitor.

void osgDB::SharedStateManager::apply ( osg::Geode geode)
virtual

Reimplemented from osg::NodeVisitor.

osg::StateAttribute* osgDB::SharedStateManager::find ( osg::StateAttribute sa)
protected
osg::StateSet* osgDB::SharedStateManager::find ( osg::StateSet ss)
protected
unsigned int osgDB::SharedStateManager::getShareMode ( )
inline

Definition at line 55 of file SharedStateManager.h.

bool osgDB::SharedStateManager::isShared ( osg::StateSet stateSet)
bool osgDB::SharedStateManager::isShared ( osg::Texture texture)
osgDB::SharedStateManager::META_NodeVisitor ( osgDB  ,
SharedStateManager   
)
void osgDB::SharedStateManager::process ( osg::StateSet ss,
osg::Object parent 
)
protected
void osgDB::SharedStateManager::prune ( )
void osgDB::SharedStateManager::releaseGLObjects ( osg::State ) const
virtual

If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. Otherwise, releases OpenGL objects for all graphics contexts.

Reimplemented from osg::Object.

void osgDB::SharedStateManager::setStateSet ( osg::StateSet ss,
osg::Object object 
)
protected
void osgDB::SharedStateManager::share ( osg::Node node,
OpenThreads::Mutex mt = 0 
)
bool osgDB::SharedStateManager::shareStateSet ( osg::Object::DataVariance  variance)
inlineprotected

Definition at line 82 of file SharedStateManager.h.

bool osgDB::SharedStateManager::shareTexture ( osg::Object::DataVariance  variance)
inlineprotected

Definition at line 77 of file SharedStateManager.h.

void osgDB::SharedStateManager::shareTextures ( osg::StateSet ss)
protected

Member Data Documentation

OpenThreads::Mutex osgDB::SharedStateManager::_listMutex
mutableprotected

Definition at line 136 of file SharedStateManager.h.

OpenThreads::Mutex* osgDB::SharedStateManager::_mutex
protected

Definition at line 134 of file SharedStateManager.h.

StateSetSet osgDB::SharedStateManager::_sharedStateSetList
protected

Definition at line 117 of file SharedStateManager.h.

TextureSet osgDB::SharedStateManager::_sharedTextureList
protected

Definition at line 114 of file SharedStateManager.h.

unsigned int osgDB::SharedStateManager::_shareMode
protected

Definition at line 128 of file SharedStateManager.h.

bool osgDB::SharedStateManager::_shareStateSet[3]
protected

Definition at line 130 of file SharedStateManager.h.

bool osgDB::SharedStateManager::_shareTexture[3]
protected

Definition at line 129 of file SharedStateManager.h.

StateSetStateSetSharePairMap osgDB::SharedStateManager::tmpSharedStateSetList
protected

Definition at line 126 of file SharedStateManager.h.

TextureTextureSharePairMap osgDB::SharedStateManager::tmpSharedTextureList
protected

Definition at line 122 of file SharedStateManager.h.


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