Replaced use of unsigned int/enum mask combinations with int/enum mask combinations to avoid the need for casting enums to unsigned ints,

and to avoid associated warnings.

Update wrappers to reflect these changes.
This commit is contained in:
Robert Osfield
2010-03-05 12:55:08 +00:00
parent 273420bb1c
commit 86f491e649
16 changed files with 84 additions and 107 deletions

View File

@@ -79,14 +79,16 @@ class OSG_EXPORT CullSettings
READ_BUFFER = (0x1 << 18),
NO_VARIABLES = 0x00000000,
ALL_VARIABLES = 0xFFFFFFFF
ALL_VARIABLES = 0x7FFFFFFF
};
typedef int InheritanceMask;
/** Set the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/
void setInheritanceMask(unsigned int mask) { _inheritanceMask = mask; }
void setInheritanceMask(InheritanceMask mask) { _inheritanceMask = mask; }
/** Get the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object.*/
unsigned int getInheritanceMask() const { return _inheritanceMask; }
InheritanceMask getInheritanceMask() const { return _inheritanceMask; }
/** Set the local cull settings values from specified CullSettings object.*/
void setCullSettings(const CullSettings& settings);
@@ -190,7 +192,7 @@ class OSG_EXPORT CullSettings
CLUSTER_CULLING
};
typedef unsigned int CullingMode;
typedef int CullingMode;
/** Set the culling mode for the CullVisitor to use.*/
void setCullingMode(CullingMode mode) { _cullingMode = mode; applyMaskAction(CULLING_MODE); }
@@ -244,7 +246,7 @@ class OSG_EXPORT CullSettings
protected:
unsigned int _inheritanceMask;
InheritanceMask _inheritanceMask;
InheritanceMaskActionOnAttributeSetting _inheritanceMaskActionOnAttributeSetting;
ComputeNearFarMode _computeNearFar;

View File

@@ -120,7 +120,7 @@ class OSG_EXPORT CullingSet : public Referenced
typedef std::vector<ShadowVolumeOccluder> OccluderList;
typedef unsigned int Mask;
typedef int Mask;
enum MaskValues
{
@@ -140,7 +140,7 @@ class OSG_EXPORT CullingSet : public Referenced
SMALL_FEATURE_CULLING|
SHADOW_OCCLUSION_CULLING
};
void setCullingMask(Mask mask) { _mask = mask; }
Mask getCullingMask() const { return _mask; }

View File

@@ -379,16 +379,16 @@ public:
MouseYOrientation getMouseYOrientation() const { return _mouseYOrientation; }
/// set current mouse button state.
void setButtonMask(unsigned int mask) { _buttonMask = mask; }
void setButtonMask(int mask) { _buttonMask = mask; }
/// get current mouse button state.
unsigned int getButtonMask() const { return _buttonMask; }
int getButtonMask() const { return _buttonMask; }
/// set modifier key mask.
void setModKeyMask(unsigned int mask) { _modKeyMask = mask; }
void setModKeyMask(int mask) { _modKeyMask = mask; }
/// get modifier key mask.
unsigned int getModKeyMask() const { return _modKeyMask; }
int getModKeyMask() const { return _modKeyMask; }
/// set scrolling motion (for EventType::SCROLL).
void setScrollingMotion(ScrollingMotion motion) { _scrolling.motion = motion; }
@@ -464,8 +464,8 @@ public:
float _Ymin,_Ymax;
float _mx;
float _my;
unsigned int _buttonMask;
unsigned int _modKeyMask;
int _buttonMask;
int _modKeyMask;
MouseYOrientation _mouseYOrientation;
struct Scrolling {

View File

@@ -260,15 +260,8 @@ public:
void setLoopPresentation(bool loop) { _loopPresentation = loop; }
bool getLoopPresentation() const { return _loopPresentation; }
void dispatchEvent(const KeyPosition& keyPosition);
enum ObjectMask
{
MOVIE = 1<<0,
OBJECTS = 1<<1,
ALL_OBJECTS = MOVIE | OBJECTS
};
void dispatchEvent(const KeyPosition& keyPosition);
protected:

View File

@@ -52,15 +52,12 @@ class ObjectRecordData : public osg::Object
META_Object( osgSim, ObjectRecordData );
enum Flags
{
DONT_DISPLAY_IN_DAYLIGHT = 0x80000000u >> 0,
DONT_DISPLAY_AT_DUSK = 0x80000000u >> 1,
DONT_DISPLAY_AT_NIGHT = 0x80000000u >> 2,
DONT_ILLUMINATE = 0x80000000u >> 3,
FLAT_SHADED = 0x80000000u >> 4,
GROUPS_SHADOW_OBJECT = 0x80000000u >> 5
};
static const unsigned int DONT_DISPLAY_IN_DAYLIGHT = 0x80000000u >> 0;
static const unsigned int DONT_DISPLAY_AT_DUSK = 0x80000000u >> 1;
static const unsigned int DONT_DISPLAY_AT_NIGHT = 0x80000000u >> 2;
static const unsigned int DONT_ILLUMINATE = 0x80000000u >> 3;
static const unsigned int FLAT_SHADED = 0x80000000u >> 4;
static const unsigned int GROUPS_SHADOW_OBJECT = 0x80000000u >> 5;
unsigned int _flags;
short _relativePriority;

View File

@@ -194,10 +194,10 @@ public:
@param dm Bitmask specifying which parts of the sphere segment should be drawn.
@see DrawMask
*/
void setDrawMask(DrawMask dm);
void setDrawMask(int dm);
/** Get the DrawMask */
DrawMask getDrawMask() const { return _drawMask; }
int getDrawMask() const { return _drawMask; }
/** Set the color of the surface. */
void setSurfaceColor(const osg::Vec4& c);
@@ -305,11 +305,11 @@ private:
int _density;
// Draw details
DrawMask _drawMask;
osg::Vec4 _surfaceColor;
osg::Vec4 _spokeColor;
osg::Vec4 _edgeLineColor;
osg::Vec4 _planeColor;
int _drawMask;
osg::Vec4 _surfaceColor;
osg::Vec4 _spokeColor;
osg::Vec4 _edgeLineColor;
osg::Vec4 _planeColor;
};
}

View File

@@ -38,16 +38,16 @@ public:
NORMAL_MAP = 16 //< Texture in unit 1 and vertex attribute array 6
};
typedef std::map<unsigned int, osg::ref_ptr<osg::StateSet> > StateSetMap;
typedef std::map<int, osg::ref_ptr<osg::StateSet> > StateSetMap;
ShaderGenCache() {};
void setStateSet(unsigned int stateMask, osg::StateSet *program);
osg::StateSet *getStateSet(unsigned int stateMask) const;
osg::StateSet *getOrCreateStateSet(unsigned int stateMask);
void setStateSet(int stateMask, osg::StateSet *program);
osg::StateSet *getStateSet(int stateMask) const;
osg::StateSet *getOrCreateStateSet(int stateMask);
protected:
osg::StateSet *createStateSet(unsigned int stateMask) const;
osg::StateSet *createStateSet(int stateMask) const;
mutable OpenThreads::Mutex _mutex;
StateSetMap _stateSetMap;