]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/newcloud.cxx
Reduce compiler.h to almost nothing (but it's worth keeping around I think, for
[simgear.git] / simgear / scene / sky / newcloud.cxx
index 7607113c6a19d047af5649d27631696dee7df358..d15b456109a90653f194e87b751137b2a2172c63 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 //
 
 #  include <simgear_config.h>
 #endif
 
+#include <osg/ref_ptr>
+#include <osg/Texture2D>
+
 #include <simgear/compiler.h>
 
 #include <plib/sg.h>
-#include <plib/ssg.h>
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/sg_path.hxx>
 
-#include STL_ALGORITHM
+#include <algorithm>
 #include SG_GLU_H
 
 #include "cloudfield.hxx"
 /*
 */
 
-static ssgTexture *cloudTextures[SGNewCloud::CLTexture_max];
+static osg::ref_ptr<osg::Texture2D> cloudTextures[SGNewCloud::CLTexture_max];
 
 
 bool SGNewCloud::useAnisotropic = true;
 SGBbCache *SGNewCloud::cldCache = 0;
 static bool texturesLoaded = false;
 static float minx, maxx, miny, maxy, minz, maxz;
+static int cloudIdCounter = 1;
 
 float SGNewCloud::nearRadius = 3500.0f;
 bool SGNewCloud::lowQuality = false;
@@ -64,7 +67,7 @@ void SGNewCloud::init(void) {
        pauseLength = 0.0f;
        last_step = -1.0f;
        familly = CLFamilly_nn;
-       cloudId = (int) this;
+       cloudId = ++cloudIdCounter;
        sgSetVec3(center, 0.0f, 0.0f, 0.0f);
        sgSetVec3(cloudpos, 0.0f, 0.0f, 0.0f);
        radius = 0.0f;
@@ -127,13 +130,15 @@ void SGNewCloud::loadTextures(const string &tex_path) {
 
     cloud_path.set(tex_path);
     cloud_path.append("cl_cumulus.rgb");
-    cloudTextures[ CLTexture_cumulus ] = new ssgTexture( cloud_path.str().c_str(), false, false, false );
-    cloudTextures[ CLTexture_cumulus ]->ref();
+    // OSGFIXME
+//     cloudTextures[ CLTexture_cumulus ] = new osg::Texture2D( cloud_path.str().c_str(), false, false, false );
+    cloudTextures[ CLTexture_cumulus ] = new osg::Texture2D;
 
     cloud_path.set(tex_path);
     cloud_path.append("cl_stratus.rgb");
-    cloudTextures[ CLTexture_stratus ] = new ssgTexture( cloud_path.str().c_str(), false, false, false );
-    cloudTextures[ CLTexture_stratus ]->ref();
+    // OSGFIXME
+//     cloudTextures[ CLTexture_stratus ] = new ssgTexture( cloud_path.str().c_str(), false, false, false );
+    cloudTextures[ CLTexture_stratus ] = new osg::Texture2D;
 
 }
 
@@ -486,7 +491,8 @@ void SGNewCloud::Render3Dcloud( bool drawBB, sgVec3 FakeEyePos, sgVec3 deltaPos,
                // in practice there is no texture switch (atm)
                if( previousTexture != thisTexture ) {
                        previousTexture = thisTexture;
-                       glBindTexture(GL_TEXTURE_2D, cloudTextures[thisTexture]->getHandle());
+                        // OSGFIXME
+//                     glBindTexture(GL_TEXTURE_2D, cloudTextures[thisTexture]->getHandle());
                }
 
                        sgVec3 translate;