Changeset 11057
- Timestamp:
- 02/12/10 12:45:00 (3 years ago)
- Location:
- OpenSceneGraph/trunk
- Files:
-
- 4 modified
-
CMakeLists.txt (modified) (1 diff)
-
include/osg/Notify (modified) (2 diffs)
-
src/osg/Config.in (modified) (1 diff)
-
src/osg/Notify.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/CMakeLists.txt
r11055 r11057 264 264 #luigi#ENDIF(UNIX) 265 265 ######################################################################################################## 266 267 OPTION(OSG_NOTIFY_DISABLED "Set to ON to build OpenSceneGraph with the noitfy() disabled." OFF) 266 268 267 269 OPTION(OSG_USE_FLOAT_MATRIX "Set to ON to build OpenSceneGraph with float Matrix instead of double." OFF) -
OpenSceneGraph/trunk/include/osg/Notify
r11047 r11057 46 46 extern OSG_EXPORT NotifySeverity getNotifyLevel(); 47 47 48 /** is notification enabled, given the current setNotifyLevel() setting? */49 extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity);50 51 48 /** initialize notify level. */ 52 49 extern OSG_EXPORT bool initNotifyLevel(); 50 51 #ifdef OSG_NOTIFY_DISABLED 52 inline bool isNotifyEnabled(NotifySeverity) { return false; } 53 #else 54 /** is notification enabled, given the current setNotifyLevel() setting? */ 55 extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity); 56 #endif 53 57 54 58 /** notify messaging function for providing fatal through to verbose … … 77 81 78 82 #define OSG_NOTIFY(level) if (isNotifyEnabled(level)) osg::notify(level) 79 80 #if _DEBUG 81 #define OSG_DEBUG_NOTIFY(level) if (isNotifyEnabled(level)) osg::notify(level) 82 #else 83 // when using an optimized build use if (false) to tell the compiler to ignore the rest of the notify. 84 #define OSG_DEBUG_NOTIFY(level) if (false) osg::notify(level) 85 #endif 83 #define OSG_FATAL OSG_NOTIFY(osg::FALTAL) 84 #define OSG_WARN OSG_NOTIFY(osg::WARN) 85 #define OSG_NOTICE OSG_NOTIFY(osg::NOTICE) 86 #define OSG_INFO OSG_NOTIFY(osg::INFO) 87 #define OSG_DEBUG OSG_NOTIFY(osg::DEBUG_INFO) 86 88 87 89 /** Handler processing output of notification stream. It acts as a sink to -
OpenSceneGraph/trunk/src/osg/Config.in
r10772 r11057 24 24 #define OSG_CONFIG 1 25 25 26 #cmakedefine OSG_NOTIFY_DISABLED 26 27 #cmakedefine OSG_USE_FLOAT_MATRIX 27 28 #cmakedefine OSG_USE_FLOAT_PLANE -
OpenSceneGraph/trunk/src/osg/Notify.cpp
r10764 r11057 115 115 static osg::ApplicationUsageProxy Notify_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE, "OSG_NOTIFY_LEVEL <mode>", "FATAL | WARN | NOTICE | DEBUG_INFO | DEBUG_FP | DEBUG | INFO | ALWAYS"); 116 116 117 static bool s_NeedNotifyInit = true; 117 118 static osg::NotifySeverity g_NotifyLevel = osg::NOTICE; 118 119 static osg::NullStream *g_NullStream; … … 121 122 void osg::setNotifyLevel(osg::NotifySeverity severity) 122 123 { 123 osg::initNotifyLevel();124 if (s_NeedNotifyInit) osg::initNotifyLevel(); 124 125 g_NotifyLevel = severity; 125 126 } … … 128 129 osg::NotifySeverity osg::getNotifyLevel() 129 130 { 130 osg::initNotifyLevel();131 if (s_NeedNotifyInit) osg::initNotifyLevel(); 131 132 return g_NotifyLevel; 132 133 } … … 141 142 osg::NotifyHandler* osg::getNotifyHandler() 142 143 { 143 osg::initNotifyLevel();144 if (s_NeedNotifyInit) osg::initNotifyLevel(); 144 145 osg::NotifyStreamBuffer *buffer = static_cast<osg::NotifyStreamBuffer *>(g_NotifyStream->rdbuf()); 145 146 return buffer ? buffer->getNotifyHandler() : 0; … … 148 149 bool osg::initNotifyLevel() 149 150 { 150 static bool s_NotifyInit = false;151 151 static osg::NullStream s_NullStream; 152 152 static osg::NotifyStream s_NotifyStream; 153 154 if (s_NotifyInit) return true;155 153 156 154 g_NullStream = &s_NullStream; … … 194 192 buffer->setNotifyHandler(new StandardNotifyHandler); 195 193 196 s_N otifyInit = true;194 s_NeedNotifyInit = false; 197 195 198 196 return true; … … 200 198 } 201 199 200 #ifndef OSG_NOTIFY_DISABLED 202 201 bool osg::isNotifyEnabled( osg::NotifySeverity severity ) 203 202 { 203 if (s_NeedNotifyInit) osg::initNotifyLevel(); 204 204 return severity<=g_NotifyLevel; 205 205 } 206 #endif 206 207 207 208 std::ostream& osg::notify(const osg::NotifySeverity severity) 208 209 { 209 static bool initialized = false; 210 if (!initialized) 211 { 212 initialized = osg::initNotifyLevel(); 213 } 214 215 if (severity<=g_NotifyLevel) 210 if (s_NeedNotifyInit) osg::initNotifyLevel(); 211 212 if (osg::isNotifyEnabled(severity)) 216 213 { 217 214 g_NotifyStream->setCurrentSeverity(severity);
