From de64b6f2670cfa9b50d86c4b8f2e6edc56038f05 Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 5 Jul 2004 11:42:19 +0000 Subject: [PATCH] Allow the use of a tag to specify the directory containing the textures for this model. --- simgear/scene/model/model.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/simgear/scene/model/model.cxx b/simgear/scene/model/model.cxx index 78446fa5..f23f59ec 100644 --- a/simgear/scene/model/model.cxx +++ b/simgear/scene/model/model.cxx @@ -223,11 +223,11 @@ sgLoad3DModel( const string &fg_root, const string &path, SGPropertyNode props; // Load the 3D aircraft object itself - SGPath modelpath = path; + SGPath modelpath = path, texturepath = path; if ( !ulIsAbsolutePathName( path.c_str() ) ) { SGPath tmp = fg_root; tmp.append(modelpath.str()); - modelpath = tmp; + modelpath = texturepath = tmp; } // Check for an XML wrapper @@ -236,6 +236,10 @@ sgLoad3DModel( const string &fg_root, const string &path, if (props.hasValue("/path")) { modelpath = modelpath.dir(); modelpath.append(props.getStringValue("/path")); + if (props.hasValue("/texture-path")) { + texturepath = texturepath.dir(); + texturepath.append(props.getStringValue("/texture-path")); + } } else { if (model == 0) model = new ssgBranch; @@ -245,7 +249,7 @@ sgLoad3DModel( const string &fg_root, const string &path, // Assume that textures are in // the same location as the XML file. if (model == 0) { - ssgTexturePath((char *)modelpath.dir().c_str()); + ssgTexturePath((char *)texturepath.dir().c_str()); model = (ssgBranch *)ssgLoad((char *)modelpath.c_str()); if (model == 0) throw sg_exception("Failed to load 3D model"); -- 2.39.5