Commit 9e6eb660 authored by Jan Möbius's avatar Jan Möbius

Added two sided lighting shader support (Template update still missing)

parent 2b6a6259
......@@ -1039,6 +1039,9 @@ void ShaderProgGenerator::initGenDefines(ShaderGenerator* _gen)
std::cout << __FUNCTION__ << " -> unknown shade mode: " << desc_.shadeMode << std::endl;
}
if (desc_.twoSidedLighting)
_gen->addDefine("TWO_SIDED_LIGHTING 1");
if (desc_.textured())
_gen->addDefine("SG_TEXTURED 1");
......
......@@ -93,6 +93,7 @@ public:
ShaderGenDesc() :
version(150),
numLights(0),
twoSidedLighting(false),
shadeMode(SG_SHADE_UNLIT),
vertexColors(false),
vertexTemplateFile(""),
......@@ -118,6 +119,7 @@ public:
// version = _rhs.version;
//
// numLights = _rhs.numLights;
// twoSidedLighting = _rhs.twoSidedLighting;
//
// std::copy(_rhs.lightTypes,_rhs.lightTypes+SG_MAX_SHADER_LIGHTS,lightTypes);
// textureTypes_ = _rhs.textureTypes_;
......@@ -144,6 +146,8 @@ public:
int numLights;
ShaderGenLightType lightTypes[SG_MAX_SHADER_LIGHTS];
bool twoSidedLighting;
ShaderGenShadeMode shadeMode;
bool vertexColors;
......@@ -267,6 +271,9 @@ public:
if (numLights != _rhs.numLights)
return false;
if ( twoSidedLighting != _rhs.twoSidedLighting )
return false;
if (shadeMode != _rhs.shadeMode)
return false;
......
......@@ -754,6 +754,9 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
// enable / disable lighting
ro.shaderDesc.numLights = props->lighting() ? 0 : -1;
// Enable/Disable twoSided Lighting
ro.shaderDesc.twoSidedLighting = _state.twosided_lighting();
// TODO: better handling of attribute sources in shader gen
switch (props->lightStage())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment