osg::Image* image = osgDB::readImageFile(fullMaskPath, options);
if (image && image->valid())
{
- osg::Texture2D* object_mask = new osg::Texture2D;
+ Texture2DRef object_mask = new osg::Texture2D;
bool dds_mask = (ompath.lower_extension() == "dds");
// so we index based on the texture index,
unsigned int i = triangleBin.getTextureIndex() % _status.size();
if (i < _masks.size()) {
- return _masks[i];
+ return _masks[i].get();
} else {
return 0;
}
class StateSet;
}
+
+typedef osg::ref_ptr<osg::Texture2D> Texture2DRef;
+
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/threads/SGThread.hxx> // for SGMutex
#include <simgear/math/SGMath.hxx>
// Object mask, a simple RGB texture used as a mask when placing
// random vegetation, objects and buildings
- std::vector<osg::Texture2D*> _masks;
+ std::vector<Texture2DRef> _masks;
// Condition, indicating when this material is active
SGSharedPtr<const SGCondition> condition;