From a0d8d44c93820754e887603ce6251c8ac135802e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 1 Feb 2015 21:28:17 +0000 Subject: Parse the rgbgen directive in material files. --- src/model/material.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/model/material.cc b/src/model/material.cc index 93492f5..29dde49 100644 --- a/src/model/material.cc +++ b/src/model/material.cc @@ -332,6 +332,25 @@ void Material::load_shaderfile(const std::string &shadername) } else if (firstword.compare("environment") == 0) { layer->set_tcgen(Layer::TCGenEnvironment); layer->set_texmap(Layer::TexMapEnvironment); + } else if (firstword.compare("rgbgen") == 0) { + if (linestream >> firstword) { + aux::to_lowercase(firstword); + if (firstword.compare("color") == 0) { + layer->set_rgbgen(Layer::RGBGenColor); + } else if (firstword.compare("engine") == 0) { + layer->set_rgbgen(Layer::RGBGenEngine); + } else if (firstword.compare("entity") == 0) { + layer->set_rgbgen(Layer::RGBGenPrimary); + } else if (firstword.compare("entitysecond") == 0) { + layer->set_rgbgen(Layer::RGBGenSecondary); + } else if (firstword.compare("entitythird") == 0) { + layer->set_rgbgen(Layer::RGBGenTertiary); + } else { + con_warn << shaderfile.name() << " unknown rgbgen function '" << firstword << "' at line " << linenumber << std::endl; + } + } else { + con_warn << shaderfile.name() << " missing rgbgen function at line " << linenumber << std::endl; + } } else if (firstword.compare("blendfunc") == 0) { if (linestream >> firstword) { aux::to_lowercase(firstword); -- cgit v1.2.3