Update/simplify property interpolation to latest SimGear changes
This commit is contained in:
parent
b0249bad98
commit
1e4ba18284
3 changed files with 9 additions and 46 deletions
|
@ -44,7 +44,6 @@
|
|||
#include "fg_os.hxx"
|
||||
#include "fg_commands.hxx"
|
||||
#include "fg_props.hxx"
|
||||
#include "FGInterpolator.hxx"
|
||||
#include "globals.hxx"
|
||||
#include "logger.hxx"
|
||||
#include "util.hxx"
|
||||
|
@ -900,21 +899,10 @@ do_property_randomize (const SGPropertyNode * arg)
|
|||
static bool
|
||||
do_property_interpolate (const SGPropertyNode * arg)
|
||||
{
|
||||
FGInterpolator* mgr =
|
||||
static_cast<FGInterpolator*>
|
||||
(
|
||||
globals->get_subsystem_mgr()
|
||||
->get_group(SGSubsystemMgr::INIT)
|
||||
->get_subsystem("prop-interpolator")
|
||||
);
|
||||
|
||||
if( !mgr )
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "No property interpolator available");
|
||||
return false;
|
||||
}
|
||||
|
||||
SGPropertyNode * prop = get_prop(arg);
|
||||
if( !prop )
|
||||
return false;
|
||||
|
||||
simgear::PropertyList time_nodes = arg->getChildren("time");
|
||||
simgear::PropertyList rate_nodes = arg->getChildren("rate");
|
||||
|
||||
|
@ -966,16 +954,13 @@ do_property_interpolate (const SGPropertyNode * arg)
|
|||
}
|
||||
}
|
||||
|
||||
mgr->interpolate
|
||||
return prop->interpolate
|
||||
(
|
||||
prop,
|
||||
arg->getStringValue("type", "numeric"),
|
||||
value_nodes,
|
||||
deltas,
|
||||
arg->getStringValue("easing", "linear")
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -570,10 +570,10 @@ void fgCreateSubsystems() {
|
|||
// Initialize the property interpolator subsystem. Put into the INIT
|
||||
// group because the "nasal" subsystem may need it at GENERAL take-down.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
globals->add_subsystem( "prop-interpolator",
|
||||
new FGInterpolator,
|
||||
SGSubsystemMgr::INIT );
|
||||
|
||||
FGInterpolator* interp = new FGInterpolator;
|
||||
interp->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
|
||||
globals->add_subsystem("prop-interpolator", interp, SGSubsystemMgr::INIT);
|
||||
SGPropertyNode::setInterpolationMgr(interp);
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Add the FlightGear property utilities.
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include <Main/globals.hxx>
|
||||
#include <Main/util.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <Main/FGInterpolator.hxx>
|
||||
|
||||
using std::map;
|
||||
|
||||
|
@ -513,19 +512,6 @@ static naRef f_cmdarg(naContext c, naRef me, int argc, naRef* args)
|
|||
// value/delta numbers.
|
||||
static naRef f_interpolate(naContext c, naRef me, int argc, naRef* args)
|
||||
{
|
||||
FGInterpolator* mgr =
|
||||
static_cast<FGInterpolator*>
|
||||
(
|
||||
globals->get_subsystem_mgr()
|
||||
->get_group(SGSubsystemMgr::INIT)
|
||||
->get_subsystem("prop-interpolator")
|
||||
);
|
||||
if( !mgr )
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_WARN, "No property interpolator available");
|
||||
return naNil();
|
||||
};
|
||||
|
||||
SGPropertyNode* node;
|
||||
naRef prop = argc > 0 ? args[0] : naNil();
|
||||
if(naIsString(prop)) node = fgGetNode(naStr_data(prop), true);
|
||||
|
@ -549,15 +535,7 @@ static naRef f_interpolate(naContext c, naRef me, int argc, naRef* args)
|
|||
deltas.push_back(naNumValue(naVec_get(curve, 2*i+1)).num);
|
||||
}
|
||||
|
||||
mgr->interpolate
|
||||
(
|
||||
node,
|
||||
"numeric",
|
||||
value_nodes,
|
||||
deltas,
|
||||
"linear"
|
||||
);
|
||||
|
||||
node->interpolate("numeric", value_nodes, deltas, "linear");
|
||||
return naNil();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue