1
0
forked from 0ad/0ad
0ad/source/graphics/ObjectBase.h
Ykkrosh d3f57744d9 Refactored actor variation system, and added support for entity-level selections (controlled by the current animation).
Avoided tooltip error message.
Avoided noisy warnings when textures fail to load.

This was SVN commit r3653.
2006-03-17 03:59:49 +00:00

80 lines
1.7 KiB
C++

#ifndef _OBJECTBASE_H
#define _OBJECTBASE_H
class CModel;
class CSkeletonAnim;
#include <vector>
#include <set>
#include "CStr.h"
class CObjectBase
{
public:
struct Anim {
// constructor
Anim() : m_Speed(1), m_ActionPos(0.0), m_ActionPos2(0.0) {}
// name of the animation - "Idle", "Run", etc
CStr m_AnimName;
// filename of the animation - manidle.psa, manrun.psa, etc
CStr m_FileName;
// animation speed, as specified in XML actor file
float m_Speed;
// fraction of the way through the animation that the interesting bit(s)
// happens
double m_ActionPos;
double m_ActionPos2;
};
struct Prop {
// name of the prop point to attach to - "Prop01", "Prop02", "Head", "LeftHand", etc ..
CStr m_PropPointName;
// name of the model file - art/actors/props/sword.xml or whatever
CStr m_ModelName;
};
struct Variant
{
Variant() : m_Frequency(0) {}
CStr m_VariantName;
int m_Frequency;
CStr m_ModelFilename;
CStr m_TextureFilename;
CStr m_Color;
std::vector<Anim> m_Anims;
std::vector<Prop> m_Props;
};
CObjectBase();
std::vector< std::vector<Variant> > m_Variants;
std::vector<u8> CalculateVariationKey(const std::vector<std::set<CStrW> >& selections);
std::set<CStrW> CalculateRandomVariation(const std::set<CStrW>& initialSelections);
bool Load(const char* filename);
// object name
CStr m_Name;
// short human-readable name
CStr m_ShortName;
struct {
// automatically flatten terrain when applying object
bool m_AutoFlatten;
// cast shadows from this object
bool m_CastShadows;
} m_Properties;
// the material file
CStr m_Material;
};
#endif