1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0023115: Polygon offset doesn't applied in Viewer3D sample

- AIS_InteractiveObject::SetPolygonOffsets() patched to update all object's groups that has AspectFillArea3d set.
- vpolygonoffset DRAW command added.
This commit is contained in:
san
2012-04-18 21:15:49 +04:00
parent f7634c7791
commit 3ddebf9123
2 changed files with 108 additions and 1 deletions

View File

@@ -57,6 +57,9 @@
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <AIS_GraphicTool.hxx>
#include <Graphic3d_AspectFillArea3d.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_AspectText3d.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Structure.hxx>
@@ -762,8 +765,26 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
Handle(PrsMgr_Presentation3d)::DownCast( myPresentations(i).Presentation() );
if ( !aPrs3d.IsNull() ) {
aStruct = Handle(Graphic3d_Structure)::DownCast( aPrs3d->Presentation() );
if( !aStruct.IsNull() )
if( !aStruct.IsNull() ) {
aStruct->SetPrimitivesAspect( myDrawer->ShadingAspect()->Aspect() );
// Workaround for issue 23115: Need to update also groups, because their
// face aspect ALWAYS overrides the structure's.
const Graphic3d_SequenceOfGroup& aGroups = aStruct->Groups();
Standard_Integer aGroupIndex = 1, aGroupNb = aGroups.Length();
for ( ; aGroupIndex <= aGroupNb; aGroupIndex++ ) {
Handle(Graphic3d_Group) aGrp = aGroups.Value(aGroupIndex);
if ( !aGrp.IsNull() && aGrp->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA) ) {
Handle(Graphic3d_AspectFillArea3d) aFaceAsp = new Graphic3d_AspectFillArea3d();
Handle(Graphic3d_AspectLine3d) aLineAsp = new Graphic3d_AspectLine3d();
Handle(Graphic3d_AspectMarker3d) aPntAsp = new Graphic3d_AspectMarker3d();
Handle(Graphic3d_AspectText3d) aTextAsp = new Graphic3d_AspectText3d();
// TODO: Add methods for retrieving individual aspects from Graphic3d_Group
aGrp->GroupPrimitivesAspect(aLineAsp, aTextAsp, aPntAsp, aFaceAsp);
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
}
}
}
}
}
}