* add atVec2f

This commit is contained in:
Phillip Stephens 2015-07-10 18:45:26 -07:00
parent 8d3524b1f6
commit 4f8df65a3d
4 changed files with 56 additions and 1 deletions

View File

@ -24,6 +24,8 @@ if(WIN32)
list(APPEND CORE_EXTRA src/win32_largefilewrapper.c)
elseif(APPLE)
list(APPEND CORE_EXTRA src/osx_largefilewrapper.c)
elseif(GEKKO)
list(APPEND CORE_EXTRA src/gekko_support.c)
endif()
add_library(AthenaCore
@ -41,7 +43,6 @@ add_library(AthenaCore
src/LZ77/LZBase.cpp
src/Athena/FileInfo.cpp
src/Athena/Dir.cpp
src/gekko_support.c
${CORE_EXTRA}
include/Athena/IStream.hpp

View File

@ -221,6 +221,28 @@ public:
return val != 0;
}
/*! \brief Reads an atVec2f (8 bytes) and advances the current position
*
* \return atVec2f The value at the current address
* \throw IOException when address is out of range
*/
inline atVec2f readVec3f()
{
atVec2f val;
readUBytesToBuf(&val, 8);
if (m_endian == BigEndian)
{
utility::BigFloat(val.vec[0]);
utility::BigFloat(val.vec[1]);
}
else
{
utility::LittleFloat(val.vec[0]);
utility::LittleFloat(val.vec[1]);
}
return val;
}
/*! \brief Reads an atVec3f (12 bytes) and advances the current position
*
* \return atVec3f The value at the current address

View File

@ -204,6 +204,27 @@ public:
*/
inline void writeBool(bool val) {writeUBytes((atUint8*)&val, 1);}
/*! \brief Writes an atVec2f (8 bytes) to the buffer and advances the buffer.
* It also swaps the bytes depending on the platform and Stream settings.
*
* \sa Endian
* \param vec The value to write to the buffer
*/
inline void writeVec2f(atVec2f vec)
{
if (m_endian == BigEndian)
{
utility::BigFloat(vec.vec[0]);
utility::BigFloat(vec.vec[1]);
}
else
{
utility::LittleFloat(vec.vec[0]);
utility::LittleFloat(vec.vec[1]);
}
writeUBytes((atUint8*)&vec, 8);
}
/*! \brief Writes an atVec3f (12 bytes) to the buffer and advances the buffer.
* It also swaps the bytes depending on the platform and Stream settings.
*

View File

@ -46,6 +46,17 @@ typedef unsigned long long atUint64;
#include <xmmintrin.h>
#endif
typedef union
{
#if __clang__
float clangVec __attribute__((__vector_size__(8)));
#endif
#if __SSE__
__m128 mVec128;
#endif
float vec[2];
} atVec2f;
typedef union
{
#if __clang__