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:
parent
3ef40a2301
commit
c10acfcc47
@ -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
|
||||
};
|
||||
|
||||
|
@ -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 |
|
||||
|
@ -28,30 +28,30 @@ class OSGGA_EXPORT GUIEventAdapter : public osg::Object
|
||||
public:
|
||||
|
||||
enum MouseButtonMask {
|
||||
LEFT_MOUSE_BUTTON=1,
|
||||
MIDDLE_MOUSE_BUTTON=2,
|
||||
RIGHT_MOUSE_BUTTON=4
|
||||
LEFT_MOUSE_BUTTON = 1<<0,
|
||||
MIDDLE_MOUSE_BUTTON = 1<<1,
|
||||
RIGHT_MOUSE_BUTTON = 1<<2
|
||||
};
|
||||
|
||||
enum EventType {
|
||||
NONE=0,
|
||||
PUSH=1,
|
||||
RELEASE=2,
|
||||
DOUBLECLICK=4,
|
||||
DRAG=8,
|
||||
MOVE=16,
|
||||
KEYDOWN=32,
|
||||
KEYUP=64,
|
||||
FRAME=128,
|
||||
RESIZE=256,
|
||||
SCROLL=512,
|
||||
PEN_PRESSURE=1024,
|
||||
PEN_ORIENTATION=2048,
|
||||
PEN_PROXIMITY_ENTER=4096,
|
||||
PEN_PROXIMITY_LEAVE=8192,
|
||||
CLOSE_WINDOW=16384,
|
||||
QUIT_APPLICATION=32768,
|
||||
USER=65536
|
||||
NONE = 0,
|
||||
PUSH = 1<<0,
|
||||
RELEASE = 1<<1,
|
||||
DOUBLECLICK = 1<<2,
|
||||
DRAG = 1<<3,
|
||||
MOVE = 1<<4,
|
||||
KEYDOWN = 1<<5,
|
||||
KEYUP = 1<<6,
|
||||
FRAME = 1<<7,
|
||||
RESIZE = 1<<8,
|
||||
SCROLL = 1<<9,
|
||||
PEN_PRESSURE = 1<<10,
|
||||
PEN_ORIENTATION = 1<<11,
|
||||
PEN_PROXIMITY_ENTER = 1<<12,
|
||||
PEN_PROXIMITY_LEAVE = 1<<13,
|
||||
CLOSE_WINDOW = 1<<14,
|
||||
QUIT_APPLICATION = 1<<15,
|
||||
USER = 1<<16
|
||||
};
|
||||
|
||||
enum KeySymbol
|
||||
|
Loading…
Reference in New Issue
Block a user