blob: 6e45c478dc18529b4aa45d8efd47c8e8a2428b9f [file] [log] [blame]
#ifndef _NIMA_ACTOR_HPP_
#define _NIMA_ACTOR_HPP_
#include "ActorNode.hpp"
#include "ActorImage.hpp"
#include "BlockReader.hpp"
#include "Solver.hpp"
#include "Animation/ActorAnimation.hpp"
namespace nima
{
enum class BlockType
{
Unknown = 0,
Nodes = 1,
ActorNode = 2,
ActorBone = 3,
ActorRootBone = 4,
ActorImage = 5,
View = 6,
Animation = 7,
Animations = 8,
Atlases = 9,
Atlas = 10,
ActorIKTarget = 11
};
class Actor
{
public:
Actor();
virtual ~Actor();
enum Flags
{
IsImageDrawOrderDirty = 1<<0,
IsVertexDeformDirty = 1<<1,
};
private:
unsigned short m_Flags;
int m_NodeCount;
ActorNode** m_Nodes;
ActorNode* m_Root;
void readNodesBlock(BlockReader* block);
void readAnimationsBlock(BlockReader* block);
protected:
int m_MaxTextureIndex;
int m_ImageNodeCount;
int m_SolverNodeCount;
int m_AnimationsCount;
std::string m_BaseFilename;
ActorImage** m_ImageNodes;
Solver** m_Solvers;
ActorAnimation* m_Animations;
virtual ActorImage* makeImageNode();
virtual void dispose();
virtual void updateVertexDeform(ActorImage* image) {};
public:
void load(unsigned char* bytes, unsigned int length);
void load(const std::string& filename);
ActorNode* getNode(unsigned int index) const;
ActorNode* getNode(unsigned short index) const;
ActorNode* getNode(const std::string& name) const;
ActorAnimation* getAnimation(const std::string& name) const;
void copy(const Actor& actor);
const int textureCount() const;
const std::string& baseFilename() const;
virtual void advance(float elapsedSeconds);
void markImageDrawOrderDirty();
};
}
#endif