From: Tim Moore Date: Tue, 15 Jun 2010 16:56:51 +0000 (+0200) Subject: Add bool and int uniform types for shaders, and vertex-program-two-sided X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0d419aba8a1ea9c67b1982f4d68fe1fe7bd79033;p=simgear.git Add bool and int uniform types for shaders, and vertex-program-two-sided vertex-program-two-sided is an extra parameter written by the code that creates effects from state sets generated by the ac3d loader. The objective of this work is to support a workaround for broken gl_FrontFacing on some Macintosh machines. --- diff --git a/simgear/scene/material/Effect.cxx b/simgear/scene/material/Effect.cxx index 33ceacda..b4c010f4 100644 --- a/simgear/scene/material/Effect.cxx +++ b/simgear/scene/material/Effect.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2008 - 2009 Tim Moore timoore@redhat.com +// Copyright (C) 2008 - 2010 Tim Moore timoore33@gmail.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public @@ -868,6 +868,8 @@ InstallAttributeBuilder installShaderProgram("program"); EffectNameValue uniformTypesInit[] = { + {"bool", Uniform::BOOL}, + {"int", Uniform::INT}, {"float", Uniform::FLOAT}, {"float-vec3", Uniform::FLOAT_VEC3}, {"float-vec4", Uniform::FLOAT_VEC4}, @@ -906,6 +908,12 @@ struct UniformBuilder :public PassAttributeBuilder if (!typeProp) { props::Type propType = valProp->getType(); switch (propType) { + case props::BOOL: + uniformType = Uniform::BOOL; + break; + case props::INT: + uniformType = Uniform::INT; + break; case props::FLOAT: case props::DOUBLE: break; // default float type; @@ -1181,6 +1189,9 @@ bool makeParametersFromStateSet(SGPropertyNode* effectRoot, const StateSet* ss) } } makeChild(paramRoot, "cull-face")->setStringValue(cullFaceString); + // Macintosh ATI workaround + bool vertexTwoSide = cullFaceString == "off"; + makeChild(paramRoot, "vertex-program-two-side")->setValue(vertexTwoSide); const BlendFunc* blendFunc = getStateAttribute(ss); SGPropertyNode* blendNode = makeChild(paramRoot, "blend"); if (blendFunc) {