diff --git a/src/Mod/Raytracing/App/LuxFeature.cpp b/src/Mod/Raytracing/App/LuxFeature.cpp index 4989cd363..0d3a2e468 100644 --- a/src/Mod/Raytracing/App/LuxFeature.cpp +++ b/src/Mod/Raytracing/App/LuxFeature.cpp @@ -47,6 +47,7 @@ LuxFeature::LuxFeature(void) { ADD_PROPERTY(Source,(0)); ADD_PROPERTY(Color,(App::Color(0.5f,0.5f,0.5f))); + ADD_PROPERTY(Transparency,(0)); } App::DocumentObjectExecReturn *LuxFeature::execute(void) @@ -67,10 +68,26 @@ App::DocumentObjectExecReturn *LuxFeature::execute(void) // write a material entry // This must not be done in LuxTools::writeShape! const App::Color& c = Color.getValue(); - result << "MakeNamedMaterial \"FreeCADMaterial_" << Name << "\"" << endl - << " \"color Kd\" [" << c.r << " " << c.g << " " << c.b << "]" << endl - << " \"float sigma\" [0.000000000000000]" << endl - << " \"string type\" [\"matte\"]" << endl << endl; + long t = Transparency.getValue(); + if (t == 0) { + result << "MakeNamedMaterial \"FreeCADMaterial_" << Name << "\"" << endl + << " \"color Kd\" [" << c.r << " " << c.g << " " << c.b << "]" << endl + << " \"float sigma\" [0.000000000000000]" << endl + << " \"string type\" [\"matte\"]" << endl << endl; + } else { + float trans = t/100.0f; + result << "MakeNamedMaterial \"FreeCADMaterial_Base_" << Name << "\"" << endl + << " \"color Kd\" [" << c.r << " " << c.g << " " << c.b << "]" << endl + << " \"float sigma\" [0.000000000000000]" << endl + << " \"string type\" [\"matte\"]" << endl << endl + << "MakeNamedMaterial \"FreeCADMaterial_Null_" << Name << "\"" << endl + << " \"string type\" [\"null\"]" << endl << endl + << "MakeNamedMaterial \"FreeCADMaterial_" << Name << "\"" << endl + << " \"string namedmaterial1\" [\"FreeCADMaterial_Null_" << Name << "\"]" << endl + << " \"string namedmaterial2\" [\"FreeCADMaterial_Base_" << Name << "\"]" << endl + << " \"float amount\" [" << trans << "]" << endl + << " \"string type\" [\"mix\"]" << endl << endl; + } LuxTools::writeShape(result,Name.c_str(),shape); diff --git a/src/Mod/Raytracing/App/LuxFeature.h b/src/Mod/Raytracing/App/LuxFeature.h index a0966617e..cbda5944e 100644 --- a/src/Mod/Raytracing/App/LuxFeature.h +++ b/src/Mod/Raytracing/App/LuxFeature.h @@ -49,6 +49,7 @@ public: App::PropertyLink Source; App::PropertyColor Color; + App::PropertyPercent Transparency; /** @name methods overide Feature */ //@{