From: Stuart Buchanan Date: Tue, 25 Sep 2012 21:51:37 +0000 (+0100) Subject: Add alpha-to-coverage GL parameter to effects code. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=25130e3c824d5eddf2bcf922cdabc08e589b0250;p=simgear.git Add alpha-to-coverage GL parameter to effects code. --- diff --git a/simgear/scene/material/Effect.cxx b/simgear/scene/material/Effect.cxx index c9348157..e607c2e5 100644 --- a/simgear/scene/material/Effect.cxx +++ b/simgear/scene/material/Effect.cxx @@ -602,6 +602,24 @@ struct StencilBuilder : public PassAttributeBuilder InstallAttributeBuilder installStencil("stencil"); +struct AlphaToCoverageBuilder : public PassAttributeBuilder +{ + void buildAttribute(Effect* effect, Pass* pass, const SGPropertyNode* prop, + const SGReaderWriterOptions* options); +}; + +void AlphaToCoverageBuilder::buildAttribute(Effect* effect, Pass* pass, + const SGPropertyNode* prop, + const SGReaderWriterOptions* options) +{ + const SGPropertyNode* realProp = getEffectPropertyNode(effect, prop); + if (!realProp) + return; + pass->setMode(GL_SAMPLE_ALPHA_TO_COVERAGE_ARB, (realProp->getValue() ? + StateAttribute::ON : StateAttribute::OFF)); +} + +InstallAttributeBuilder installAlphaToCoverage("alpha-to-coverage"); EffectNameValue alphaComparisonInit[] = { @@ -648,6 +666,7 @@ struct AlphaTestBuilder : public PassAttributeBuilder "comparison"); const SGPropertyNode* pRef = getEffectPropertyChild(effect, prop, "reference"); + AlphaFunc::ComparisonFunction func = AlphaFunc::ALWAYS; float refValue = 1.0f; if (pComp)