mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:33:27 +02:00
only setJointState() if animation frame actually changed
This commit is contained in:
parent
cec0f8ed1d
commit
942958c4f1
3 changed files with 10 additions and 5 deletions
|
@ -275,9 +275,12 @@ void RenderableModelEntityItem::render(RenderArgs* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jointsMapped()) {
|
if (jointsMapped()) {
|
||||||
auto frameData = getAnimationFrame();
|
bool newFrame;
|
||||||
for (int i = 0; i < frameData.size(); i++) {
|
auto frameData = getAnimationFrame(newFrame);
|
||||||
_model->setJointState(i, true, frameData[i]);
|
if (newFrame) {
|
||||||
|
for (int i = 0; i < frameData.size(); i++) {
|
||||||
|
_model->setJointState(i, true, frameData[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,8 @@ void ModelEntityItem::mapJoints(const QStringList& modelJointNames) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<glm::quat>& ModelEntityItem::getAnimationFrame() {
|
const QVector<glm::quat>& ModelEntityItem::getAnimationFrame(bool& newFrame) {
|
||||||
|
newFrame = false;
|
||||||
|
|
||||||
if (!hasAnimation() || !_jointMappingCompleted) {
|
if (!hasAnimation() || !_jointMappingCompleted) {
|
||||||
return _lastKnownFrameData;
|
return _lastKnownFrameData;
|
||||||
|
@ -238,6 +239,7 @@ const QVector<glm::quat>& ModelEntityItem::getAnimationFrame() {
|
||||||
|
|
||||||
if (animationFrameIndex != _lastKnownFrameIndex) {
|
if (animationFrameIndex != _lastKnownFrameIndex) {
|
||||||
_lastKnownFrameIndex = animationFrameIndex;
|
_lastKnownFrameIndex = animationFrameIndex;
|
||||||
|
newFrame = true;
|
||||||
|
|
||||||
const QVector<glm::quat>& rotations = frames[animationFrameIndex].rotations;
|
const QVector<glm::quat>& rotations = frames[animationFrameIndex].rotations;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
float getAnimationLastFrame() const { return _animationLoop.getLastFrame(); }
|
float getAnimationLastFrame() const { return _animationLoop.getLastFrame(); }
|
||||||
|
|
||||||
void mapJoints(const QStringList& modelJointNames);
|
void mapJoints(const QStringList& modelJointNames);
|
||||||
const QVector<glm::quat>& getAnimationFrame();
|
const QVector<glm::quat>& getAnimationFrame(bool& newFrame);
|
||||||
bool jointsMapped() const { return _jointMappingCompleted; }
|
bool jointsMapped() const { return _jointMappingCompleted; }
|
||||||
|
|
||||||
bool getAnimationIsPlaying() const { return _animationLoop.isRunning(); }
|
bool getAnimationIsPlaying() const { return _animationLoop.isRunning(); }
|
||||||
|
|
Loading…
Reference in a new issue