forked from mirror/openmw-tes3mp
Remove some unused and unneeded bits from the Animation class
This commit is contained in:
parent
8b5b74f9ee
commit
66860825cf
4 changed files with 1 additions and 154 deletions
|
@ -15,15 +15,7 @@ Animation::Animation(OEngine::Render::OgreRenderer& _rend)
|
|||
: mInsert(NULL)
|
||||
, mRend(_rend)
|
||||
, mTime(0.0f)
|
||||
, mStartTime(0.0f)
|
||||
, mStopTime(0.0f)
|
||||
, mAnimate(0)
|
||||
, mRindexI()
|
||||
, mTindexI()
|
||||
, mShapeNumber(0)
|
||||
, mShapeIndexI()
|
||||
, mTransformations(NULL)
|
||||
, mTextmappings(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -37,79 +29,11 @@ Animation::~Animation()
|
|||
|
||||
void Animation::startScript(std::string groupname, int mode, int loops)
|
||||
{
|
||||
//If groupname is recognized set animate to true
|
||||
//Set the start time and stop time
|
||||
//How many times to loop
|
||||
if(groupname == "all")
|
||||
{
|
||||
mAnimate = loops;
|
||||
mTime = mStartTime;
|
||||
mTime = 0.0f;
|
||||
}
|
||||
else if(mTextmappings)
|
||||
{
|
||||
std::string startName = groupname + ": loop start";
|
||||
std::string stopName = groupname + ": loop stop";
|
||||
|
||||
bool first = false;
|
||||
|
||||
if(loops > 1)
|
||||
{
|
||||
startName = groupname + ": loop start";
|
||||
stopName = groupname + ": loop stop";
|
||||
|
||||
for(std::map<std::string, float>::iterator iter = mTextmappings->begin(); iter != mTextmappings->end(); iter++)
|
||||
{
|
||||
std::string current = iter->first.substr(0, startName.size());
|
||||
std::transform(current.begin(), current.end(), current.begin(), ::tolower);
|
||||
std::string current2 = iter->first.substr(0, stopName.size());
|
||||
std::transform(current2.begin(), current2.end(), current2.begin(), ::tolower);
|
||||
|
||||
if(current == startName)
|
||||
{
|
||||
mStartTime = iter->second;
|
||||
mAnimate = loops;
|
||||
mTime = mStartTime;
|
||||
first = true;
|
||||
}
|
||||
if(current2 == stopName)
|
||||
{
|
||||
mStopTime = iter->second;
|
||||
if(first)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!first)
|
||||
{
|
||||
startName = groupname + ": start";
|
||||
stopName = groupname + ": stop";
|
||||
|
||||
for(std::map<std::string, float>::iterator iter = mTextmappings->begin(); iter != mTextmappings->end(); iter++)
|
||||
{
|
||||
std::string current = iter->first.substr(0, startName.size());
|
||||
std::transform(current.begin(), current.end(), current.begin(), ::tolower);
|
||||
std::string current2 = iter->first.substr(0, stopName.size());
|
||||
std::transform(current2.begin(), current2.end(), current2.begin(), ::tolower);
|
||||
|
||||
if(current == startName)
|
||||
{
|
||||
mStartTime = iter->second;
|
||||
mAnimate = loops;
|
||||
mTime = mStartTime;
|
||||
first = true;
|
||||
}
|
||||
if(current2 == stopName)
|
||||
{
|
||||
mStopTime = iter->second;
|
||||
if(first)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,63 +42,4 @@ void Animation::stopScript()
|
|||
mAnimate = 0;
|
||||
}
|
||||
|
||||
|
||||
bool Animation::timeIndex(float time, const std::vector<float> ×, int &i, int &j, float &x)
|
||||
{
|
||||
size_t count;
|
||||
if((count=times.size()) == 0)
|
||||
return false;
|
||||
|
||||
if(time <= times[0])
|
||||
{
|
||||
i = j = 0;
|
||||
x = 0.0;
|
||||
return true;
|
||||
}
|
||||
if(time >= times[count-1])
|
||||
{
|
||||
i = j = count - 1;
|
||||
x = 0.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(i < 0 || (size_t)i >= count)
|
||||
i = 0;
|
||||
|
||||
float tI = times[i];
|
||||
if(time > tI)
|
||||
{
|
||||
j = i + 1;
|
||||
float tJ;
|
||||
while(time >= (tJ=times[j]))
|
||||
{
|
||||
i = j++;
|
||||
tI = tJ;
|
||||
}
|
||||
x = (time-tI) / (tJ-tI);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(time < tI)
|
||||
{
|
||||
j = i - 1;
|
||||
float tJ;
|
||||
while(time <= (tJ=times[j]))
|
||||
{
|
||||
i = j--;
|
||||
tI = tJ;
|
||||
}
|
||||
x = (time-tI) / (tJ-tI);
|
||||
return true;
|
||||
}
|
||||
|
||||
j = i;
|
||||
x = 0.0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Animation::handleAnimationTransforms()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,23 +26,9 @@ protected:
|
|||
static std::map<std::string, int> sUniqueIDs;
|
||||
|
||||
float mTime;
|
||||
float mStartTime;
|
||||
float mStopTime;
|
||||
int mAnimate;
|
||||
//Represents a rotation index for each bone
|
||||
std::vector<int>mRindexI;
|
||||
//Represents a translation index for each bone
|
||||
std::vector<int>mTindexI;
|
||||
|
||||
//Only shapes with morphing data will use a shape number
|
||||
int mShapeNumber;
|
||||
std::vector<std::vector<int> > mShapeIndexI;
|
||||
|
||||
std::vector<Nif::NiKeyframeData>* mTransformations;
|
||||
std::map<std::string,float>* mTextmappings;
|
||||
NifOgre::EntityList mEntityList;
|
||||
void handleAnimationTransforms();
|
||||
bool timeIndex( float time, const std::vector<float> & times, int & i, int & j, float & x );
|
||||
|
||||
public:
|
||||
Animation(OEngine::Render::OgreRenderer& _rend);
|
||||
|
|
|
@ -92,8 +92,6 @@ void CreatureAnimation::runAnimation(float timepassed)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleAnimationTransforms();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -398,8 +398,6 @@ void NpcAnimation::runAnimation(float timepassed)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleAnimationTransforms();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue