#include <GeomDataAPI_Dir.h>
#include <SelectMgr_ListIteratorOfListOfFilter.hxx>
+#include <Graphic3d_Texture2Dmanual.hxx>
+#include <OCCViewer_Utilities.h>
+
#define FEATURE_ITEM_COLOR "0,0,225"
thePrs->setDeflection(getResultDeflection(aResult));
thePrs->setTransparency(getResultTransparency(aResult));
+
+ /// set texture parameters
+ if(aResult->hasTextureFile())
+ {
+ Handle(AIS_InteractiveObject) anAIS = thePrs->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull())
+ {
+ std::vector<int> aColor = {167, 167, 167 };
+ thePrs->setColor(aColor[0], aColor[1], aColor[2]);
+ Quantity_Color myShadingColor(NCollection_Vec3<float>(aColor[0]/255., aColor[1]/255., aColor[2]/255.));
+
+ Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS);
+ if (!anAISShape.IsNull())
+ {
+ auto myDrawer = new Prs3d_ShadingAspect();
+ if (!anAISShape->Attributes()->HasOwnShadingAspect())
+ {
+ anAISShape->Attributes()->SetShadingAspect (myDrawer);
+ }
+
+ myDrawer->SetColor(myShadingColor);
+
+ Handle(Image_PixMap) aPixmap;
+ QPixmap px(aResult->getTextureFile().c_str());
+ if (!px.isNull() )
+ aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
+
+ anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap
+ (new Graphic3d_Texture2Dmanual(aPixmap));
+ anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMapOn();
+
+ anAISShape->SetDisplayMode(AIS_Shaded);
+ }
+ }
+ }
}
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
if (aFeature.get()) {