mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 22:36:39 +02:00
Added some comments to AnimNode, AnimClip & AnimBlendLinear.
This commit is contained in:
parent
5d83976e2a
commit
2154f76202
4 changed files with 30 additions and 1 deletions
|
@ -1223,7 +1223,7 @@ void MyAvatar::setupNewAnimationSystem() {
|
|||
// create a blend node
|
||||
auto blend = make_shared<AnimBlendLinear>("blend", 0.5f);
|
||||
auto idle = make_shared<AnimClip>("clip", "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/standard_idle.fbx", 0.0f, 90.0f, 1.0f, true);
|
||||
auto walk = make_shared<AnimClip>("clip", "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/standard_walk.fbx", 0.0f, 29.0f, 1.0f, true);
|
||||
auto walk = make_shared<AnimClip>("clip", "https://hifi-public.s3.amazonaws.com/ozan/support/FightClubBotTest1/Animations/standard_walk.fbx", 0.0f, 28.0f, 1.0f, true);
|
||||
blend->addChild(idle);
|
||||
blend->addChild(walk);
|
||||
_animNode = blend;
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
#ifndef hifi_AnimBlendLinear_h
|
||||
#define hifi_AnimBlendLinear_h
|
||||
|
||||
// Linear blend between two AnimNodes.
|
||||
// the amount of blending is determined by the alpha parameter.
|
||||
// If the number of children is 2, then the alpha parameters should be between
|
||||
// 0 and 1. The first animation will have a (1 - alpha) factor, and the second
|
||||
// will have factor of alpha.
|
||||
// This node supports more then 2 children. In this case the alpha should be
|
||||
// between 0 and n - 1. This alpha can be used to linearly interpolate between
|
||||
// the closest two children poses. This can be used to sweep through a series
|
||||
// of animation poses.
|
||||
|
||||
class AnimBlendLinear : public AnimNode {
|
||||
public:
|
||||
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
#include "AnimationCache.h"
|
||||
#include "AnimNode.h"
|
||||
|
||||
// Playback a single animation timeline.
|
||||
// url determines the location of the fbx file to use within this clip.
|
||||
// startFrame and endFrame are in frames 1/30th of a second.
|
||||
// timescale can be used to speed-up or slow-down the animation.
|
||||
// loop flag, when true, will loop the animation as it reaches the end frame.
|
||||
|
||||
class AnimClip : public AnimNode {
|
||||
public:
|
||||
friend class AnimClipTests;
|
||||
|
|
|
@ -21,6 +21,15 @@
|
|||
|
||||
class QJsonObject;
|
||||
|
||||
// Base class for all elements in the animation blend tree.
|
||||
// It provides the following categories of functions:
|
||||
//
|
||||
// * id getter, id is a string name useful for debugging and searching.
|
||||
// * type getter, helpful for determining the derived type of this node.
|
||||
// * hierarchy accessors, for adding, removing and iterating over child AnimNodes
|
||||
// * skeleton accessors, the skeleton is from the model whose bones we are going to manipulate
|
||||
// * evaluate method, perform actual joint manipulations here and return result by reference.
|
||||
|
||||
class AnimNode {
|
||||
public:
|
||||
friend class AnimDebugDraw;
|
||||
|
@ -37,6 +46,7 @@ public:
|
|||
const std::string& getID() const { return _id; }
|
||||
Type getType() const { return _type; }
|
||||
|
||||
// hierarchy accessors
|
||||
void addChild(Pointer child) { _children.push_back(child); }
|
||||
void removeChild(Pointer child) {
|
||||
auto iter = std::find(_children.begin(), _children.end(), child);
|
||||
|
@ -62,6 +72,9 @@ public:
|
|||
virtual ~AnimNode() {}
|
||||
|
||||
virtual const std::vector<AnimPose>& evaluate(float dt) = 0;
|
||||
virtual const std::vector<AnimPose>& overlay(float dt, const std::vector<AnimPose>& underPoses) {
|
||||
return evaluate(dt);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in a new issue