+void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
+{
+ int aSize = theProps.size();
+
+ if ( aSize < 1 || aSize > 2)
+ return;
+
+ // theProps[0] -- front material properties
+ // theProps[1] -- back material properties (if exist)
+ // If there are no back material properties,
+ // we get front material properties as back material
+
+ double aCoefnt;
+
+ // Set reflection coefficients
+ aCoefnt = theProps[0]->GetAmbient();
+ myShadingFaceProp->SetAmbient(aCoefnt);
+ myVertexActor->GetProperty()->SetAmbient(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetAmbient();
+ myShadingBackFaceProp->SetAmbient(aCoefnt);
+
+ // Set diffuse coefficients
+ aCoefnt = theProps[0]->GetDiffuse();
+ myShadingFaceProp->SetDiffuse(aCoefnt);
+ myVertexActor->GetProperty()->SetDiffuse(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetDiffuse();
+ myShadingBackFaceProp->SetDiffuse(aCoefnt);
+
+ // Set specular coefficients
+ aCoefnt = theProps[0]->GetSpecular();
+ myShadingFaceProp->SetSpecular(aCoefnt);
+ myVertexActor->GetProperty()->SetSpecular(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetSpecular();
+ myShadingBackFaceProp->SetSpecular(aCoefnt);
+
+
+ double* aColor;
+
+ // Set reflection colors
+ aColor = theProps[0]->GetAmbientColor();
+ myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
+ myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
+ if ( aSize == 2 )
+ aColor = theProps[1]->GetAmbientColor();
+ myShadingBackFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
+
+ // Set diffuse colors
+ aColor = theProps[0]->GetDiffuseColor();
+ myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
+ myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
+ if ( aSize == 2 )
+ aColor = theProps[1]->GetDiffuseColor();
+ myShadingBackFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
+
+ // Set specular colors
+ aColor = theProps[0]->GetSpecularColor();
+ myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
+ myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
+ if ( aSize == 2 )
+ aColor = theProps[1]->GetSpecularColor();
+ myShadingBackFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
+
+ // Set shininess
+ aCoefnt = theProps[0]->GetSpecularPower();
+ myShadingFaceProp->SetSpecularPower(aCoefnt);
+ myVertexActor->GetProperty()->SetSpecularPower(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetSpecularPower();
+ myShadingBackFaceProp->SetSpecularPower(aCoefnt);
+
+ // Set back face material property
+ myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
+}
+
+vtkProperty* GEOM_Actor::GetFrontMaterial()
+{
+ return myShadingFaceProp;
+}
+
+vtkProperty* GEOM_Actor::GetBackMaterial()
+{
+ return myShadingBackFaceProp;
+}
+