Merge /u/dancliff/flightgear/ branch fix_for_AI_radius into next
https://sourceforge.net/p/flightgear/flightgear/merge-requests/163/
This commit is contained in:
commit
4915b7d3a5
1 changed files with 18 additions and 0 deletions
|
@ -87,6 +87,12 @@ public:
|
||||||
_hasInteriorPath = true;
|
_hasInteriorPath = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save radius of loaded model for updating LOD
|
||||||
|
auto bs = n->getBound();
|
||||||
|
if (bs.valid()) {
|
||||||
|
_radius = bs.radius();
|
||||||
|
}
|
||||||
|
|
||||||
_fxpath = prop->getStringValue("sound/path");
|
_fxpath = prop->getStringValue("sound/path");
|
||||||
_nasal[path] = std::unique_ptr<FGNasalModelDataProxy>(new FGNasalModelDataProxy(_root));
|
_nasal[path] = std::unique_ptr<FGNasalModelDataProxy>(new FGNasalModelDataProxy(_root));
|
||||||
_nasal[path]->modelLoaded(path, prop, n);
|
_nasal[path]->modelLoaded(path, prop, n);
|
||||||
|
@ -106,6 +112,7 @@ public:
|
||||||
bool getInteriorLoaded(void) { return _interiorLoaded;}
|
bool getInteriorLoaded(void) { return _interiorLoaded;}
|
||||||
bool hasInteriorPath(void) { return _hasInteriorPath;}
|
bool hasInteriorPath(void) { return _hasInteriorPath;}
|
||||||
inline std::string& getInteriorPath() { return _interiorPath; }
|
inline std::string& getInteriorPath() { return _interiorPath; }
|
||||||
|
inline float getRadius() { return _radius; }
|
||||||
private:
|
private:
|
||||||
std::string _fxpath;
|
std::string _fxpath;
|
||||||
std::string _interiorPath;
|
std::string _interiorPath;
|
||||||
|
@ -116,6 +123,7 @@ private:
|
||||||
bool _initialized = false;
|
bool _initialized = false;
|
||||||
bool _hasInteriorPath = false;
|
bool _hasInteriorPath = false;
|
||||||
bool _interiorLoaded = false;
|
bool _interiorLoaded = false;
|
||||||
|
float _radius = -1.0;
|
||||||
SGPropertyNode* _root;
|
SGPropertyNode* _root;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -291,6 +299,16 @@ void FGAIBase::update(double dt) {
|
||||||
// which must be done in main thread
|
// which must be done in main thread
|
||||||
_modeldata->init();
|
_modeldata->init();
|
||||||
|
|
||||||
|
// update LOD radius from loaded modeldata
|
||||||
|
auto radius = _modeldata->getRadius();
|
||||||
|
if (radius > 0) {
|
||||||
|
_model->setRadius(radius);
|
||||||
|
_model->dirtyBound();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SG_LOG(SG_AI, SG_WARN, "AIBase: model radius not set.");
|
||||||
|
}
|
||||||
|
|
||||||
// sound initialization
|
// sound initialization
|
||||||
if (fgGetBool("/sim/sound/aimodels/enabled",false))
|
if (fgGetBool("/sim/sound/aimodels/enabled",false))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue