]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/mat.hxx
My old email address is no longer valid ... point to my web page.
[simgear.git] / simgear / scene / material / mat.hxx
index c98da2df5091be51a9ba96a830a95448ef2f5097..a32bde3220cd450a9b1bbe22b9d2d31fcad3d1d3 100644 (file)
@@ -4,7 +4,7 @@
 // Written by Curtis Olson, started May 1998.
 // Overhauled by David Megginson, December 2001
 //
-// Copyright (C) 1998 - 2000  Curtis L. Olson  - curt@flightgear.org
+// Copyright (C) 1998 - 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -33,6 +33,7 @@
 #include <simgear/compiler.h>
 
 #include STL_STRING      // Standard C++ string library
+#include <vector>
 
 #include <plib/sg.h>
 #include <plib/ssg.h>
@@ -42,6 +43,7 @@
 #include "matmodel.hxx"
 
 SG_USING_STD(string);
+SG_USING_STD(vector);
 
 
 /**
@@ -109,13 +111,19 @@ public:
    * @return true if the texture loaded, false if it was loaded
    * already.
    */
-  virtual bool load_texture ();
+  virtual bool load_texture (int n = -1);
 
 
   /**
    * Get the textured state.
    */
-  virtual inline ssgSimpleState *get_state () const { return state; }
+  virtual ssgSimpleState *get_state (int n = -1) const;
+
+
+  /**
+   * Get the number of textures assigned to this material.
+   */
+  virtual inline int get_num() const { return _status.size(); }
 
 
   /**
@@ -188,6 +196,15 @@ protected:
    */
   virtual void init();
 
+protected:
+
+  struct _internal_state {
+     _internal_state( ssgSimpleState *s, const string &t, bool l )
+                  : state(s), texture_path(t), texture_loaded(l) {}
+      ssgSimpleState *state;
+      string texture_path;
+      bool texture_loaded;
+  };
 
 private:
 
@@ -196,11 +213,11 @@ private:
   // Internal state.
   ////////////////////////////////////////////////////////////////////
 
-  // names
-  string texture_path;
+  // texture status
+  vector<_internal_state> _status;
 
-  // pointers to ssg states
-  ssgSimpleState *state;
+  // Round-robin counter
+  unsigned int _current_ptr;
 
   // texture size
   double xsize, ysize;
@@ -218,9 +235,6 @@ private:
   sgVec4 ambient, diffuse, specular, emission;
   double shininess;
 
-  // true if texture loading deferred, and not yet loaded
-  bool texture_loaded;
-
   vector<SGMatModelGroup *> object_groups;
 
   // ref count so we can properly delete if we have multiple