mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
"0021179: EDF 1654 SMESH GEOM: better look'n'feel" issue.
Material Properties.
This commit is contained in:
parent
0f1c42a84c
commit
29505882a3
@ -147,6 +147,18 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
|
||||
myVIsoNumber = -1;
|
||||
|
||||
myTopLevel = Standard_False;
|
||||
Graphic3d_MaterialAspect aMatAspect;
|
||||
if ( !HasMaterial() ) {
|
||||
aMatAspect.SetAmbient( 0.5 );
|
||||
aMatAspect.SetDiffuse( 0.5 );
|
||||
aMatAspect.SetEmissive( 0.5 );
|
||||
aMatAspect.SetShininess(0.5 );
|
||||
aMatAspect.SetSpecular( 0.5 );
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
|
||||
}
|
||||
myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
}
|
||||
|
||||
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
|
||||
@ -198,7 +210,6 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
||||
|
||||
if(isTopLevel()) {
|
||||
SetColor(topLevelColor());
|
||||
|
||||
Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect();
|
||||
anAspect->SetColor( topLevelColor() );
|
||||
Attributes()->SetWireAspect( anAspect );
|
||||
@ -316,10 +327,10 @@ void GEOM_AISShape::SetTransparency(const Standard_Real aValue)
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||
FMat.SetTransparency(aValue); BMat.SetTransparency(aValue);
|
||||
FMat.SetTransparency(aValue);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(FMat);
|
||||
myCurrentMaterial = FMat;
|
||||
myTransparency = aValue;
|
||||
}
|
||||
|
||||
@ -375,29 +386,20 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre
|
||||
{
|
||||
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
|
||||
|
||||
Graphic3d_MaterialAspect aMatAspect;
|
||||
if ( !HasMaterial() ) {
|
||||
aMatAspect.SetAmbient( 0.5 );
|
||||
aMatAspect.SetDiffuse( 0.5 );
|
||||
aMatAspect.SetEmissive( 0.5 );
|
||||
aMatAspect.SetShininess(0.5 );
|
||||
aMatAspect.SetSpecular( 0.5 );
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
|
||||
}
|
||||
|
||||
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||
FMat.SetTransparency(myTransparency); BMat.SetTransparency(myTransparency);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
|
||||
Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
|
||||
aMatAspect.SetTransparency(myTransparency);
|
||||
myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial );
|
||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial );
|
||||
|
||||
//Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
|
||||
// P->SetPrimitivesAspect(a4bis);
|
||||
// G->SetGroupPrimitivesAspect(a4bis);
|
||||
//a4bis->SetInteriorColor(myShadingColor);
|
||||
myDrawer->ShadingAspect()->SetColor(isTopLevel() ? topLevelColor() : myShadingColor);
|
||||
if( isTopLevel() )
|
||||
myDrawer->ShadingAspect()->SetColor( topLevelColor() );
|
||||
else if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT ))
|
||||
myDrawer->ShadingAspect()->SetColor(myShadingColor);
|
||||
|
||||
// PAL12113: AIS_Shape::Compute() works correctly with shapes containing no faces
|
||||
//StdPrs_ShadedShape::Add(aPrs,myshape,myDrawer);
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <AIS_DisplayMode.hxx>
|
||||
#include <Graphic3d_MaterialAspect.hxx>
|
||||
|
||||
class PrsMgr_PresentationManager3d;
|
||||
class Prs3d_Presentation;
|
||||
@ -151,6 +152,8 @@ private:
|
||||
TCollection_AsciiString myName;
|
||||
bool myDisplayVectors;
|
||||
Standard_Boolean myTopLevel;
|
||||
Graphic3d_MaterialAspect myCurrentMaterial;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user