Skip to content

Commit

Permalink
GRAPHICS: Populate animation nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbowtie authored and DrMcCoy committed Apr 21, 2012
1 parent 56ac44d commit 49cd4b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
6 changes: 5 additions & 1 deletion src/graphics/aurora/animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ class Animation {
/** Get the specified node, from the current state. */
// const AnimNode *getNode(const Common::UString &node) const;

protected:
typedef std::list<AnimNode *> NodeList;
typedef std::map<Common::UString, AnimNode *, Common::UString::iless> NodeMap;
NodeList nodeList; ///< The nodes within the state.
NodeMap nodeMap; ///< The nodes within the state, indexed by name.

NodeList rootNodes; ///< The nodes in the state without a parent.
protected:

Common::UString _name; ///< The model's name.
float _length;
Expand Down
8 changes: 5 additions & 3 deletions src/graphics/aurora/animnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ namespace Graphics {
namespace Aurora {


AnimNode::AnimNode(Animation &animation) :
_animation(&animation), _parent(0)
{
AnimNode::AnimNode(ModelNode *modelnode) :
_parent(0) {
// actual data is loaded as a generic modelnode
if (modelnode)
_name = modelnode->getName();
}

AnimNode::~AnimNode() {
Expand Down
7 changes: 4 additions & 3 deletions src/graphics/aurora/animnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@ namespace Graphics {

namespace Aurora {

class Animation;
class ModelNode;

class AnimNode {
public:
AnimNode(Animation &anim);
// AnimNode(Animation &anim);
AnimNode(ModelNode* modelnode);
~AnimNode();

/** Get the node's name. */
const Common::UString &getName() const;

protected:
Animation *_animation; ///< The animation this node belongs to.
// Animation *_animation; ///< The animation this node belongs to.

AnimNode *_parent; ///< The node's parent.
std::list<AnimNode *> _children; ///< The node's children.
Expand Down
14 changes: 6 additions & 8 deletions src/graphics/aurora/model_nwn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#include "graphics/aurora/model_nwn.h"
#include "graphics/aurora/animation.h"
#include "graphics/aurora/animnode.h"

using Common::kDebugGraphics;

Expand Down Expand Up @@ -469,17 +470,14 @@ void Model_NWN::readAnimBinary(ParserContext &ctx, uint32 offset) {
_defaultAnimations.push_back(anim);
}
debugC(4, kDebugGraphics, "Loaded animation \"%s\" in model \"%s\"", ctx.state->name.c_str(), _name.c_str());
/*

for (std::list<ModelNode *>::iterator n = ctx.nodes.begin();
n != ctx.nodes.end(); ++n) {
anim->nodeList.push_back(*n);
anim->nodeMap.insert(std::make_pair((*n)->getName(), *n));
if (!(*n)->getParent())
anim->rootNodes.push_back(*n);
AnimNode* animnode = new AnimNode(*n);
anim->nodeList.push_back(animnode);
anim->nodeMap.insert(std::make_pair(animnode->getName(), animnode));
}
*/

}


Expand Down

0 comments on commit 49cd4b8

Please sign in to comment.