+ /**
+ * Increment the reference count for this material.
+ *
+ * A material with 0 references may be deleted by the
+ * material library.
+ */
+ virtual inline void ref () { refcount++; }
+
+
+ /**
+ * Decrement the reference count for this material.
+ */
+ virtual inline void deRef () { refcount--; }
+
+
+ /**
+ * Get the reference count for this material.
+ *
+ * @return The number of references (0 if none).
+ */
+ virtual inline int getRef () const { return refcount; }
+
+protected:
+
+\f
+ ////////////////////////////////////////////////////////////////////
+ // Protected methods.
+ ////////////////////////////////////////////////////////////////////
+
+ /**
+ * Initialization method, invoked by all public constructors.
+ */
+ virtual void init();
+
+
+private:
+
+\f
+ ////////////////////////////////////////////////////////////////////
+ // Internal state.
+ ////////////////////////////////////////////////////////////////////
+
+ // names
+ string texture_path;
+
+ // pointers to ssg states
+ ssgStateSelector *state;
+ ssgSimpleState *textured;
+ ssgSimpleState *nontextured;
+
+ // texture size
+ double xsize, ysize;
+
+ // wrap texture?
+ bool wrapu, wrapv;
+
+ // use mipmapping?
+ int mipmap;
+
+ // coverage of night lighting.
+ double light_coverage;
+
+ // material properties
+ sgVec4 ambient, diffuse, specular, emission;
+
+ // true if texture loading deferred, and not yet loaded
+ bool texture_loaded;