From 9528bd07498720db40817e4e0d5fff08350f2032 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Sun, 7 Nov 2021 09:16:45 +0000 Subject: [PATCH] WS30: Photoscenery code cleanup, reduce log spam --- simgear/scene/tgdb/VPBTechnique.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/simgear/scene/tgdb/VPBTechnique.cxx b/simgear/scene/tgdb/VPBTechnique.cxx index 71f882db..ca283727 100644 --- a/simgear/scene/tgdb/VPBTechnique.cxx +++ b/simgear/scene/tgdb/VPBTechnique.cxx @@ -73,7 +73,6 @@ VPBTechnique::VPBTechnique(const SGReaderWriterOptions* options, const string& f setFilterMatrixAs(GAUSSIAN); setOptions(options); _randomObjectsConstraintGroup = new osg::Group(); - SG_LOG(SG_TERRAIN, SG_ALERT, "VPBTechnique for " << _fileName); } VPBTechnique::VPBTechnique(const VPBTechnique& gt,const osg::CopyOp& copyop): @@ -1292,11 +1291,12 @@ void VPBTechnique::applyColorLayers(BufferData& buffer, Locator* masterLocator) } if (photoScenery) { + // Photoscenery is enabled, so we need to find and assign the orthophoto texture // Firstly, we need to work out the texture file we want to load. Fortunately this follows the same // naming convention as the VPB scenery itself. auto tileID = _terrainTile->getTileID(); - SG_LOG(SG_TERRAIN, SG_ALERT, "Using Photoscenery for " << tileID.level << " X" << tileID.x << " Y" << tileID.y); + SG_LOG(SG_TERRAIN, SG_DEBUG, "Using Photoscenery for " << tileID.level << " X" << tileID.x << " Y" << tileID.y); const osg::Vec3d world = buffer._transform->getMatrix().getTrans(); const SGGeod loc = SGGeod::fromCart(toSG(world)); @@ -1307,17 +1307,21 @@ void VPBTechnique::applyColorLayers(BufferData& buffer, Locator* masterLocator) SGPath orthotexture = SGPath(base); orthotexture.append("Orthophotos"); orthotexture.append(bucket.gen_vpb_subtile(tileID.level, tileID.x, tileID.y) + ".dds"); - SG_LOG(SG_TERRAIN, SG_ALERT, "Using " << orthotexture); + SG_LOG(SG_TERRAIN, SG_DEBUG, "Using phototexture " << orthotexture); if (orthotexture.exists()) { - osg::Texture2D* texture = SGLoadTexture2D(SGPath(orthotexture), _options, false, false); + // Set up the texture with wrapping of UV to reduce black edges at tile boundaries. + osg::Texture2D* texture = SGLoadTexture2D(SGPath(orthotexture), _options, true, true); osg::StateSet* stateset = buffer._landGeode->getOrCreateStateSet(); stateset->setTextureAttributeAndModes(0, texture); } else { - SG_LOG(SG_TERRAIN, SG_ALERT, "Unable to find " << orthotexture); + SG_LOG(SG_TERRAIN, SG_DEBUG, "Unable to find " << orthotexture); + photoScenery = false; } + } - } else { + if (!photoScenery) { + // Either photoscenery is turned off, or we failed to find a suitable texture. SGMaterialLibPtr matlib = _options->getMaterialLib(); if (!matlib) return; @@ -2123,8 +2127,6 @@ void VPBTechnique::applyCoastline(BufferData& buffer, Locator* masterLocator) if (v->size() == 0) return; - //SG_LOG(SG_TERRAIN, SG_ALERT, "Generating coastline of " << v->size() << " vertices."); - c->push_back(osg::Vec4(1.0,1.0,1.0,1.0)); osg::ref_ptr geometry = new osg::Geometry;