Raytracing: added transparency to lux feature - fixes #1771
This commit is contained in:
parent
393d64d53c
commit
1dd069ec7f
|
@ -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);
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
|
||||
App::PropertyLink Source;
|
||||
App::PropertyColor Color;
|
||||
App::PropertyPercent Transparency;
|
||||
|
||||
/** @name methods overide Feature */
|
||||
//@{
|
||||
|
|
Loading…
Reference in New Issue
Block a user