WS30: Don't compress landclass textures
Previously landclass textures were compressed by out internal optimizer. This caused bad artifacts on landclass boundaries, e.g. where landclass 1 met landclass 10 there would be compression/interpolation artifact with a value of (say) 5. This disables compression for such landclass textures.
This commit is contained in:
@@ -656,7 +656,8 @@ OptimizeModelPolicy::OptimizeModelPolicy(const string& extension) :
|
|||||||
|
|
||||||
osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
|
osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
|
||||||
const string& fileName,
|
const string& fileName,
|
||||||
const osgDB::Options* opt)
|
const osgDB::Options* opt,
|
||||||
|
const bool compressTextures)
|
||||||
{
|
{
|
||||||
osgUtil::Optimizer optimizer;
|
osgUtil::Optimizer optimizer;
|
||||||
optimizer.optimize(node, _osgOptions);
|
optimizer.optimize(node, _osgOptions);
|
||||||
@@ -666,8 +667,11 @@ osg::Node* OptimizeModelPolicy::optimize(osg::Node* node,
|
|||||||
SGTexDataVarianceVisitor dataVarianceVisitor;
|
SGTexDataVarianceVisitor dataVarianceVisitor;
|
||||||
node->accept(dataVarianceVisitor);
|
node->accept(dataVarianceVisitor);
|
||||||
|
|
||||||
SGTexCompressionVisitor texComp;
|
if (compressTextures) {
|
||||||
node->accept(texComp);
|
SGTexCompressionVisitor texComp;
|
||||||
|
node->accept(texComp);
|
||||||
|
}
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1065,9 +1069,14 @@ struct OSGOptimizePolicy : public OptimizeModelPolicy {
|
|||||||
terrain->addChild(optimized.get());
|
terrain->addChild(optimized.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We don't want any textures compressed, as these contain landclass information that doesn't
|
||||||
|
// interpolate well.
|
||||||
|
optimized = OptimizeModelPolicy::optimize(optimized, fileName, opt, false);
|
||||||
|
} else {
|
||||||
|
optimized = OptimizeModelPolicy::optimize(optimized, fileName, opt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
optimized = OptimizeModelPolicy::optimize(optimized, fileName, opt);
|
|
||||||
Group* group = dynamic_cast<Group*>(optimized.get());
|
Group* group = dynamic_cast<Group*>(optimized.get());
|
||||||
MatrixTransform* transform
|
MatrixTransform* transform
|
||||||
= dynamic_cast<MatrixTransform*>(optimized.get());
|
= dynamic_cast<MatrixTransform*>(optimized.get());
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class OptimizeModelPolicy {
|
|||||||
public:
|
public:
|
||||||
OptimizeModelPolicy(const std::string& extension);
|
OptimizeModelPolicy(const std::string& extension);
|
||||||
osg::Node* optimize(osg::Node* node, const std::string& fileName,
|
osg::Node* optimize(osg::Node* node, const std::string& fileName,
|
||||||
const osgDB::Options* opt);
|
const osgDB::Options* opt, const bool compressTextures=true);
|
||||||
protected:
|
protected:
|
||||||
unsigned _osgOptions;
|
unsigned _osgOptions;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user