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;

View File

@ -874,7 +874,7 @@ bool SphereSegment::Spoke_computeBound(osg::BoundingBox& bbox, BoundaryAngle azA
return true;
}
void SphereSegment::setDrawMask(DrawMask dm)
void SphereSegment::setDrawMask(int dm)
{
_drawMask=dm;
dirtyAllDrawableDisplayLists();

View File

@ -84,20 +84,20 @@ protected:
}
void ShaderGenCache::setStateSet(unsigned int stateMask, osg::StateSet *stateSet)
void ShaderGenCache::setStateSet(int stateMask, osg::StateSet *stateSet)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
_stateSetMap[stateMask] = stateSet;
}
osg::StateSet *ShaderGenCache::getStateSet(unsigned int stateMask) const
osg::StateSet *ShaderGenCache::getStateSet(int stateMask) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
StateSetMap::const_iterator it = _stateSetMap.find(stateMask);
return (it != _stateSetMap.end()) ? it->second.get() : 0;
}
osg::StateSet *ShaderGenCache::getOrCreateStateSet(unsigned int stateMask)
osg::StateSet *ShaderGenCache::getOrCreateStateSet(int stateMask)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
StateSetMap::iterator it = _stateSetMap.find(stateMask);
@ -110,7 +110,7 @@ osg::StateSet *ShaderGenCache::getOrCreateStateSet(unsigned int stateMask)
return it->second.get();
}
osg::StateSet *ShaderGenCache::createStateSet(unsigned int stateMask) const
osg::StateSet *ShaderGenCache::createStateSet(int stateMask) const
{
osg::StateSet *stateSet = new osg::StateSet;
osg::Program *program = new osg::Program;
@ -363,7 +363,7 @@ void ShaderGenVisitor::update(osg::Drawable *drawable)
if (state->getAttribute(osg::StateAttribute::PROGRAM))
return;
unsigned int stateMask = 0;
int stateMask = 0;
//if (state->getMode(GL_BLEND) & osg::StateAttribute::ON)
// stateMask |= ShaderGen::BLEND;
if (state->getMode(GL_LIGHTING) & osg::StateAttribute::ON)

View File

@ -76,7 +76,9 @@ BEGIN_ENUM_REFLECTOR(osg::CullSettings::CullingModeValues)
I_EnumLabel(osg::CullSettings::ENABLE_ALL_CULLING);
END_REFLECTOR
TYPE_NAME_ALIAS(unsigned int, osg::CullSettings::CullingMode)
TYPE_NAME_ALIAS(int, osg::CullSettings::InheritanceMask)
TYPE_NAME_ALIAS(int, osg::CullSettings::CullingMode)
BEGIN_VALUE_REFLECTOR(osg::CullSettings)
I_DeclaringFile("osg/CullSettings");
@ -98,14 +100,14 @@ BEGIN_VALUE_REFLECTOR(osg::CullSettings)
__void__setDefaults,
"",
"");
I_Method1(void, setInheritanceMask, IN, unsigned int, mask,
I_Method1(void, setInheritanceMask, IN, osg::CullSettings::InheritanceMask, mask,
Properties::NON_VIRTUAL,
__void__setInheritanceMask__unsigned_int,
__void__setInheritanceMask__InheritanceMask,
"Set the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object. ",
"");
I_Method0(unsigned int, getInheritanceMask,
I_Method0(osg::CullSettings::InheritanceMask, getInheritanceMask,
Properties::NON_VIRTUAL,
__unsigned_int__getInheritanceMask,
__InheritanceMask__getInheritanceMask,
"Get the inheritance mask used in inheritCullSettings to control which variables get overwritten by the passed in CullSettings object. ",
"");
I_Method1(void, setCullSettings, IN, const osg::CullSettings &, settings,
@ -318,9 +320,9 @@ BEGIN_VALUE_REFLECTOR(osg::CullSettings)
I_SimpleProperty(bool, ImpostorsActive,
__bool__getImpostorsActive,
__void__setImpostorsActive__bool);
I_SimpleProperty(unsigned int, InheritanceMask,
__unsigned_int__getInheritanceMask,
__void__setInheritanceMask__unsigned_int);
I_SimpleProperty(osg::CullSettings::InheritanceMask, InheritanceMask,
__InheritanceMask__getInheritanceMask,
__void__setInheritanceMask__InheritanceMask);
I_SimpleProperty(osg::CullSettings::InheritanceMaskActionOnAttributeSetting, InheritanceMaskActionOnAttributeSetting,
__InheritanceMaskActionOnAttributeSetting__getInheritanceMaskActionOnAttributeSetting,
__void__setInheritanceMaskActionOnAttributeSetting__InheritanceMaskActionOnAttributeSetting);

View File

@ -49,7 +49,7 @@ TYPE_NAME_ALIAS(std::vector< osg::CullingSet::StateFrustumPair >, osg::CullingSe
TYPE_NAME_ALIAS(std::vector< osg::ShadowVolumeOccluder >, osg::CullingSet::OccluderList)
TYPE_NAME_ALIAS(unsigned int, osg::CullingSet::Mask)
TYPE_NAME_ALIAS(int, osg::CullingSet::Mask)
BEGIN_OBJECT_REFLECTOR(osg::CullingSet)
I_DeclaringFile("osg/CullingSet");

View File

@ -417,24 +417,24 @@ BEGIN_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
__MouseYOrientation__getMouseYOrientation,
"get mouse-Y orientation (mouse-Y increases upwards or downwards). ",
"");
I_Method1(void, setButtonMask, IN, unsigned int, mask,
I_Method1(void, setButtonMask, IN, int, mask,
Properties::NON_VIRTUAL,
__void__setButtonMask__unsigned_int,
__void__setButtonMask__int,
"set current mouse button state. ",
"");
I_Method0(unsigned int, getButtonMask,
I_Method0(int, getButtonMask,
Properties::NON_VIRTUAL,
__unsigned_int__getButtonMask,
__int__getButtonMask,
"get current mouse button state. ",
"");
I_Method1(void, setModKeyMask, IN, unsigned int, mask,
I_Method1(void, setModKeyMask, IN, int, mask,
Properties::NON_VIRTUAL,
__void__setModKeyMask__unsigned_int,
__void__setModKeyMask__int,
"set modifier key mask. ",
"");
I_Method0(unsigned int, getModKeyMask,
I_Method0(int, getModKeyMask,
Properties::NON_VIRTUAL,
__unsigned_int__getModKeyMask,
__int__getModKeyMask,
"get modifier key mask. ",
"");
I_Method1(void, setScrollingMotion, IN, osgGA::GUIEventAdapter::ScrollingMotion, motion,
@ -524,9 +524,9 @@ BEGIN_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
I_SimpleProperty(int, Button,
__int__getButton,
__void__setButton__int);
I_SimpleProperty(unsigned int, ButtonMask,
__unsigned_int__getButtonMask,
__void__setButtonMask__unsigned_int);
I_SimpleProperty(int, ButtonMask,
__int__getButtonMask,
__void__setButtonMask__int);
I_SimpleProperty(osgGA::GUIEventAdapter::EventType, EventType,
__EventType__getEventType,
__void__setEventType__EventType);
@ -539,9 +539,9 @@ BEGIN_OBJECT_REFLECTOR(osgGA::GUIEventAdapter)
I_SimpleProperty(int, Key,
__int__getKey,
__void__setKey__int);
I_SimpleProperty(unsigned int, ModKeyMask,
__unsigned_int__getModKeyMask,
__void__setModKeyMask__unsigned_int);
I_SimpleProperty(int, ModKeyMask,
__int__getModKeyMask,
__void__setModKeyMask__int);
I_SimpleProperty(osgGA::GUIEventAdapter::MouseYOrientation, MouseYOrientation,
__MouseYOrientation__getMouseYOrientation,
__void__setMouseYOrientation__MouseYOrientation);

View File

@ -320,13 +320,6 @@ BEGIN_ENUM_REFLECTOR(osgPresentation::SlideEventHandler::WhichPosition)
I_EnumLabel(osgPresentation::SlideEventHandler::LAST_POSITION);
END_REFLECTOR
BEGIN_ENUM_REFLECTOR(osgPresentation::SlideEventHandler::ObjectMask)
I_DeclaringFile("osgPresentation/SlideEventHandler");
I_EnumLabel(osgPresentation::SlideEventHandler::MOVIE);
I_EnumLabel(osgPresentation::SlideEventHandler::OBJECTS);
I_EnumLabel(osgPresentation::SlideEventHandler::ALL_OBJECTS);
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgPresentation::SlideEventHandler)
I_DeclaringFile("osgPresentation/SlideEventHandler");
I_BaseType(osgGA::GUIEventHandler);

View File

@ -22,16 +22,6 @@
#undef OUT
#endif
BEGIN_ENUM_REFLECTOR(osgSim::ObjectRecordData::Flags)
I_DeclaringFile("osgSim/ObjectRecordData");
I_EnumLabel(osgSim::ObjectRecordData::DONT_DISPLAY_IN_DAYLIGHT);
I_EnumLabel(osgSim::ObjectRecordData::DONT_DISPLAY_AT_DUSK);
I_EnumLabel(osgSim::ObjectRecordData::DONT_DISPLAY_AT_NIGHT);
I_EnumLabel(osgSim::ObjectRecordData::DONT_ILLUMINATE);
I_EnumLabel(osgSim::ObjectRecordData::FLAT_SHADED);
I_EnumLabel(osgSim::ObjectRecordData::GROUPS_SHADOW_OBJECT);
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgSim::ObjectRecordData)
I_DeclaringFile("osgSim/ObjectRecordData");
I_BaseType(osg::Object);

View File

@ -108,14 +108,14 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
__int__getDensity,
"Get the density of the sphere segment. ",
"");
I_Method1(void, setDrawMask, IN, osgSim::SphereSegment::DrawMask, dm,
I_Method1(void, setDrawMask, IN, int, dm,
Properties::NON_VIRTUAL,
__void__setDrawMask__DrawMask,
__void__setDrawMask__int,
"Specify the DrawMask. ",
" param dm Bitmask specifying which parts of the sphere segment should be drawn. see DrawMask ");
I_Method0(osgSim::SphereSegment::DrawMask, getDrawMask,
I_Method0(int, getDrawMask,
Properties::NON_VIRTUAL,
__DrawMask__getDrawMask,
__int__getDrawMask,
"Get the DrawMask. ",
"");
I_Method1(void, setSurfaceColor, IN, const osg::Vec4 &, c,
@ -222,9 +222,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
I_SimpleProperty(int, Density,
__int__getDensity,
__void__setDensity__int);
I_SimpleProperty(osgSim::SphereSegment::DrawMask, DrawMask,
__DrawMask__getDrawMask,
__void__setDrawMask__DrawMask);
I_SimpleProperty(int, DrawMask,
__int__getDrawMask,
__void__setDrawMask__int);
I_SimpleProperty(osg::Vec4, EdgeLineColor,
__osg_Vec4__getEdgeLineColor,
__void__setEdgeLineColor__C5_osg_Vec4_R1);

View File

@ -32,7 +32,7 @@ BEGIN_ENUM_REFLECTOR(osgUtil::ShaderGenCache::StateMask)
I_EnumLabel(osgUtil::ShaderGenCache::NORMAL_MAP);
END_REFLECTOR
TYPE_NAME_ALIAS(std::map< unsigned int COMMA osg::ref_ptr< osg::StateSet > >, osgUtil::ShaderGenCache::StateSetMap)
TYPE_NAME_ALIAS(std::map< int COMMA osg::ref_ptr< osg::StateSet > >, osgUtil::ShaderGenCache::StateSetMap)
BEGIN_OBJECT_REFLECTOR(osgUtil::ShaderGenCache)
I_DeclaringFile("osgUtil/ShaderGen");
@ -40,30 +40,30 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::ShaderGenCache)
I_Constructor0(____ShaderGenCache,
"",
"");
I_Method2(void, setStateSet, IN, unsigned int, stateMask, IN, osg::StateSet *, program,
I_Method2(void, setStateSet, IN, int, stateMask, IN, osg::StateSet *, program,
Properties::NON_VIRTUAL,
__void__setStateSet__unsigned_int__osg_StateSet_P1,
__void__setStateSet__int__osg_StateSet_P1,
"",
"");
I_Method1(osg::StateSet *, getStateSet, IN, unsigned int, stateMask,
I_Method1(osg::StateSet *, getStateSet, IN, int, stateMask,
Properties::NON_VIRTUAL,
__osg_StateSet_P1__getStateSet__unsigned_int,
__osg_StateSet_P1__getStateSet__int,
"",
"");
I_Method1(osg::StateSet *, getOrCreateStateSet, IN, unsigned int, stateMask,
I_Method1(osg::StateSet *, getOrCreateStateSet, IN, int, stateMask,
Properties::NON_VIRTUAL,
__osg_StateSet_P1__getOrCreateStateSet__unsigned_int,
__osg_StateSet_P1__getOrCreateStateSet__int,
"",
"");
I_ProtectedMethod1(osg::StateSet *, createStateSet, IN, unsigned int, stateMask,
I_ProtectedMethod1(osg::StateSet *, createStateSet, IN, int, stateMask,
Properties::NON_VIRTUAL,
Properties::CONST,
__osg_StateSet_P1__createStateSet__unsigned_int,
__osg_StateSet_P1__createStateSet__int,
"",
"");
I_IndexedProperty(osg::StateSet *, StateSet,
__osg_StateSet_P1__getStateSet__unsigned_int,
__void__setStateSet__unsigned_int__osg_StateSet_P1,
__osg_StateSet_P1__getStateSet__int,
__void__setStateSet__int__osg_StateSet_P1,
0);
END_REFLECTOR
@ -127,5 +127,5 @@ BEGIN_OBJECT_REFLECTOR(osgUtil::ShaderGenVisitor)
__void__setStateCache__ShaderGenCache_P1);
END_REFLECTOR
STD_MAP_REFLECTOR(std::map< unsigned int COMMA osg::ref_ptr< osg::StateSet > >)
STD_MAP_REFLECTOR(std::map< int COMMA osg::ref_ptr< osg::StateSet > >)