Miscellaneous Functions
[Base]


Functions

template<class VecPntT>
UInt32 osg::getMaxIndexAbs3 (const VecPntT &v)
Int32 osg::putenv (Char8 *string)
void osg::osgsleep (UInt32 millisecs)
Real32 osg::osgrand (void)
bool osg::osgIsBigEndian (void)

Detailed Description

ToDo

Function Documentation

template<class VecPntT>
UInt32 osg::getMaxIndexAbs3 ( const VecPntT &  v  )  [inline]

find the index that has the largest absolute value for a vec3/pnt3

Definition at line 1298 of file OSGBaseFunctions.inl.

References osg::osgabs().

Referenced by osg::Plane::transform().

01299 {
01300     return 
01301         osgabs(v[0]) > osgabs(v[1]) ?
01302             (osgabs(v[0]) > osgabs(v[2]) ? 0 : 2) : 
01303             (osgabs(v[1]) > osgabs(v[2]) ? 1 : 2);
01304 }

Int32 osg::putenv ( Char8 *  string  )  [inline]

Definition at line 1311 of file OSGBaseFunctions.inl.

01312 {
01313 #if !defined(WIN32) || defined(BCC)
01314     return ::putenv(string);
01315 #else
01316     return ::_putenv(string);
01317 #endif
01318 }

void osg::osgsleep ( UInt32  millisecs  )  [inline]

Definition at line 1326 of file OSGBaseFunctions.inl.

Referenced by osg::getTimeStampFreq(), and osg::SceneFileHandler::readProgress().

01327 {
01328 #ifdef WIN32
01329     Sleep(millisecs);
01330 #else
01331 
01332 #if 0 // replaced by nanosleep to work around IRIX problems
01333     // Rough aproximation, have to find a better way soon (GV)
01334 
01335     if( (millisecs * 1000) > 1000000)
01336     {
01337         ::sleep(millisecs / 1000);
01338     }
01339     else
01340     {
01341         ::usleep(millisecs * 1000);
01342     }
01343     
01344 #else
01345 
01346     struct timespec req;
01347     int ns;
01348     
01349     req.tv_sec = static_cast<long>(millisecs / 1000);
01350     req.tv_nsec = static_cast<long>((millisecs % 1000) * 1000);
01351     
01352     while((req.tv_sec > 0 || req.tv_nsec > 0) &&
01353           (ns = nanosleep(&req, &req)) < 0)
01354     {
01355         if(ns < 0 && errno != EINTR)
01356         {
01357             break;
01358         }
01359     }
01360         
01361 #endif
01362 #endif
01363 }

Real32 osg::osgrand ( void   )  [inline]

get a random value between 0 and 1

Definition at line 1371 of file OSGBaseFunctions.inl.

01372 {
01373     return rand() / (Real32) RAND_MAX;
01374 }

bool osg::osgIsBigEndian ( void   )  [inline]

return true if the current system is big endian

Definition at line 1381 of file OSGBaseFunctions.inl.

References BIG_ENDIAN, and BYTE_ORDER.

Referenced by ImageOpen().

01382 {
01383     return (BYTE_ORDER) == (BIG_ENDIAN);   
01384 }


Generated on Mon Mar 17 12:02:54 2008 for OpenSG by  doxygen 1.5.5