]> git.mxchange.org Git - simgear.git/commitdiff
Add option to SGLoadTexture2D to load dynamic textures
authortimoore <timoore>
Fri, 7 Dec 2007 09:13:34 +0000 (09:13 +0000)
committertimoore <timoore>
Fri, 7 Dec 2007 09:13:34 +0000 (09:13 +0000)
simgear/scene/model/model.cxx
simgear/scene/model/model.hxx

index 76d5a90fdf61553a806725950f56e2c945044ca5..becc88c6d824cd128eeb64eb21ecf61feae617dc 100644 (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
index 2f2b01af058ecbb05f4e2e190543062d16dd209c..db7f663806d48a006f21aba6d4167cb922c7b159 100644 (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