Merge branch 'next' of git://gitorious.org/fg/flightgear into next
This commit is contained in:
commit
e7ed88af92
11 changed files with 60 additions and 68 deletions
projects/VC90/FlightGear
src
AIModel
FDM/JSBSim
Instrumentation/HUD
Main
|
@ -2055,14 +2055,6 @@
|
||||||
RelativePath="..\..\..\src\FDM\JSBSim\FGJSBBase.h"
|
RelativePath="..\..\..\src\FDM\JSBSim\FGJSBBase.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\FDM\JSBSim\FGState.cpp"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="..\..\..\src\FDM\JSBSim\FGState.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\..\src\FDM\JSBSim\JSBSim.cxx"
|
RelativePath="..\..\..\src\FDM\JSBSim\JSBSim.cxx"
|
||||||
>
|
>
|
||||||
|
|
|
@ -43,6 +43,11 @@ FGSubmodelMgr::~FGSubmodelMgr()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FGAIManager* FGSubmodelMgr::aiManager()
|
||||||
|
{
|
||||||
|
return (FGAIManager*)globals->get_subsystem("ai_model");
|
||||||
|
}
|
||||||
|
|
||||||
void FGSubmodelMgr::init()
|
void FGSubmodelMgr::init()
|
||||||
{
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
|
@ -74,8 +79,6 @@ void FGSubmodelMgr::init()
|
||||||
_contrail_trigger = fgGetNode("ai/submodels/contrails", true);
|
_contrail_trigger = fgGetNode("ai/submodels/contrails", true);
|
||||||
_contrail_trigger->setBoolValue(false);
|
_contrail_trigger->setBoolValue(false);
|
||||||
|
|
||||||
ai = (FGAIManager*)globals->get_subsystem("ai_model");
|
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -116,9 +119,9 @@ void FGSubmodelMgr::update(double dt)
|
||||||
_expiry = false;
|
_expiry = false;
|
||||||
|
|
||||||
// check if the submodel hit an object or terrain
|
// check if the submodel hit an object or terrain
|
||||||
sm_list = ai->get_ai_list();
|
FGAIManager::ai_list_type sm_list(aiManager()->get_ai_list());
|
||||||
sm_list_iterator sm_list_itr = sm_list.begin();
|
FGAIManager::ai_list_iterator sm_list_itr = sm_list.begin(),
|
||||||
sm_list_iterator end = sm_list.end();
|
end = sm_list.end();
|
||||||
|
|
||||||
for (; sm_list_itr != end; ++sm_list_itr) {
|
for (; sm_list_itr != end; ++sm_list_itr) {
|
||||||
FGAIBase::object_type object_type =(*sm_list_itr)->getType();
|
FGAIBase::object_type object_type =(*sm_list_itr)->getType();
|
||||||
|
@ -300,7 +303,8 @@ bool FGSubmodelMgr::release(submodel *sm, double dt)
|
||||||
ballist->setParentNodes(_selected_ac);
|
ballist->setParentNodes(_selected_ac);
|
||||||
ballist->setContentsNode(sm->contents_node);
|
ballist->setContentsNode(sm->contents_node);
|
||||||
ballist->setWeight(sm->weight);
|
ballist->setWeight(sm->weight);
|
||||||
ai->attach(ballist);
|
|
||||||
|
aiManager()->attach(ballist);
|
||||||
|
|
||||||
if (sm->count > 0)
|
if (sm->count > 0)
|
||||||
sm->count--;
|
sm->count--;
|
||||||
|
@ -383,8 +387,6 @@ void FGSubmodelMgr::transform(submodel *sm)
|
||||||
} else {
|
} else {
|
||||||
// set the data for a submodel tied to an AI Object
|
// set the data for a submodel tied to an AI Object
|
||||||
//cout << " set the data for a submodel tied to an AI Object " << id << endl;
|
//cout << " set the data for a submodel tied to an AI Object " << id << endl;
|
||||||
sm_list_iterator sm_list_itr = sm_list.begin();
|
|
||||||
sm_list_iterator end = sm_list.end();
|
|
||||||
setParentNode(id);
|
setParentNode(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,15 +479,15 @@ void FGSubmodelMgr::loadAI()
|
||||||
{
|
{
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Submodels: Loading AI submodels ");
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Submodels: Loading AI submodels ");
|
||||||
|
|
||||||
sm_list = ai->get_ai_list();
|
FGAIManager::ai_list_type sm_list(aiManager()->get_ai_list());
|
||||||
|
|
||||||
if (sm_list.empty()) {
|
if (sm_list.empty()) {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Submodels: Unable to read AI submodel list");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Submodels: Unable to read AI submodel list");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sm_list_iterator sm_list_itr = sm_list.begin();
|
FGAIManager::ai_list_iterator sm_list_itr = sm_list.begin(),
|
||||||
sm_list_iterator end = sm_list.end();
|
end = sm_list.end();
|
||||||
|
|
||||||
while (sm_list_itr != end) {
|
while (sm_list_itr != end) {
|
||||||
string path = (*sm_list_itr)->_getSMPath();
|
string path = (*sm_list_itr)->_getSMPath();
|
||||||
|
|
|
@ -13,17 +13,13 @@
|
||||||
|
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
#include <AIModel/AIBase.hxx>
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
|
||||||
|
|
||||||
using std::vector;
|
|
||||||
using std::string;
|
|
||||||
using std::list;
|
|
||||||
|
|
||||||
class FGAIBase;
|
class FGAIBase;
|
||||||
|
class FGAIManager;
|
||||||
|
|
||||||
class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener
|
class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
|
@ -37,8 +33,8 @@ public:
|
||||||
SGPropertyNode_ptr submodel_node;
|
SGPropertyNode_ptr submodel_node;
|
||||||
SGPropertyNode_ptr speed_node;
|
SGPropertyNode_ptr speed_node;
|
||||||
|
|
||||||
string name;
|
std::string name;
|
||||||
string model;
|
std::string model;
|
||||||
double speed;
|
double speed;
|
||||||
bool slaved;
|
bool slaved;
|
||||||
bool repeat;
|
bool repeat;
|
||||||
|
@ -68,13 +64,13 @@ public:
|
||||||
bool collision;
|
bool collision;
|
||||||
bool expiry;
|
bool expiry;
|
||||||
bool impact;
|
bool impact;
|
||||||
string impact_report;
|
std::string impact_report;
|
||||||
double fuse_range;
|
double fuse_range;
|
||||||
string submodel;
|
std::string submodel;
|
||||||
int sub_id;
|
int sub_id;
|
||||||
bool force_stabilised;
|
bool force_stabilised;
|
||||||
bool ext_force;
|
bool ext_force;
|
||||||
string force_path;
|
std::string force_path;
|
||||||
} submodel;
|
} submodel;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -112,7 +108,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef vector <submodel*> submodel_vector_type;
|
typedef std::vector <submodel*> submodel_vector_type;
|
||||||
typedef submodel_vector_type::iterator submodel_vector_iterator;
|
typedef submodel_vector_type::iterator submodel_vector_iterator;
|
||||||
|
|
||||||
submodel_vector_type submodels;
|
submodel_vector_type submodels;
|
||||||
|
@ -186,22 +182,17 @@ private:
|
||||||
SGPropertyNode_ptr _path_node;
|
SGPropertyNode_ptr _path_node;
|
||||||
SGPropertyNode_ptr _selected_ac;
|
SGPropertyNode_ptr _selected_ac;
|
||||||
|
|
||||||
|
|
||||||
FGAIManager* ai;
|
|
||||||
IC_struct IC;
|
IC_struct IC;
|
||||||
|
|
||||||
// A list of pointers to AI objects
|
/**
|
||||||
typedef list <SGSharedPtr<FGAIBase> > sm_list_type;
|
* Helper to retrieve the AI manager, if it currently exists
|
||||||
typedef sm_list_type::iterator sm_list_iterator;
|
*/
|
||||||
typedef sm_list_type::const_iterator sm_list_const_iterator;
|
FGAIManager* aiManager();
|
||||||
|
|
||||||
sm_list_type sm_list;
|
|
||||||
|
|
||||||
|
|
||||||
void loadAI();
|
void loadAI();
|
||||||
void loadSubmodels();
|
void loadSubmodels();
|
||||||
void setData(int id, string& path, bool serviceable);
|
void setData(int id, std::string& path, bool serviceable);
|
||||||
void setSubData(int id, string& path, bool serviceable);
|
void setSubData(int id, std::string& path, bool serviceable);
|
||||||
void valueChanged (SGPropertyNode *);
|
void valueChanged (SGPropertyNode *);
|
||||||
void transform(submodel *);
|
void transform(submodel *);
|
||||||
void setParentNode(int parent_id);
|
void setParentNode(int parent_id);
|
||||||
|
|
|
@ -96,7 +96,7 @@ void checkTied ( FGPropertyManager *node )
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
// Constructors
|
// Constructors
|
||||||
FGFDMExec::FGFDMExec(FGPropertyManager* root) : Root(root)
|
FGFDMExec::FGFDMExec(FGPropertyManager* root) : Root(root), delete_root(false)
|
||||||
{
|
{
|
||||||
FDMctr = new unsigned int;
|
FDMctr = new unsigned int;
|
||||||
*FDMctr = 0;
|
*FDMctr = 0;
|
||||||
|
@ -104,7 +104,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root) : Root(root)
|
||||||
root_overload = (root != NULL);
|
root_overload = (root != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr)
|
FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), delete_root(false), FDMctr(fdmctr)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
root_overload = (root != NULL);
|
root_overload = (root != NULL);
|
||||||
|
@ -152,6 +152,7 @@ void FGFDMExec::Initialize()
|
||||||
|
|
||||||
if (Root == 0) { // Then this is the root FDM
|
if (Root == 0) { // Then this is the root FDM
|
||||||
Root = new FGPropertyManager; // Create the property manager
|
Root = new FGPropertyManager; // Create the property manager
|
||||||
|
delete_root = true;
|
||||||
|
|
||||||
FDMctr = new unsigned int; // Create and initialize the child FDM counter
|
FDMctr = new unsigned int; // Create and initialize the child FDM counter
|
||||||
(*FDMctr) = 0;
|
(*FDMctr) = 0;
|
||||||
|
@ -198,7 +199,8 @@ FGFDMExec::~FGFDMExec()
|
||||||
|
|
||||||
if(FDMctr != 0 && !root_overload) {
|
if(FDMctr != 0 && !root_overload) {
|
||||||
if(Root != 0) {
|
if(Root != 0) {
|
||||||
delete Root;
|
if (delete_root)
|
||||||
|
delete Root;
|
||||||
Root = 0;
|
Root = 0;
|
||||||
}
|
}
|
||||||
if (IdFDM == 0) { // Meaning this is no child FDM
|
if (IdFDM == 0) { // Meaning this is no child FDM
|
||||||
|
|
|
@ -556,6 +556,7 @@ private:
|
||||||
FGTrim* Trim;
|
FGTrim* Trim;
|
||||||
|
|
||||||
FGPropertyManager* Root;
|
FGPropertyManager* Root;
|
||||||
|
bool delete_root;
|
||||||
FGPropertyManager* instance;
|
FGPropertyManager* instance;
|
||||||
|
|
||||||
// The FDM counter is used to give each child FDM an unique ID. The root FDM has the ID 0
|
// The FDM counter is used to give each child FDM an unique ID. The root FDM has the ID 0
|
||||||
|
|
|
@ -599,7 +599,6 @@ private:
|
||||||
double _default_heading;
|
double _default_heading;
|
||||||
GLint _view[4];
|
GLint _view[4];
|
||||||
FGRunway* _runway;
|
FGRunway* _runway;
|
||||||
FGViewer* _cockpit_view;
|
|
||||||
unsigned short _stipple_out; // stipple pattern of the outline of the runway
|
unsigned short _stipple_out; // stipple pattern of the outline of the runway
|
||||||
unsigned short _stipple_center; // stipple pattern of the center line of the runway
|
unsigned short _stipple_center; // stipple pattern of the center line of the runway
|
||||||
bool _draw_arrow; // draw arrow when runway is not visible in HUD
|
bool _draw_arrow; // draw arrow when runway is not visible in HUD
|
||||||
|
|
|
@ -49,7 +49,6 @@ HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
|
||||||
_scale_dist(node->getDoubleValue("scale-dist-nm")),
|
_scale_dist(node->getDoubleValue("scale-dist-nm")),
|
||||||
_default_pitch(fgGetDouble("/sim/view[0]/config/pitch-pitch-deg", 0.0)),
|
_default_pitch(fgGetDouble("/sim/view[0]/config/pitch-pitch-deg", 0.0)),
|
||||||
_default_heading(fgGetDouble("/sim/view[0]/config/pitch-heading-deg", 0.0)),
|
_default_heading(fgGetDouble("/sim/view[0]/config/pitch-heading-deg", 0.0)),
|
||||||
_cockpit_view(globals->get_viewmgr()->get_view(0)),
|
|
||||||
_stipple_out(node->getIntValue("outer_stipple", 0xFFFF)),
|
_stipple_out(node->getIntValue("outer_stipple", 0xFFFF)),
|
||||||
_stipple_center(node->getIntValue("center-stipple", 0xFFFF)),
|
_stipple_center(node->getIntValue("center-stipple", 0xFFFF)),
|
||||||
_draw_arrow(_arrow_scale > 0 ? true : false),
|
_draw_arrow(_arrow_scale > 0 ? true : false),
|
||||||
|
@ -69,7 +68,6 @@ HUD::Runway::Runway(HUD *hud, const SGPropertyNode *node, float x, float y) :
|
||||||
_top = _center_y + (_h / 2) + _y;
|
_top = _center_y + (_h / 2) + _y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HUD::Runway::draw()
|
void HUD::Runway::draw()
|
||||||
{
|
{
|
||||||
_runway = get_active_runway();
|
_runway = get_active_runway();
|
||||||
|
@ -87,8 +85,10 @@ void HUD::Runway::draw()
|
||||||
double po = curr_view->getPitchOffset_deg();
|
double po = curr_view->getPitchOffset_deg();
|
||||||
double ho = curr_view->getHeadingOffset_deg();
|
double ho = curr_view->getHeadingOffset_deg();
|
||||||
|
|
||||||
double yaw = -(_cockpit_view->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
|
FGViewer* cockpitView = globals->get_viewmgr()->get_view(0);
|
||||||
double pitch = (_cockpit_view->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
|
|
||||||
|
double yaw = -(cockpitView->getHeadingOffset_deg() - _default_heading) * SG_DEGREES_TO_RADIANS;
|
||||||
|
double pitch = (cockpitView->getPitchOffset_deg() - _default_pitch) * SG_DEGREES_TO_RADIANS;
|
||||||
//double roll = fgGetDouble("/sim/view[0]/config/roll-offset-deg",0.0) //TODO: adjust for default roll offset
|
//double roll = fgGetDouble("/sim/view[0]/config/roll-offset-deg",0.0) //TODO: adjust for default roll offset
|
||||||
double sPitch = sin(pitch), cPitch = cos(pitch),
|
double sPitch = sin(pitch), cPitch = cos(pitch),
|
||||||
sYaw = sin(yaw), cYaw = cos(yaw);
|
sYaw = sin(yaw), cYaw = cos(yaw);
|
||||||
|
|
|
@ -392,9 +392,11 @@ static bool
|
||||||
do_panel_load (const SGPropertyNode * arg)
|
do_panel_load (const SGPropertyNode * arg)
|
||||||
{
|
{
|
||||||
string panel_path =
|
string panel_path =
|
||||||
arg->getStringValue("path",
|
arg->getStringValue("path", fgGetString("/sim/panel/path"));
|
||||||
fgGetString("/sim/panel/path",
|
if (panel_path.empty()) {
|
||||||
"Panels/Default/default.xml"));
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FGPanel * new_panel = fgReadPanel(panel_path);
|
FGPanel * new_panel = fgReadPanel(panel_path);
|
||||||
if (new_panel == 0) {
|
if (new_panel == 0) {
|
||||||
SG_LOG(SG_INPUT, SG_ALERT,
|
SG_LOG(SG_INPUT, SG_ALERT,
|
||||||
|
|
|
@ -1414,20 +1414,20 @@ bool fgInitSubsystems() {
|
||||||
// Add a new 2D panel.
|
// Add a new 2D panel.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
string panel_path = fgGetString("/sim/panel/path",
|
string panel_path(fgGetString("/sim/panel/path"));
|
||||||
"Panels/Default/default.xml");
|
if (!panel_path.empty()) {
|
||||||
|
FGPanel* p = fgReadPanel(panel_path);
|
||||||
globals->set_current_panel( fgReadPanel(panel_path) );
|
if (p) {
|
||||||
if (globals->get_current_panel() == 0) {
|
globals->set_current_panel(p);
|
||||||
|
p->init();
|
||||||
|
p->bind();
|
||||||
|
SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path );
|
||||||
|
} else {
|
||||||
SG_LOG( SG_INPUT, SG_ALERT,
|
SG_LOG( SG_INPUT, SG_ALERT,
|
||||||
"Error reading new panel from " << panel_path );
|
"Error reading new panel from " << panel_path );
|
||||||
} else {
|
}
|
||||||
SG_LOG( SG_INPUT, SG_INFO, "Loaded new panel from " << panel_path );
|
|
||||||
globals->get_current_panel()->init();
|
|
||||||
globals->get_current_panel()->bind();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Initialize the controls subsystem.
|
// Initialize the controls subsystem.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -167,6 +167,7 @@ FGGlobals::~FGGlobals()
|
||||||
// shut down all subsystems, make sure we take down the
|
// shut down all subsystems, make sure we take down the
|
||||||
// AIModels system first.
|
// AIModels system first.
|
||||||
SGSubsystem* ai = subsystem_mgr->remove("ai_model");
|
SGSubsystem* ai = subsystem_mgr->remove("ai_model");
|
||||||
|
ai->unbind();
|
||||||
delete ai;
|
delete ai;
|
||||||
|
|
||||||
subsystem_mgr->unbind();
|
subsystem_mgr->unbind();
|
||||||
|
|
|
@ -651,6 +651,8 @@ FGViewer::update (double dt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recalc();
|
recalc();
|
||||||
_cameraGroup->update(toOsg(_absolute_view_pos), toOsg(mViewOrientation));
|
if( fgGetBool( "/sim/rendering/draw-otw", true ) ) {
|
||||||
_cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
|
_cameraGroup->update(toOsg(_absolute_view_pos), toOsg(mViewOrientation));
|
||||||
|
_cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue