14#ifndef OSG_CONTEXTDATA
15#define OSG_CONTEXTDATA 1
29 void setNumContexts(
unsigned int numContexts) { _numContexts = numContexts; }
40 const std::type_info* id(&
typeid(T));
44 ptr =
new T(_contextID);
46 return static_cast<T*
>(ptr.
get());
55 const std::type_info* id(&
typeid(T));
56 ManagerMap::const_iterator itr = _managerMap.find(
id);
57 if (itr==_managerMap.end())
return 0;
58 else return itr->second.get();
65 const std::type_info* id(&
typeid(T));
66 _managerMap[id] = ptr;
140 typedef std::map<const std::type_info*, osg::ref_ptr<osg::Referenced> >
ManagerMap;
152inline T*
get(
unsigned int contextID)
Definition ContextData:22
virtual void reportStats(std::ostream &out)
void setNumContexts(unsigned int numContexts)
Definition ContextData:29
unsigned int getNumContexts() const
Definition ContextData:30
static void decrementContextIDUsageCount(unsigned int contextID)
void set(T *ptr)
Definition ContextData:63
unsigned int _numContexts
Definition ContextData:136
virtual void deleteAllGLObjects()
virtual void resetStats()
virtual void flushAllDeletedGLObjects()
virtual void recomputeStats(std::ostream &out) const
static void incrementContextIDUsageCount(unsigned int contextID)
static GraphicsContext * getCompileContext(unsigned int contextID)
std::map< const std::type_info *, osg::ref_ptr< osg::Referenced > > ManagerMap
Definition ContextData:140
const T * get() const
Definition ContextData:53
virtual void discardAllGLObjects()
osg::GraphicsContext * getCompileContext()
Definition ContextData:33
static void registerGraphicsContext(GraphicsContext *gc)
virtual void newFrame(osg::FrameStamp *)
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)
ManagerMap _managerMap
Definition ContextData:141
osg::ref_ptr< osg::GraphicsContext > _compileContext
Definition ContextData:137
void setCompileContext(osg::GraphicsContext *gc)
Definition ContextData:32
static GraphicsContexts getAllRegisteredGraphicsContexts()
static void unregisterGraphicsContext(GraphicsContext *gc)
void decrementUsageCount()
Definition ContextData:27
static unsigned int createNewContextID()
static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID)
static unsigned int getMaxContextID()
ContextData(unsigned int contextID)
T * get()
Definition ContextData:38
GraphicsContext::GraphicsContexts GraphicsContexts
Definition ContextData:110
static void setCompileContext(unsigned int contextID, GraphicsContext *gc)
static GraphicsContext * getOrCreateCompileContext(unsigned int contextID)
void incrementUsageCount()
Definition ContextData:26
Definition GraphicsContext:30
std::vector< GraphicsContext * > GraphicsContexts
Definition GraphicsContext:272
T * get() const
Definition ref_ptr:117
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
ContextData * get< ContextData >(unsigned int contextID)
Definition ContextData:159
OSG_EXPORT ContextData * getContextData(unsigned int contextID)
OSG_EXPORT ContextData * getOrCreateContextData(unsigned int contextID)
T * get(unsigned int contextID)
Definition ContextData:152
#define OSG_EXPORT
Definition osg/Export:39