diff --git a/components/nif/nifstream.cpp b/components/nif/nifstream.cpp index e5699db7b..4464c8af5 100644 --- a/components/nif/nifstream.cpp +++ b/components/nif/nifstream.cpp @@ -143,4 +143,33 @@ void NIFStream::getQuaternions(std::vector &quat, size_t size) quat[i] = getQuaternion(); } +template <> +char NIFStream::get(){ return getChar(); } +template <> +short NIFStream::get(){ return getShort(); } +template <> +unsigned short NIFStream::get(){ return getUShort(); } +template <> +int NIFStream::get(){ return getInt(); } +template <> +unsigned int NIFStream::get(){ return getUInt(); } +template <> +float NIFStream::get(){ return getFloat(); } + +template <> +Ogre::Vector2 NIFStream::get(){ return getVector2(); } +template <> +Ogre::Vector3 NIFStream::get(){ return getVector3(); } +template <> +Ogre::Vector4 NIFStream::get(){ return getVector4(); } +template <> +Ogre::Matrix3 NIFStream::get(){ return getMatrix3(); } +template <> +Ogre::Quaternion NIFStream::get(){ return getQuaternion(); } +template <> +Transformation NIFStream::get(){ return getTrafo(); } + +template <> +std::string NIFStream::get(){ return getString(); } + } diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index cc14971fd..f32d233b1 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -84,6 +84,10 @@ public: ///This is special since the version string doesn't start with a number, and ends with "\n" std::string getVersionString(); + //Templated functions to handle reads + template + T get(){throw std::runtime_error("Can not get this type of data from a NIF File!");} + void getShorts(std::vector &vec, size_t size); void getFloats(std::vector &vec, size_t size); void getVector2s(std::vector &vec, size_t size);