diff --git a/simgear/scene/material/mat.hxx b/simgear/scene/material/mat.hxx index 2c4d7947..9b8ddb13 100644 --- a/simgear/scene/material/mat.hxx +++ b/simgear/scene/material/mat.hxx @@ -401,9 +401,9 @@ public: (0 < tex_height) ? 1000.0f/tex_height : 1.0f); } - float get_parameter(const std::string& param) const + float get_parameter(const std::string& param, float defaultValue = (0.0F)) const { - return parameters->getFloatValue(param); + return parameters->getFloatValue(param, defaultValue); } protected: diff --git a/simgear/scene/material/matlib.cxx b/simgear/scene/material/matlib.cxx index bd2179b5..507b6e18 100644 --- a/simgear/scene/material/matlib.cxx +++ b/simgear/scene/material/matlib.cxx @@ -430,7 +430,7 @@ SGMaterialCache::Atlas SGMaterialLib::getMaterialTextureAtlas(SGVec2f center, co water = 1.0; } - atlas.materialParams3->setElement(materialLookupIndex, osg::Vec4f(water, 0.0, 0.0, 0.0)); + atlas.materialParams3->setElement(materialLookupIndex, osg::Vec4f(water, mat->get_parameter("waterline-start"), mat->get_parameter("waterline-end"), 0.0)); // Similarly, there are specifically 7 textures that are defined in the materials that need to be passed into // the shader as an array based on the material lookup.