X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Fmaterial%2Fmat.hxx;h=9e2d06e432d58d7f490a85c4222040ab4f87ece2;hb=542124e90cf467e590c4493774210f1e025cdc96;hp=1317072a6d9737b3398c29ad0a57fcc3e5fa6f44;hpb=4219f16f61276e07067e005b850f058a41237f46;p=simgear.git diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index 1317072a..9e2d06e4 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -45,11 +45,7 @@ namespace osg class StateSet; } -namespace osgDB -{ -class Options; -} - +#include #include #include #include @@ -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 effect; - std::string texture_path; + std::vector > texture_paths; bool effect_realized; - osg::ref_ptr options; + osg::ref_ptr 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 _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); };