mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 20:19:57 +00:00
Made NIFStream getters templated
This commit is contained in:
parent
97fc51ceb7
commit
4edc4142f3
2 changed files with 33 additions and 0 deletions
|
@ -143,4 +143,33 @@ void NIFStream::getQuaternions(std::vector<Ogre::Quaternion> &quat, size_t size)
|
||||||
quat[i] = getQuaternion();
|
quat[i] = getQuaternion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
char NIFStream::get<char>(){ return getChar(); }
|
||||||
|
template <>
|
||||||
|
short NIFStream::get<short>(){ return getShort(); }
|
||||||
|
template <>
|
||||||
|
unsigned short NIFStream::get<unsigned short>(){ return getUShort(); }
|
||||||
|
template <>
|
||||||
|
int NIFStream::get<int>(){ return getInt(); }
|
||||||
|
template <>
|
||||||
|
unsigned int NIFStream::get<unsigned int>(){ return getUInt(); }
|
||||||
|
template <>
|
||||||
|
float NIFStream::get<float>(){ return getFloat(); }
|
||||||
|
|
||||||
|
template <>
|
||||||
|
Ogre::Vector2 NIFStream::get<Ogre::Vector2>(){ return getVector2(); }
|
||||||
|
template <>
|
||||||
|
Ogre::Vector3 NIFStream::get<Ogre::Vector3>(){ return getVector3(); }
|
||||||
|
template <>
|
||||||
|
Ogre::Vector4 NIFStream::get<Ogre::Vector4>(){ return getVector4(); }
|
||||||
|
template <>
|
||||||
|
Ogre::Matrix3 NIFStream::get<Ogre::Matrix3>(){ return getMatrix3(); }
|
||||||
|
template <>
|
||||||
|
Ogre::Quaternion NIFStream::get<Ogre::Quaternion>(){ return getQuaternion(); }
|
||||||
|
template <>
|
||||||
|
Transformation NIFStream::get<Transformation>(){ return getTrafo(); }
|
||||||
|
|
||||||
|
template <>
|
||||||
|
std::string NIFStream::get<std::string>(){ return getString(); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,10 @@ public:
|
||||||
///This is special since the version string doesn't start with a number, and ends with "\n"
|
///This is special since the version string doesn't start with a number, and ends with "\n"
|
||||||
std::string getVersionString();
|
std::string getVersionString();
|
||||||
|
|
||||||
|
//Templated functions to handle reads
|
||||||
|
template <typename T>
|
||||||
|
T get(){throw std::runtime_error("Can not get this type of data from a NIF File!");}
|
||||||
|
|
||||||
void getShorts(std::vector<short> &vec, size_t size);
|
void getShorts(std::vector<short> &vec, size_t size);
|
||||||
void getFloats(std::vector<float> &vec, size_t size);
|
void getFloats(std::vector<float> &vec, size_t size);
|
||||||
void getVector2s(std::vector<Ogre::Vector2> &vec, size_t size);
|
void getVector2s(std::vector<Ogre::Vector2> &vec, size_t size);
|
||||||
|
|
Loading…
Reference in a new issue