VertexLoader: temp class for reader/writer

This commit is contained in:
degasus
2014-01-21 23:44:51 +01:00
parent 0b97b33ceb
commit 3cb5bb3b30
4 changed files with 45 additions and 29 deletions

View File

@ -77,12 +77,11 @@ void LOADERDECL Pos_ReadDirect()
{
static_assert(N <= 3, "N > 3 is not sane!");
auto const scale = posScale;
auto dst = VertexManager::s_pCurBufferPointer;
DataWriter dst;
DataReader src;
for (int i = 0; i < 3; ++i)
DataWrite(dst, i<N ? PosScale(DataRead<T>(), scale) : 0.f);
VertexManager::s_pCurBufferPointer = dst;
dst.Write(i<N ? PosScale(src.Read<T>(), scale) : 0.f);
LOG_VTX();
}
@ -96,12 +95,10 @@ void LOADERDECL Pos_ReadIndex()
auto const index = DataRead<I>();
auto const data = reinterpret_cast<const T*>(cached_arraybases[ARRAY_POSITION] + (index * arraystrides[ARRAY_POSITION]));
auto const scale = posScale;
auto dst = VertexManager::s_pCurBufferPointer;
DataWriter dst;
for (int i = 0; i < 3; ++i)
DataWrite(dst, i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
VertexManager::s_pCurBufferPointer = dst;
dst.Write(i<N ? PosScale(Common::FromBigEndian(data[i]), scale) : 0.f);
LOG_VTX();
}