From fa2b5911b7f87f9ce798e1d05aef2231cff4d195 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan Date: Sat, 9 Apr 2022 16:24:51 +0100 Subject: [PATCH] WS30: Add waterline-start and waterline-end params Used for coastline mixing. --- simgear/scene/material/mat.hxx | 4 ++-- simgear/scene/material/matlib.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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.