mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with Graphic3d_TOSM_UNLIT shading model
Prs3d_ShadingAspect::SetTransparency() now sets transparency also to interior color. AIS_RubberBand now uses Graphic3d_TOSM_UNLIT.
This commit is contained in:
@@ -44,6 +44,7 @@ AIS_RubberBand::AIS_RubberBand()
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_WHITE, Aspect_TOL_SOLID, 1.0));
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
|
||||
myDrawer->ShadingAspect()->SetTransparency (1.0);
|
||||
@@ -66,6 +67,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
|
||||
myDrawer->SetLineAspect (new Prs3d_LineAspect (theLineColor, theLineType, theWidth));
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_EMPTY);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
|
||||
myDrawer->ShadingAspect()->SetTransparency (1.0);
|
||||
@@ -91,6 +93,7 @@ AIS_RubberBand::AIS_RubberBand (const Quantity_Color& theLineColor,
|
||||
myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
|
||||
myDrawer->ShadingAspect()->SetMaterial (Graphic3d_NOM_PLASTIC);
|
||||
myDrawer->ShadingAspect()->SetColor (theFillColor);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetInteriorStyle (Aspect_IS_SOLID);
|
||||
myDrawer->ShadingAspect()->Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend);
|
||||
myDrawer->ShadingAspect()->SetTransparency (theTransparency);
|
||||
|
@@ -119,7 +119,7 @@ AIS_ViewController::AIS_ViewController()
|
||||
myAnchorPointPrs2->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
myAnchorPointPrs2->SetMutable (true);
|
||||
|
||||
myRubberBand = new AIS_RubberBand (Quantity_NOC_LIGHTBLUE, Aspect_TOL_SOLID, Quantity_NOC_LIGHTBLUE, 0.4, 1.0);
|
||||
myRubberBand = new AIS_RubberBand (Quantity_NOC_LIGHTBLUE, Aspect_TOL_SOLID, Quantity_NOC_LIGHTBLUE4, 0.5, 1.0);
|
||||
myRubberBand->SetZLayer (Graphic3d_ZLayerId_TopOSD);
|
||||
myRubberBand->SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_2d, Aspect_TOTP_LEFT_UPPER));
|
||||
myRubberBand->SetDisplayMode (0);
|
||||
|
@@ -144,12 +144,14 @@ void Prs3d_ShadingAspect::SetTransparency (const Standard_Real theValue,
|
||||
|| theModel == Aspect_TOFM_BOTH_SIDE)
|
||||
{
|
||||
myAspect->ChangeFrontMaterial().SetTransparency (Standard_ShortReal(theValue));
|
||||
myAspect->SetInteriorColor (Quantity_ColorRGBA (myAspect->InteriorColor(), 1.0f - Standard_ShortReal(theValue)));
|
||||
}
|
||||
|
||||
if (theModel == Aspect_TOFM_BACK_SIDE
|
||||
|| theModel == Aspect_TOFM_BOTH_SIDE)
|
||||
{
|
||||
myAspect->ChangeBackMaterial().SetTransparency (Standard_ShortReal(theValue));
|
||||
myAspect->SetBackInteriorColor (Quantity_ColorRGBA (myAspect->BackInteriorColor(), 1.0f - Standard_ShortReal(theValue)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user