]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/mat.hxx
materials.xml format update
[simgear.git] / simgear / scene / material / mat.hxx
index 1317072a6d9737b3398c29ad0a57fcc3e5fa6f44..9e2d06e432d58d7f490a85c4222040ab4f87ece2 100644 (file)
@@ -45,11 +45,7 @@ namespace osg
 class StateSet;
 }
 
-namespace osgDB
-{
-class Options;
-}
-
+#include <simgear/scene/model/SGReaderWriterXMLOptions.hxx>
 #include <simgear/props/props.hxx>
 #include <simgear/structure/SGSharedPtr.hxx>
 #include <simgear/scene/util/SGSceneFeatures.hxx>
@@ -59,6 +55,7 @@ class Options;
 namespace simgear
 {
 class Effect;
+void reload_shaders();
 }
 
 class SGMaterialGlyph;
@@ -88,8 +85,10 @@ public:
    * state information for the material.  This node is usually
    * loaded from the $FG_ROOT/materials.xml file.
    */
-  SGMaterial( const osgDB::Options*, const SGPropertyNode *props);
+  SGMaterial( const osgDB::ReaderWriter::Options*, const SGPropertyNode *props);
 
+  SGMaterial(const simgear::SGReaderWriterXMLOptions*,
+             const SGPropertyNode *props);
   /**
    * Destructor.
    */
@@ -134,23 +133,37 @@ public:
   inline double get_light_coverage () const { return light_coverage; }
 
   /**
-   * Get the forest coverage.
+   * Get the wood coverage.
    *
-   * A smaller number means more generated forest canopy.
+   * A smaller number means more generated woods within the forest.
    *
-   * @return The area (m^2) covered by each canopy.
+   * @return The area (m^2) covered by each wood.
    */
-  inline double get_tree_coverage () const { return tree_coverage; }
+  inline double get_wood_coverage () const { return wood_coverage; }
 
   /**
-   * Get the forest height.
+   * Get the density of the wood
+   *
+   * @return The area (m^2) covered by each tree in the wood.
+   */
+  inline double get_tree_density () const { return tree_density; }
+  
+  /**
+   * Get the size of each wood
+   *
+   * @return the average area (m^2) of each wood
+   */
+  inline double get_wood_size () const { return wood_size; }
+  
+  /**
+   * Get the tree height.
    *
    * @return The average height of the trees.
    */
   inline double get_tree_height () const { return tree_height; }
 
   /**
-   * Get the forest width.
+   * Get the tree width.
    *
    * @return The average width of the trees.
    */
@@ -259,12 +272,15 @@ protected:
 protected:
 
   struct _internal_state {
+      _internal_state(simgear::Effect *e, bool l,
+                      const simgear::SGReaderWriterXMLOptions *o);
       _internal_state(simgear::Effect *e, const std::string &t, bool l,
-                      const osgDB::Options *o);
+                      const simgear::SGReaderWriterXMLOptions *o);
+      void add_texture(const std::string &t, int i);
       osg::ref_ptr<simgear::Effect> effect;
-      std::string texture_path;
+      std::vector<std::pair<std::string,int> > texture_paths;
       bool effect_realized;
-      osg::ref_ptr<const osgDB::Options> options;
+      osg::ref_ptr<const simgear::SGReaderWriterXMLOptions> options;
   };
 
 private:
@@ -292,9 +308,15 @@ private:
   // coverage of night lighting.
   double light_coverage;
   
-  // coverage of trees
-  double tree_coverage;
-  
+  // coverage of woods
+  double wood_coverage;
+
+  // The size of each wood
+  double wood_size;
+
+  // Tree density within the wood
+  double tree_density;
+
   // Range at which trees become visible
   double tree_range;
 
@@ -326,6 +348,9 @@ private:
   SGVec4f ambient, diffuse, specular, emission;
   double shininess;
 
+  // effect for this material
+  std::string effect;
+
   // the list of names for this material. May be empty.
   std::vector<std::string> _names;
 
@@ -341,9 +366,9 @@ private:
   // Internal constructors and methods.
   ////////////////////////////////////////////////////////////////////
 
-  void read_properties(const osgDB::Options* options,
+  void read_properties(const simgear::SGReaderWriterXMLOptions* options,
                         const SGPropertyNode *props);
-  void buildEffectProperties(const osgDB::Options* options);
+  void buildEffectProperties(const simgear::SGReaderWriterXMLOptions* options);
 };