Hands-On C++ Game Animation Programming by Gabor Szauer

Hands-On C++ Game Animation Programming by Gabor Szauer

Author:Gabor Szauer [Gabor Szauer]
Language: eng
Format: epub, mobi
Publisher: Packt Publishing
Published: 2020-06-11T16:00:00+00:00


The IsValid helper function should only return true if at least one of the component tracks stored in the TransformTrack class is valid. For a track to be valid, it needs to have two or more frames:bool TransformTrack::IsValid() {

return mPosition.Size() > 1 ||

mRotation.Size() > 1 ||

mScale.Size() > 1;

}

The GetStartTime function should return the smallest start time of the three component tracks. If none of the components are valid (that is, they all have one or no frames), then TransformTrack isn't valid. In this case, just return 0:float TransformTrack::GetStartTime() {

float result = 0.0f;

bool isSet = false;

if (mPosition.Size() > 1) {

result = mPosition.GetStartTime();

isSet = true;

}

if (mRotation.Size() > 1) {

float rotationStart = mRotation.GetStartTime();

if (rotationStart < result || !isSet) {

result = rotationStart;

isSet = true;

}

}

if (mScale.Size() > 1) {

float scaleStart = mScale.GetStartTime();

if (scaleStart < result || !isSet) {

result = scaleStart;

isSet = true;

}

}

return result;

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.