}
}
+//=======================================================================
+//function : SetMaterial
+//purpose :
+//=======================================================================
+
+void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial)
+{
+ setMaterial (myDrawer, theMaterial, HasColor(), IsTransparent());
+ //myOwnMaterial = theMaterial;
+ hasOwnMaterial = Standard_True;
+ LoadRecomputable (AIS_Shaded);
+ for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
+ {
+ const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
+ //if (aDrawer->HasOwnMaterial()) continue;
+ if (aDrawer->HasShadingAspect())
+ {
+ setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), Standard_False); // aDrawer->IsTransparent()
+ }
+ }
+}
+
//=======================================================================
//function : Compute
//purpose :
LoadRecomputable (AIS_WireFrame);
}
+//=======================================================================
+//function : setMaterial
+//purpose :
+//=======================================================================
+
+void AIS_Shape::setMaterial (const Handle(AIS_Drawer)& theDrawer,
+ const Graphic3d_MaterialAspect& theMaterial,
+ const Standard_Boolean theToKeepColor,
+ const Standard_Boolean theToKeepTransp) const
+{
+ const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
+ const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
+ if (!theDrawer->HasShadingAspect())
+ {
+ theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+ *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
+ }
+ theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
+
+ if (theToKeepColor)
+ {
+ theDrawer->ShadingAspect()->SetColor (aColor, myCurrentFacingModel);
+ }
+ if (theToKeepTransp)
+ {
+ theDrawer->ShadingAspect()->SetTransparency (aTransp, myCurrentFacingModel);
+ }
+}
+
//=======================================================================
//function : SetMaterial
//purpose :
void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
{
- if (!myDrawer->HasShadingAspect())
- {
- myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
- *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
- }
+ setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
hasOwnMaterial = Standard_True;
- myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
- if (HasColor())
- {
- myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
- }
- myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
-
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#define BUC60488 //GG_23/09/99 Updates correctly the Material after
-// any change.
-
-#define GER61351 //GG_171199 Enable to set an object RGB color
-// instead a restricted object NameOfColor.
-// Enable to change separatly the front and back color.
-
-#define OCC1174 //SAV_080103 Added back face interior color management
-
#include <Prs3d_ShadingAspect.ixx>
//=======================================================================
//purpose :
//=======================================================================
-#ifdef GER61351
void Prs3d_ShadingAspect::SetColor(const Quantity_NameOfColor aColor,
const Aspect_TypeOfFacingModel aModel) {
void Prs3d_ShadingAspect::SetColor(const Quantity_Color &aColor,
const Aspect_TypeOfFacingModel aModel) {
-#ifndef OCC1174
- myAspect->SetInteriorColor(aColor);
-#endif
-
if( aModel != Aspect_TOFM_BOTH_SIDE ) {
myAspect->SetDistinguishOn();
}
Graphic3d_MaterialAspect front = myAspect->FrontMaterial();
front.SetColor(aColor);
myAspect->SetFrontMaterial(front);
-#ifdef OCC1174
myAspect->SetInteriorColor( aColor );
-#endif
}
if( aModel == Aspect_TOFM_BACK_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
Graphic3d_MaterialAspect back = myAspect->BackMaterial();
back.SetColor(aColor);
myAspect->SetBackMaterial(back);
-#ifdef OCC1174
myAspect->SetBackInteriorColor( aColor );
-#endif
}
}
-Quantity_Color Prs3d_ShadingAspect::Color( const Aspect_TypeOfFacingModel aModel ) const {
- Quantity_Color myReturn ;
- switch (aModel) {
+const Quantity_Color& Prs3d_ShadingAspect::Color (const Aspect_TypeOfFacingModel theModel) const
+{
+ switch (theModel)
+ {
default:
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
- myReturn = myAspect->FrontMaterial().Color();
- break;
+ return myAspect->FrontMaterial().Color();
case Aspect_TOFM_BACK_SIDE:
- myReturn = myAspect->BackMaterial().Color();
- break;
+ return myAspect->BackMaterial().Color();
}
- return myReturn ;
}
-#else
-void Prs3d_ShadingAspect::SetColor(const Quantity_NameOfColor aColor) {
- myAspect->SetInteriorColor(aColor);
-#ifdef OCC1174
- myAspect->SetBackInteriorColor( aColor );
-#endif
- myAspect->FrontMaterial().SetAmbientColor(Quantity_Color(aColor));
- myAspect->BackMaterial().SetAmbientColor(Quantity_Color(aColor));
-// myAspect->FrontMaterial().SetColor(Quantity_Color(aColor));
-// myAspect->BackMaterial().SetColor(Quantity_Color(aColor));
-}
-#endif
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
-#ifdef GER61351
void Prs3d_ShadingAspect::SetMaterial(
const Graphic3d_NameOfMaterial aMaterial,
const Aspect_TypeOfFacingModel aModel ) {
-
SetMaterial(Graphic3d_MaterialAspect(aMaterial),aModel);
}
-#else
-void Prs3d_ShadingAspect::SetMaterial(
-// const Graphic3d_NameOfPhysicalMaterial aMaterial) {
- const Graphic3d_NameOfMaterial aMaterial) {
-
- Graphic3d_MaterialAspect TheMaterial(aMaterial);
- myAspect->SetFrontMaterial (TheMaterial);
- myAspect->SetBackMaterial (TheMaterial);
-}
-#endif
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
-#ifdef GER61351
void Prs3d_ShadingAspect::SetMaterial(
const Graphic3d_MaterialAspect& aMaterial,
const Aspect_TypeOfFacingModel aModel ) {
}
}
-Graphic3d_MaterialAspect Prs3d_ShadingAspect::Material(
- const Aspect_TypeOfFacingModel aModel ) const {
- Graphic3d_MaterialAspect myReturn ;
- switch (aModel) {
+const Graphic3d_MaterialAspect& Prs3d_ShadingAspect::Material (const Aspect_TypeOfFacingModel theModel) const
+{
+ switch (theModel)
+ {
default:
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
- myReturn = myAspect->FrontMaterial();
- break;
+ return myAspect->FrontMaterial();
case Aspect_TOFM_BACK_SIDE:
- myReturn = myAspect->BackMaterial();
- break;
+ return myAspect->BackMaterial();
}
- return myReturn ;
-}
-#else
-void Prs3d_ShadingAspect::SetMaterial(
- const Graphic3d_MaterialAspect& aMaterial)
-{
- myAspect->SetFrontMaterial (aMaterial);
- myAspect->SetBackMaterial (aMaterial);
}
-#endif
//=======================================================================
//function : SetTransparency
//purpose :
//=======================================================================
-#ifdef GER61351
void Prs3d_ShadingAspect::SetTransparency(const Standard_Real aValue,
const Aspect_TypeOfFacingModel aModel ) {
}
return aValue;
}
-#endif
//=======================================================================
//function : SetAspect