Model-loading patch from Dave Luff.
This commit is contained in:
parent
f65f1800c7
commit
18a3df31b3
1 changed files with 12 additions and 14 deletions
|
@ -69,22 +69,24 @@ FGAircraftModel::init ()
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "Initializing aircraft 3D model");
|
SG_LOG(SG_INPUT, SG_INFO, "Initializing aircraft 3D model");
|
||||||
|
|
||||||
// Load the 3D aircraft object itself
|
// Load the 3D aircraft object itself
|
||||||
SGPath path = globals->get_fg_root();
|
// DCL - the xml parser requires the full path but the ssgLoader doesn't
|
||||||
path.append(fgGetString("/sim/model/path", "Models/Geometry/glider.ac"));
|
// so lets have two paths.
|
||||||
|
SGPath xmlpath = globals->get_fg_root();
|
||||||
|
SGPath modelpath = (string)fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
|
||||||
|
xmlpath.append(modelpath.str());
|
||||||
|
|
||||||
if (path.str().substr(path.str().size() - 4, 4) == ".xml") {
|
if (xmlpath.str().substr(xmlpath.str().size() - 4, 4) == ".xml") {
|
||||||
readProperties(path.str(), &props);
|
readProperties(xmlpath.str(), &props);
|
||||||
if (props.hasValue("/path")) {
|
if (props.hasValue("/path")) {
|
||||||
path = path.dir();;
|
modelpath = modelpath.dir();
|
||||||
path.append(props.getStringValue("/path"));
|
modelpath.append(props.getStringValue("/path"));
|
||||||
} else {
|
} else {
|
||||||
path = globals->get_fg_root();
|
modelpath = "Models/Geometry/glider.ac";
|
||||||
path.append("Models/Geometry/glider.ac");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ssgTexturePath((char *)path.dir().c_str());
|
ssgTexturePath((char *)xmlpath.dir().c_str());
|
||||||
_model = ssgLoad((char *)path.c_str());
|
_model = ssgLoad((char *)modelpath.c_str());
|
||||||
if (_model == 0) {
|
if (_model == 0) {
|
||||||
_model = ssgLoad((char *)"Models/Geometry/glider.ac");
|
_model = ssgLoad((char *)"Models/Geometry/glider.ac");
|
||||||
if (_model == 0)
|
if (_model == 0)
|
||||||
|
@ -381,7 +383,3 @@ FGAircraftModel::Animation::setRotation()
|
||||||
|
|
||||||
|
|
||||||
// end of model.cxx
|
// end of model.cxx
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue