]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/material/mat.hxx
model paging patch from Till Busch
[simgear.git] / simgear / scene / material / mat.hxx
index 9e93343f0f48f24a29377da07e72b209d5ae456b..96a33a3aba006efc28df33c34e5aa795833130ce 100644 (file)
@@ -43,6 +43,7 @@
 
 #include <simgear/props/props.hxx>
 #include <simgear/structure/SGSharedPtr.hxx>
+#include <simgear/scene/util/SGSceneFeatures.hxx>
 
 #include "matmodel.hxx"
 
@@ -53,7 +54,6 @@ SG_USING_STD(map);
 
 class SGMaterialGlyph;
 
-
 /**
  * A material in the scene graph.
  *
@@ -113,19 +113,10 @@ public:
   // Public methods.
   ////////////////////////////////////////////////////////////////////
 
-  /**
-   * Force the texture to load if it hasn't already.
-   *
-   * @return true if the texture loaded, false if it was loaded
-   * already.
-   */
-  bool load_texture (int n = -1);
-
-
   /**
    * Get the textured state.
    */
-  osg::StateSet *get_state (int n = -1) const;
+  osg::StateSet *get_state (int n = -1);
 
 
   /**
@@ -151,10 +142,54 @@ public:
    *
    * A smaller number means more generated night lighting.
    *
-   * @return The area (m^2?) covered by each light.
+   * @return The area (m^2) covered by each light.
    */
   inline double get_light_coverage () const { return light_coverage; }
 
+  /**
+   * Get the forest coverage.
+   *
+   * A smaller number means more generated forest canopy.
+   *
+   * @return The area (m^2) covered by each canopy.
+   */
+  inline double get_tree_coverage () const { return tree_coverage; }
+
+  /**
+   * Get the forest height.
+   *
+   * @return The average height of the trees.
+   */
+  inline double get_tree_height () const { return tree_height; }
+
+  /**
+   * Get the forest width.
+   *
+   * @return The average width of the trees.
+   */
+  inline double get_tree_width () const { return tree_width; }
+
+  /**
+   * Get the forest LoD range.
+   *
+   * @return The LoD range for the trees.
+   */
+  inline double get_tree_range () const { return tree_range; }
+  
+  /**
+   * Get the number of tree varieties available
+   *
+   * @return the number of different trees defined in the texture strip
+   */
+  inline int get_tree_varieties () const { return tree_varieties; }
+  
+  /**
+   * Get the texture strip to use for trees
+   *
+   * @return the texture to use for trees.
+   */
+  inline string get_tree_texture () const { return  tree_texture; }
+
   /**
    * Return if the surface material is solid, if it is not solid, a fluid
    * can be assumed, that is usually water.
@@ -266,11 +301,23 @@ private:
   // use mipmapping?
   int mipmap;
 
-  // use anisotropic filtering
-  float filtering;
-
   // coverage of night lighting.
   double light_coverage;
+  
+  // coverage of trees
+  double tree_coverage;
+  
+  // Range at which trees become visible
+  double tree_range;
+
+  // Height of the tree
+  double tree_height;
+
+  // Width of the tree
+  double tree_width;
+
+  // Number of varieties of tree texture
+  int tree_varieties;
 
   // True if the material is solid, false if it is a fluid
   bool solid;
@@ -298,7 +345,9 @@ private:
 
   // taxiway-/runway-sign texture elements
   map<string, SGSharedPtr<SGMaterialGlyph> > glyphs;
-
+  
+  // Tree texture, typically a strip of applicable tree textures
+  string tree_texture;
 \f
   ////////////////////////////////////////////////////////////////////
   // Internal constructors and methods.
@@ -310,7 +359,7 @@ private:
   void build_state( bool defer_tex_load );
   void set_state( osg::StateSet *s );
 
-  void assignTexture( osg::StateSet *state, const std::string &fname, int _wrapu = TRUE, int _wrapv = TRUE, int _mipmap = TRUE, float filtering = 1.0f );
+  void assignTexture( osg::StateSet *state, const std::string &fname, int _wrapu = TRUE, int _wrapv = TRUE, int _mipmap = TRUE );
 
 };
 
@@ -335,7 +384,15 @@ public:
   const SGMaterial* getMaterial() const
   { return mMaterial; }
 private:
-  SGSharedPtr<const SGMaterial> mMaterial;
+  // this cannot be an SGSharedPtr since that would create a cicrular reference
+  // making it impossible to ever free the space needed by SGMaterial
+  const SGMaterial* mMaterial;
 };
 
+void
+SGSetTextureFilter( int max);
+
+int
+SGGetTextureFilter();
+
 #endif // _SG_MAT_HXX