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 1461 of file OSGBaseFunctions.inl.

References osg::osgabs().

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

01462 {
01463     return 
01464         osgabs(v[0]) > osgabs(v[1]) ?
01465             (osgabs(v[0]) > osgabs(v[2]) ? 0 : 2) : 
01466             (osgabs(v[1]) > osgabs(v[2]) ? 1 : 2);
01467 }

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

Definition at line 1474 of file OSGBaseFunctions.inl.

01475 {
01476 #if !defined(WIN32) || defined(BCC)
01477     return ::putenv(string);
01478 #else
01479     return ::_putenv(string);
01480 #endif
01481 }

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

Definition at line 1489 of file OSGBaseFunctions.inl.

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

01490 {
01491 #ifdef WIN32
01492     Sleep(millisecs);
01493 #else
01494 
01495 #if 0 // replaced by nanosleep to work around IRIX problems
01496     // Rough aproximation, have to find a better way soon (GV)
01497 
01498     if( (millisecs * 1000) > 1000000)
01499     {
01500         ::sleep(millisecs / 1000);
01501     }
01502     else
01503     {
01504         ::usleep(millisecs * 1000);
01505     }
01506     
01507 #else
01508 
01509     struct timespec req;
01510     int ns;
01511     
01512     req.tv_sec = static_cast<long>(millisecs / 1000);
01513     req.tv_nsec = static_cast<long>((millisecs % 1000) * 1000);
01514     
01515     while((req.tv_sec > 0 || req.tv_nsec > 0) &&
01516           (ns = nanosleep(&req, &req)) < 0)
01517     {
01518         if(ns < 0 && errno != EINTR)
01519         {
01520             break;
01521         }
01522     }
01523         
01524 #endif
01525 #endif
01526 }

Real32 osg::osgrand ( void   )  [inline]

get a random value between 0 and 1

Definition at line 1534 of file OSGBaseFunctions.inl.

01535 {
01536     return rand() / Real32(RAND_MAX);
01537 }

bool osg::osgIsBigEndian ( void   )  [inline]

return true if the current system is big endian

Definition at line 1544 of file OSGBaseFunctions.inl.

References BIG_ENDIAN, and BYTE_ORDER.

Referenced by ImageOpen().

01545 {
01546     return (BYTE_ORDER) == (BIG_ENDIAN);   
01547 }


Generated on 8 Feb 2010 for OpenSG by  doxygen 1.6.1