mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 16:19:41 +00:00
Some bug fixes, changes to land load code.
This commit is contained in:
parent
2eacc2f093
commit
72cb405de2
4 changed files with 24 additions and 17 deletions
|
@ -103,7 +103,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
assert (array.count() == Land::LAND_NUM_VERTS * sizeof(float));
|
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];
|
landData->mHeights[i] = rawData[i];
|
||||||
}
|
}
|
||||||
|
@ -183,7 +184,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
assert (array.count() == Land::LAND_NUM_TEXTURES * sizeof(uint16_t));
|
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];
|
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_LTEX: mLandTextures.load (*mReader, mBase); break;
|
||||||
|
|
||||||
case ESM::REC_LAND:
|
case ESM::REC_LAND: mLand.load(*mReader, mBase); break;
|
||||||
{
|
|
||||||
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_CELL:
|
case ESM::REC_CELL:
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <components/esm/esmreader.hpp>
|
#include <components/esm/esmreader.hpp>
|
||||||
|
|
||||||
#include "collection.hpp"
|
#include "collection.hpp"
|
||||||
|
#include "land.hpp"
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
|
@ -39,6 +40,22 @@ namespace CSMWorld
|
||||||
record.load (reader, isDeleted);
|
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>
|
template<typename ESXRecordT, typename IdAccessorT>
|
||||||
int IdCollection<ESXRecordT, IdAccessorT>::load (ESM::ESMReader& reader, bool base)
|
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)
|
for (int i = 0; i < LAND_NUM_VERTS; ++i)
|
||||||
{
|
{
|
||||||
mLandData->mNormals[i*3+0] = 0;
|
mLandData->mNormals[i*3+0] = 0;
|
||||||
mLandData->mNormals[i*3+1] = -1;
|
mLandData->mNormals[i*3+1] = 0;
|
||||||
mLandData->mNormals[i*3+2] = 0;
|
mLandData->mNormals[i*3+2] = 127;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < LAND_NUM_TEXTURES; ++i)
|
for (int i = 0; i < LAND_NUM_TEXTURES; ++i)
|
||||||
mLandData->mTextures[i] = 0;
|
mLandData->mTextures[i] = 0;
|
||||||
|
|
Loading…
Reference in a new issue