Add option to SGLoadTexture2D to load dynamic textures

This commit is contained in:
timoore 2007-12-07 09:13:34 +00:00
parent 95d857e091
commit 037d5c11a5
2 changed files with 24 additions and 5 deletions

View File

@ -37,7 +37,7 @@
SG_USING_STD(vector);
osg::Texture2D*
SGLoadTexture2D(const std::string& path,
SGLoadTexture2D(bool staticTexture, const std::string& path,
const osgDB::ReaderWriter::Options* options,
bool wrapu, bool wrapv, int)
{
@ -48,7 +48,8 @@ SGLoadTexture2D(const std::string& path,
image = osgDB::readImageFile(path);
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
texture->setImage(image);
texture->setDataVariance(osg::Object::STATIC);
if (staticTexture)
texture->setDataVariance(osg::Object::STATIC);
if (wrapu)
texture->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
else

View File

@ -81,19 +81,37 @@ sgMakeAnimation( osg::Node* model,
SGPath &texture_path,
set<osg::Node*> &ignore_branches );
osg::Texture2D*
SGLoadTexture2D(const std::string& path,
SGLoadTexture2D(bool staticTexture, const std::string& path,
const osgDB::ReaderWriter::Options* options = 0,
bool wrapu = true, bool wrapv = true, int mipmaplevels = -1);
inline osg::Texture2D*
SGLoadTexture2D(const std::string& path,
const osgDB::ReaderWriter::Options* options = 0,
bool wrapu = true, bool wrapv = true, int mipmaplevels = -1)
{
return SGLoadTexture2D(true, path, options, wrapu, wrapv, mipmaplevels);
}
inline osg::Texture2D*
SGLoadTexture2D(const SGPath& path,
const osgDB::ReaderWriter::Options* options = 0,
bool wrapu = true, bool wrapv = true,
int mipmaplevels = -1)
{
return SGLoadTexture2D(path.str(), options, wrapu, wrapv, mipmaplevels);
return SGLoadTexture2D(true, path.str(), options, wrapu, wrapv,
mipmaplevels);
}
inline osg::Texture2D*
SGLoadTexture2D(bool staticTexture, const SGPath& path,
const osgDB::ReaderWriter::Options* options = 0,
bool wrapu = true, bool wrapv = true,
int mipmaplevels = -1)
{
return SGLoadTexture2D(staticTexture, path.str(), options, wrapu, wrapv,
mipmaplevels);
}
#endif // __MODEL_HXX