From Bob Kuehne, "he attached are conversions of the 3 main places i found in osg where tokens are used to represent bitmasks with 'magic' numbers, like 32. i've changed these to a more representative bitshift representation, showing clearly in which bit you can expect this token to manifest. ie, converted things like:

from:            DEEP_COPY_STATESETS         = 8,
to:              DEEP_COPY_STATESETS         = 1<<3,

showing clearly that this isn't the _value_ 8, but the _bit_ 8. this is an old pattern i see (and like to promulgate) to make code a bit more readable and maintainable. 
"
This commit is contained in:
Robert Osfield
2008-04-16 15:23:12 +00:00
parent 3ef40a2301
commit c10acfcc47
3 changed files with 38 additions and 38 deletions

View File

@@ -61,22 +61,22 @@ class OSGDB_EXPORT ReaderWriter : public osg::Object
CACHE_NONE = 0,
/// cache nodes loaded via readNode(filename)
CACHE_NODES = 1,
CACHE_NODES = 1<<0,
/// cache images loaded via readImage(filename)
CACHE_IMAGES = 2,
CACHE_IMAGES = 1<<1,
/// cache heightfield loaded via readHeightField(filename)
CACHE_HEIGHTFIELDS = 4,
CACHE_HEIGHTFIELDS = 1<<2,
/// cache heightfield loaded via readHeightField(filename)
CACHE_ARCHIVES = 8,
CACHE_ARCHIVES = 1<<3,
/// cache objects loaded via readObject(filename)
CACHE_OBJECTS = 16,
CACHE_OBJECTS = 1<<4,
/// cache shaders loaded via readShader(filename)
CACHE_SHADERS = 32,
CACHE_SHADERS = 1<<5,
/// cache on all read*(filename) calls
CACHE_ALL = CACHE_NODES |