Added access methods to Serializer to help with using wrappers for other purposes such as script integration.

Added Vec*i and Vec*ui support to serializers
This commit is contained in:
Robert Osfield
2013-09-11 15:44:08 +00:00
parent 31cd80cea7
commit 24ecfb1a48
6 changed files with 130 additions and 4 deletions

View File

@@ -64,6 +64,13 @@ const int ID_VEC2US_ARRAY = 23;
const int ID_VEC3US_ARRAY = 24;
const int ID_VEC4US_ARRAY = 25;
const int ID_VEC2I_ARRAY = 26;
const int ID_VEC3I_ARRAY = 27;
const int ID_VEC4I_ARRAY = 28;
const int ID_VEC2UI_ARRAY = 29;
const int ID_VEC3UI_ARRAY = 30;
const int ID_VEC4UI_ARRAY = 31;
const int ID_DRAWARRAYS = 50;
const int ID_DRAWARRAY_LENGTH = 51;
const int ID_DRAWELEMENTS_UBYTE = 52;

View File

@@ -93,14 +93,14 @@ struct UpdateWrapperVersionProxy
UpdateWrapperVersionProxy( ObjectWrapper* w, int v ): _wrapper(w)
{
_lastVersion = w->getUpdatedVersion();
w->setUpdatedVersion(v);
w->setUpdatedVersion(v);
}
~UpdateWrapperVersionProxy()
{
_wrapper->setUpdatedVersion(_lastVersion);
}
ObjectWrapper* _wrapper;
int _lastVersion;
};
@@ -133,6 +133,9 @@ public:
IntLookup::Value getValue( const std::string& group, const std::string& str ) { return findLookup(group).getValue(str.c_str()); }
const std::string& getString( const std::string& group, IntLookup::Value value ) { return findLookup(group).getString(value); }
IntLookupMap& getLookupMap() { return _globalMap; }
const IntLookupMap& getLookupMap() const { return _globalMap; }
protected:
friend class osgDB::Registry;

View File

@@ -82,6 +82,12 @@ public:
return itr->second;
}
StringToValue& getStringToValue() { return _stringToValue; }
const StringToValue& getStringToValue() const { return _stringToValue; }
ValueToString& getValueToString() { return _valueToString; }
const ValueToString& getValueToString() const { return _valueToString; }
protected:
StringToValue _stringToValue;
ValueToString _valueToString;
@@ -127,7 +133,7 @@ public:
RW_MATRIXF, RW_MATRIXD, RW_MATRIX, RW_GLENUM, RW_STRING, RW_ENUM,
RW_VEC2B, RW_VEC2UB, RW_VEC2S, RW_VEC2US, RW_VEC2I, RW_VEC2UI,
RW_VEC3B, RW_VEC3UB, RW_VEC3S, RW_VEC3US, RW_VEC3I, RW_VEC3UI,
RW_VEC4B, RW_VEC4UB, RW_VEC4S, RW_VEC4US, RW_VEC4I, RE_VEC4UI
RW_VEC4B, RW_VEC4UB, RW_VEC4S, RW_VEC4US, RW_VEC4I, RW_VEC4UI
};
BaseSerializer() : _firstVersion(0), _lastVersion(INT_MAX) {}