#include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx>
#include <simgear/props/props_io.hxx>
-#include <simgear/scene/model/animation.hxx>
+
+#include "animation.hxx"
#include "model.hxx"
static int
animation_callback (ssgEntity * entity, int mask)
{
- ((Animation *)entity->getUserData())->update();
+ ((SGAnimation *)entity->getUserData())->update();
return true;
}
* Make an offset matrix from rotations and position offset.
*/
void
-fgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot,
+sgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot,
double x_off, double y_off, double z_off )
{
sgMat4 rot_matrix;
void
-fgMakeAnimation( ssgBranch * model,
+sgMakeAnimation( ssgBranch * model,
const char * name,
vector<SGPropertyNode_ptr> &name_nodes,
SGPropertyNode *prop_root,
SGPropertyNode_ptr node,
double sim_time_sec )
{
- Animation * animation = 0;
+ SGAnimation * animation = 0;
const char * type = node->getStringValue("type", "none");
if (!strcmp("none", type)) {
- animation = new NullAnimation(node);
+ animation = new SGNullAnimation(node);
} else if (!strcmp("range", type)) {
- animation = new RangeAnimation(node);
+ animation = new SGRangeAnimation(node);
} else if (!strcmp("billboard", type)) {
- animation = new BillboardAnimation(node);
+ animation = new SGBillboardAnimation(node);
} else if (!strcmp("select", type)) {
- animation = new SelectAnimation(prop_root, node);
+ animation = new SGSelectAnimation(prop_root, node);
} else if (!strcmp("spin", type)) {
- animation = new SpinAnimation(prop_root, node, sim_time_sec );
+ animation = new SGSpinAnimation(prop_root, node, sim_time_sec );
} else if (!strcmp("timed", type)) {
- animation = new TimedAnimation(node);
+ animation = new SGTimedAnimation(node);
} else if (!strcmp("rotate", type)) {
- animation = new RotateAnimation(prop_root, node);
+ animation = new SGRotateAnimation(prop_root, node);
} else if (!strcmp("translate", type)) {
- animation = new TranslateAnimation(prop_root, node);
+ animation = new SGTranslateAnimation(prop_root, node);
+ } else if (!strcmp("scale", type)) {
+ animation = new SGScaleAnimation(prop_root, node);
+ } else if (!strcmp("texrotate", type)) {
+ animation = new SGTexRotateAnimation(prop_root, node);
+ } else if (!strcmp("textranslate", type)) {
+ animation = new SGTexTranslateAnimation(prop_root, node);
+ } else if (!strcmp("texmultiple", type)) {
+ animation = new SGTexMultipleAnimation(prop_root, node);
+ } else if (!strcmp("blend", type)) {
+ animation = new SGBlendAnimation(prop_root, node);
} else {
- animation = new NullAnimation(node);
+ animation = new SGNullAnimation(node);
SG_LOG(SG_INPUT, SG_WARN, "Unknown animation type " << type);
}
////////////////////////////////////////////////////////////////////////
ssgBranch *
-fgLoad3DModel( const string &fg_root, const string &path,
+sgLoad3DModel( const string &fg_root, const string &path,
SGPropertyNode *prop_root,
double sim_time_sec )
{
ssgTransform * alignmainmodel = new ssgTransform;
alignmainmodel->addKid(model);
sgMat4 res_matrix;
- fgMakeOffsetsMatrix(&res_matrix,
+ sgMakeOffsetsMatrix(&res_matrix,
props.getFloatValue("/offsets/heading-deg", 0.0),
props.getFloatValue("/offsets/roll-deg", 0.0),
props.getFloatValue("/offsets/pitch-deg", 0.0),
const char * name = animation_nodes[i]->getStringValue("name", 0);
vector<SGPropertyNode_ptr> name_nodes =
animation_nodes[i]->getChildren("object-name");
- fgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
+ sgMakeAnimation( model, name, name_nodes, prop_root, animation_nodes[i],
sim_time_sec);
}
SGPropertyNode_ptr node = model_nodes[i];
ssgTransform * align = new ssgTransform;
sgMat4 res_matrix;
- fgMakeOffsetsMatrix(&res_matrix,
+ sgMakeOffsetsMatrix(&res_matrix,
node->getFloatValue("offsets/heading-deg", 0.0),
node->getFloatValue("offsets/roll-deg", 0.0),
node->getFloatValue("offsets/pitch-deg", 0.0),
node->getFloatValue("offsets/z-m", 0.0));
align->setTransform(res_matrix);
- ssgBranch * kid = fgLoad3DModel( fg_root, node->getStringValue("path"),
+ ssgBranch * kid = sgLoad3DModel( fg_root, node->getStringValue("path"),
prop_root, sim_time_sec );
align->addKid(kid);
model->addKid(align);