Switch height/weight in names and make the stats a simple struct instead

BindlessTest
Dave Corley 3 months ago
parent 98ad059806
commit 1b1f0c4971

@ -67,9 +67,9 @@ namespace CSMWorld
return mMaleParts[ESM::getMeshPart(index)];
}
const osg::Vec2f& ActorAdapter::RaceData::getHeightWeight(bool isFemale)
const osg::Vec2f& ActorAdapter::RaceData::getGenderWeightHeight(bool isFemale)
{
return isFemale ? mHeightsWeights.mFemaleHeightWeight : mHeightsWeights.mMaleHeightWeight;
return isFemale ? mWeightsHeights.mFemaleWeightHeight : mWeightsHeights.mMaleWeightHeight;
}
bool ActorAdapter::RaceData::hasDependency(const ESM::RefId& id) const
@ -95,11 +95,11 @@ namespace CSMWorld
mDependencies.emplace(id);
}
void ActorAdapter::RaceData::reset_data(const ESM::RefId& id, const HeightsWeights& raceStats, bool isBeast)
void ActorAdapter::RaceData::reset_data(const ESM::RefId& id, const WeightsHeights& raceStats, bool isBeast)
{
mId = id;
mIsBeast = isBeast;
mHeightsWeights = raceStats;
mWeightsHeights = raceStats;
for (auto& str : mFemaleParts)
str = ESM::RefId();
for (auto& str : mMaleParts)
@ -169,9 +169,9 @@ namespace CSMWorld
return it->second.first;
}
const osg::Vec2f& ActorAdapter::ActorData::getRaceHeightWeight() const
const osg::Vec2f& ActorAdapter::ActorData::getRaceWeightHeight() const
{
return mRaceData->getHeightWeight(isFemale());
return mRaceData->getGenderWeightHeight(isFemale());
}
bool ActorAdapter::ActorData::hasDependency(const ESM::RefId& id) const
@ -516,8 +516,8 @@ namespace CSMWorld
auto& race = raceRecord.get();
HeightsWeights scaleStats = HeightsWeights(osg::Vec2f(race.mData.mMaleWeight, race.mData.mMaleHeight),
osg::Vec2f(race.mData.mFemaleWeight, race.mData.mFemaleHeight));
WeightsHeights scaleStats = { osg::Vec2f(race.mData.mMaleWeight, race.mData.mMaleHeight),
osg::Vec2f(race.mData.mFemaleWeight, race.mData.mFemaleHeight) };
data->reset_data(id, scaleStats, race.mData.mFlags & ESM::Race::Beast);

@ -41,23 +41,10 @@ namespace CSMWorld
/// Tracks unique strings
using RefIdSet = std::unordered_set<ESM::RefId>;
class HeightsWeights
struct WeightsHeights
{
public:
osg::Vec2f mMaleHeightWeight;
osg::Vec2f mFemaleHeightWeight;
HeightsWeights()
: mMaleHeightWeight(osg::Vec2f(1.0f, 1.0f))
, mFemaleHeightWeight(osg::Vec2f(1.0f, 1.0f))
{
}
HeightsWeights(const osg::Vec2f& maleHeightWeight, const osg::Vec2f& femaleHeightWeight)
{
mMaleHeightWeight = maleHeightWeight;
mFemaleHeightWeight = femaleHeightWeight;
}
osg::Vec2f mMaleWeightHeight;
osg::Vec2f mFemaleWeightHeight;
};
/// Contains base race data shared between actors
@ -77,7 +64,7 @@ namespace CSMWorld
/// Retrieves the associated body part
const ESM::RefId& getMalePart(ESM::PartReferenceType index) const;
const osg::Vec2f& getHeightWeight(bool isFemale);
const osg::Vec2f& getGenderWeightHeight(bool isFemale);
/// Checks if the race has a data dependency
bool hasDependency(const ESM::RefId& id) const;
@ -88,8 +75,8 @@ namespace CSMWorld
/// Marks an additional dependency
void addOtherDependency(const ESM::RefId& id);
/// Clears parts and dependencies
void reset_data(
const ESM::RefId& raceId, const HeightsWeights& raceStats = HeightsWeights(), bool isBeast = false);
void reset_data(const ESM::RefId& raceId,
const WeightsHeights& raceStats = { osg::Vec2f(1.f, 1.f), osg::Vec2f(1.f, 1.f) }, bool isBeast = false);
private:
bool handles(ESM::PartReferenceType type) const;
@ -97,7 +84,7 @@ namespace CSMWorld
bool mIsBeast;
RacePartList mFemaleParts;
RacePartList mMaleParts;
HeightsWeights mHeightsWeights;
WeightsHeights mWeightsHeights;
RefIdSet mDependencies;
};
using RaceDataPtr = std::shared_ptr<RaceData>;
@ -120,7 +107,7 @@ namespace CSMWorld
/// Retrieves the associated actor part
ESM::RefId getPart(ESM::PartReferenceType index) const;
const osg::Vec2f& getRaceHeightWeight() const;
const osg::Vec2f& getRaceWeightHeight() const;
/// Checks if the actor has a data dependency
bool hasDependency(const ESM::RefId& id) const;

@ -21,7 +21,6 @@
#include <components/sceneutil/attach.hpp>
#include <components/sceneutil/skeleton.hpp>
#include "../../model/world/columns.hpp"
#include "../../model/world/data.hpp"
namespace CSVRender
@ -63,7 +62,7 @@ namespace CSVRender
// Attach parts to skeleton
loadBodyParts();
const osg::Vec2f& attributes = mActorData.get()->getRaceHeightWeight();
const osg::Vec2f& attributes = mActorData->getRaceWeightHeight();
mBaseNode->setScale(osg::Vec3d(attributes.x(), attributes.x(), attributes.y()));
}

Loading…
Cancel
Save