// override transparency
myDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
- myTransparency = theValue;
+ myDrawer->SetTransparency ((Standard_ShortReal )theValue);
updatePresentation();
}
//=======================================================================
void AIS_Triangulation::UnsetTransparency()
{
- myTransparency = 0.0;
+ myDrawer->SetTransparency (0.0f);
if (!myDrawer->HasOwnShadingAspect())
{
return;
// modify shading presentation without re-computation
const PrsMgr_Presentations& aPrsList = Presentations();
Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
- for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
+ for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next())
{
- const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
- if (aPrsModed.Mode() != AIS_WireFrame)
+ if (aPrsIter.Value()->Mode() != AIS_WireFrame)
{
continue;
}
- const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
-
- if (IsTransparent())
- {
- aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
- }
-
+ const Handle(Prs3d_Presentation)& aPrs = aPrsIter.Value();
for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
{
const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
- if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
- {
- aGroup->SetGroupPrimitivesAspect (anAreaAsp);
- }
- }
-
- if (!IsTransparent())
- {
- aPrs->ResetDisplayPriority();
+ aGroup->SetGroupPrimitivesAspect (anAreaAsp);
}
}
-
- myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
- myToRecomputeModes.Clear();
}
}
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
- switch (aMode)
+ switch (aMode)
{
case 0:
const TColgp_Array1OfPnt& nodes = myTriangulation->Nodes(); //Nodes
Standard_Integer i;
Standard_Integer j;
- Standard_Real ambient = aspect->FrontMaterial().Ambient();
+ const Standard_Real ambient = 0.2;
if (hasVNormals)
{
const TShort_Array1OfShortReal& normals = myTriangulation->Normals();
//=======================================================================
//function : ComputeSelection
-//purpose :
+//purpose :
//=======================================================================
void AIS_Triangulation::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/)
//=======================================================================
//function : SetTriangulation
-//purpose :
+//purpose :
//=======================================================================
void AIS_Triangulation::SetTriangulation(const Handle(Poly_Triangulation)& aTriangulation)
{
//=======================================================================
//function : GetTriangulation
-//purpose :
+//purpose :
//=======================================================================
Handle(Poly_Triangulation) AIS_Triangulation::GetTriangulation() const{
return myTriangulation;
//=======================================================================
//function : AttenuateColor
-//purpose : Attenuates 32-bit color by a given attenuation factor (0...1):
-// aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red
-// All color components are multiplied by aComponent, the result is then packed again as 32-bit integer.
-// Color attenuation is applied to the vertex colors in order to have correct visual result
-// after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat.
+//purpose :
//=======================================================================
-
Graphic3d_Vec4ub AIS_Triangulation::attenuateColor (const Standard_Integer theColor,
const Standard_Real theComposition)
{
+ const Standard_Byte* anRgbx = reinterpret_cast<const Standard_Byte*> (&theColor);
- const Graphic3d_Vec4ub& aColor = *reinterpret_cast<const Graphic3d_Vec4ub*> (&theColor);
// If IsTranparent() is false alpha value will be ignored anyway.
Standard_Byte anAlpha = IsTransparent() ? static_cast<Standard_Byte> (255.0 - myDrawer->ShadingAspect()->Aspect()->FrontMaterial().Transparency() * 255.0)
: 255;
- return Graphic3d_Vec4ub ((Standard_Byte)(theComposition * aColor.r()),
- (Standard_Byte)(theComposition * aColor.g()),
- (Standard_Byte)(theComposition * aColor.b()),
+ return Graphic3d_Vec4ub ((Standard_Byte)(theComposition * anRgbx[0]),
+ (Standard_Byte)(theComposition * anRgbx[1]),
+ (Standard_Byte)(theComposition * anRgbx[2]),
anAlpha);
}
-