Some bug fixes, changes to land load code.

pull/1427/head
Kyle Cooley 7 years ago
parent 2eacc2f093
commit 72cb405de2

@ -103,7 +103,8 @@ namespace CSMWorld
assert (array.count() == Land::LAND_NUM_VERTS * sizeof(float));
for (int i = 0; i < array.count(); ++i)
int count = array.count() / sizeof(float);
for (int i = 0; i < count; ++i)
{
landData->mHeights[i] = rawData[i];
}
@ -183,7 +184,8 @@ namespace CSMWorld
assert (array.count() == Land::LAND_NUM_TEXTURES * sizeof(uint16_t));
for (int i = 0; i < array.count(); ++i)
int count = array.count() / sizeof(uint16_t);
for (int i = 0; i < count; ++i)
{
landData->mTextures[i] = rawData[i];
}

@ -1013,19 +1013,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
case ESM::REC_LTEX: mLandTextures.load (*mReader, mBase); break;
case ESM::REC_LAND:
{
int index = mLand.load(*mReader, mBase);
// Load all land data for now. A future optimisation may only load non-base data
// if a suitable mechanism for avoiding race conditions can be established.
if (index!=-1/* && !mBase*/)
mLand.getRecord (index).get().loadData (
ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR |
ESM::Land::DATA_VTEX);
break;
}
case ESM::REC_LAND: mLand.load(*mReader, mBase); break;
case ESM::REC_CELL:
{

@ -4,6 +4,7 @@
#include <components/esm/esmreader.hpp>
#include "collection.hpp"
#include "land.hpp"
namespace CSMWorld
{
@ -39,6 +40,22 @@ namespace CSMWorld
record.load (reader, isDeleted);
}
template<>
inline void IdCollection<Land, IdAccessor<Land> >::loadRecord (Land& record,
ESM::ESMReader& reader, bool& isDeleted)
{
record.load (reader, isDeleted);
// Load all land data for now. A future optimisation may only load non-base data
// if a suitable mechanism for avoiding race conditions can be established.
int flags = ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML |
ESM::Land::DATA_VCLR | ESM::Land::DATA_VTEX;
record.loadData (flags);
// Prevent data from being reloaded.
record.mContext.filename.clear();
}
template<typename ESXRecordT, typename IdAccessorT>
int IdCollection<ESXRecordT, IdAccessorT>::load (ESM::ESMReader& reader, bool base)
{

@ -196,8 +196,8 @@ namespace ESM
for (int i = 0; i < LAND_NUM_VERTS; ++i)
{
mLandData->mNormals[i*3+0] = 0;
mLandData->mNormals[i*3+1] = -1;
mLandData->mNormals[i*3+2] = 0;
mLandData->mNormals[i*3+1] = 0;
mLandData->mNormals[i*3+2] = 127;
}
for (int i = 0; i < LAND_NUM_TEXTURES; ++i)
mLandData->mTextures[i] = 0;

Loading…
Cancel
Save