Fall back to taking tree textures from Terrain/ if they are not found under
Terrain.high, consistent with the other textures in materials.xml. Also fix comment.
This commit is contained in:
parent
1af8aacd1d
commit
c473cd7213
@ -244,9 +244,21 @@ SGMaterial::read_properties(const SGReaderWriterOptions* options,
|
|||||||
tree_varieties = props->getIntValue("tree-varieties", 1);
|
tree_varieties = props->getIntValue("tree-varieties", 1);
|
||||||
|
|
||||||
const SGPropertyNode* treeTexNode = props->getChild("tree-texture");
|
const SGPropertyNode* treeTexNode = props->getChild("tree-texture");
|
||||||
|
|
||||||
if (treeTexNode) {
|
if (treeTexNode) {
|
||||||
string treeTexPath = props->getStringValue("tree-texture");
|
string treeTexPath = props->getStringValue("tree-texture");
|
||||||
tree_texture = SGModelLib::findDataFile(treeTexPath, options);
|
|
||||||
|
if (! treeTexPath.empty()) {
|
||||||
|
SGPath treePath("Textures.high");
|
||||||
|
treePath.append(treeTexPath);
|
||||||
|
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
||||||
|
|
||||||
|
if (tree_texture.empty()) {
|
||||||
|
treePath = SGPath("Textures");
|
||||||
|
treePath.append(treeTexPath);
|
||||||
|
tree_texture = SGModelLib::findDataFile(treePath.str(), options);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// surface values for use with ground reactions
|
// surface values for use with ground reactions
|
||||||
|
@ -275,9 +275,7 @@ public:
|
|||||||
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
|
SGVec2f texCoord = a*t0 + b*t1 + c*t2;
|
||||||
|
|
||||||
// Check this random point against the object mask
|
// Check this random point against the object mask
|
||||||
// blue (for buildings) channel. Also check
|
// blue (for buildings) channel.
|
||||||
// that they are more than spacing metres away from
|
|
||||||
// any other point.
|
|
||||||
osg::Image* img = object_mask->getImage();
|
osg::Image* img = object_mask->getImage();
|
||||||
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
|
unsigned int x = (int) (img->s() * texCoord.x()) % img->s();
|
||||||
unsigned int y = (int) (img->t() * texCoord.y()) % img->t();
|
unsigned int y = (int) (img->t() * texCoord.y()) % img->t();
|
||||||
|
Loading…
Reference in New Issue
Block a user