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

@@ -41,17 +41,17 @@ class OSG_EXPORT CopyOp
enum Options
{
SHALLOW_COPY = 0,
DEEP_COPY_OBJECTS = 1,
DEEP_COPY_NODES = 2,
DEEP_COPY_DRAWABLES = 4,
DEEP_COPY_STATESETS = 8,
DEEP_COPY_STATEATTRIBUTES = 16,
DEEP_COPY_TEXTURES = 32,
DEEP_COPY_IMAGES = 64,
DEEP_COPY_ARRAYS = 128,
DEEP_COPY_PRIMITIVES = 256,
DEEP_COPY_SHAPES = 512,
DEEP_COPY_UNIFORMS = 1024,
DEEP_COPY_OBJECTS = 1<<0,
DEEP_COPY_NODES = 1<<1,
DEEP_COPY_DRAWABLES = 1<<2,
DEEP_COPY_STATESETS = 1<<3,
DEEP_COPY_STATEATTRIBUTES = 1<<4,
DEEP_COPY_TEXTURES = 1<<5,
DEEP_COPY_IMAGES = 1<<6,
DEEP_COPY_ARRAYS = 1<<7,
DEEP_COPY_PRIMITIVES = 1<<8,
DEEP_COPY_SHAPES = 1<<9,
DEEP_COPY_UNIFORMS = 1<<10,
DEEP_COPY_ALL = 0xffffffff
};