mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-01 10:26:12 +03:00
0023115: Polygon offset doesn't applied in Viewer3D sample
Graphic3d_AspectFillArea3d: use Aspect_POM_Fill polygon offset mode by default Graphic3d_Group: disable texture mapping if invalid texture ID is specified AIS_InteractiveObject: remove Fill() method, polygon offset parameters should be applied explicitly in Compute() method or by SetPolygonOffsets() AIS_TexturedShape: Compute() now takes polygon offsets into account
This commit is contained in:
parent
3ddebf9123
commit
6076110592
@ -527,15 +527,6 @@ is
|
|||||||
---C++: return const&
|
---C++: return const&
|
||||||
SetRecomputeOk(me:mutable) is private;
|
SetRecomputeOk(me:mutable) is private;
|
||||||
|
|
||||||
-- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
|
|
||||||
Fill(me: mutable;
|
|
||||||
aPresentationManager: PresentationManager from PrsMgr;
|
|
||||||
aPresentation: mutable Presentation from PrsMgr;
|
|
||||||
aMode: Integer from Standard = 0)
|
|
||||||
is redefined protected;
|
|
||||||
-- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
|
|
||||||
|
|
||||||
|
|
||||||
State(me:mutable;theState: Integer from Standard) ;
|
State(me:mutable;theState: Integer from Standard) ;
|
||||||
---C++: inline
|
---C++: inline
|
||||||
State(me) returns Integer from Standard ;
|
State(me) returns Integer from Standard ;
|
||||||
|
@ -781,6 +781,7 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode,
|
|||||||
// TODO: Add methods for retrieving individual aspects from Graphic3d_Group
|
// TODO: Add methods for retrieving individual aspects from Graphic3d_Group
|
||||||
aGrp->GroupPrimitivesAspect(aLineAsp, aTextAsp, aPntAsp, aFaceAsp);
|
aGrp->GroupPrimitivesAspect(aLineAsp, aTextAsp, aPntAsp, aFaceAsp);
|
||||||
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
|
aFaceAsp->SetPolygonOffsets(aMode, aFactor, aUnits);
|
||||||
|
// TODO: Issue 23118 - This line kills texture data in the group...
|
||||||
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
|
aGrp->SetGroupPrimitivesAspect(aFaceAsp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -812,38 +813,4 @@ void AIS_InteractiveObject::PolygonOffsets(Standard_Integer& aMode,
|
|||||||
if( HasPolygonOffsets() )
|
if( HasPolygonOffsets() )
|
||||||
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode, aFactor, aUnits );
|
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode, aFactor, aUnits );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIS_InteractiveObject::Fill(const Handle(PrsMgr_PresentationManager)& aPresentationManager,
|
|
||||||
const Handle(PrsMgr_Presentation)& aPresentation,
|
|
||||||
const Standard_Integer aMode)
|
|
||||||
{
|
|
||||||
PrsMgr_PresentableObject::Fill(aPresentationManager, aPresentation, aMode);
|
|
||||||
|
|
||||||
// Update polygon offsets for <aPresentation> using <myDrawer> data
|
|
||||||
if ( !myDrawer->ShadingAspect().IsNull() )
|
|
||||||
{
|
|
||||||
Standard_Integer aMode1 = Aspect_POM_Fill;
|
|
||||||
Standard_Real aFactor = 1., aUnits = 0.;
|
|
||||||
myDrawer->ShadingAspect()->Aspect()->PolygonOffsets( aMode1, aFactor, aUnits );
|
|
||||||
|
|
||||||
// Here we force this object to have default polygon offsets , if they are not
|
|
||||||
// turned on for this object explicitly
|
|
||||||
if ( ( aMode1 & Aspect_POM_None ) == Aspect_POM_None )
|
|
||||||
{
|
|
||||||
aMode1 = Aspect_POM_Fill;
|
|
||||||
aFactor = 1.;
|
|
||||||
aUnits = 0.;
|
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetPolygonOffsets( aMode1, aFactor, aUnits );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(PrsMgr_Presentation3d) aPrs3d =
|
|
||||||
Handle(PrsMgr_Presentation3d)::DownCast( aPresentation );
|
|
||||||
if ( !aPrs3d.IsNull() ) {
|
|
||||||
Handle(Graphic3d_Structure) aStruct =
|
|
||||||
Handle(Graphic3d_Structure)::DownCast( aPrs3d->Presentation() );
|
|
||||||
if( !aStruct.IsNull() )
|
|
||||||
aStruct->SetPrimitivesAspect( myDrawer->ShadingAspect()->Aspect() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
|
@ -328,6 +328,15 @@ void AIS_TexturedShape::Compute (const Handle(PrsMgr_PresentationManager3d)& /*t
|
|||||||
{
|
{
|
||||||
Handle(Prs3d_ShadingAspect) aPrs3d_ShadingAspect = new Prs3d_ShadingAspect();
|
Handle(Prs3d_ShadingAspect) aPrs3d_ShadingAspect = new Prs3d_ShadingAspect();
|
||||||
myAspect = aPrs3d_ShadingAspect->Aspect();
|
myAspect = aPrs3d_ShadingAspect->Aspect();
|
||||||
|
|
||||||
|
// Issue 23115: copy polygon offset settings passed through myDrawer
|
||||||
|
if (HasPolygonOffsets())
|
||||||
|
{
|
||||||
|
Standard_Integer aMode;
|
||||||
|
Standard_Real aFactor, aUnits;
|
||||||
|
PolygonOffsets(aMode, aFactor, aUnits);
|
||||||
|
myAspect->SetPolygonOffsets(aMode, aFactor, aUnits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!DoMapTexture)
|
if (!DoMapTexture)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ DistinguishModeActive (Standard_False), EdgeModeActive (Standard_False), BackFac
|
|||||||
|
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
// By default, aspect do not change current polygon offset parameters
|
// By default, aspect do not change current polygon offset parameters
|
||||||
MyPolygonOffsetMode = Aspect_POM_None;
|
MyPolygonOffsetMode = Aspect_POM_Fill;
|
||||||
MyPolygonOffsetFactor = 1.;
|
MyPolygonOffsetFactor = 1.;
|
||||||
MyPolygonOffsetUnits = 0.;
|
MyPolygonOffsetUnits = 0.;
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
@ -104,7 +104,7 @@ Aspect_AspectFillArea (InteriorStyle, InteriorColor, EdgeColor, EdgeLineType, Ed
|
|||||||
|
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
// By default, aspect do not change current polygon offset parameters
|
// By default, aspect do not change current polygon offset parameters
|
||||||
MyPolygonOffsetMode = Aspect_POM_None;
|
MyPolygonOffsetMode = Aspect_POM_Fill;
|
||||||
MyPolygonOffsetFactor = 1.;
|
MyPolygonOffsetFactor = 1.;
|
||||||
MyPolygonOffsetUnits = 0.;
|
MyPolygonOffsetUnits = 0.;
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
|
@ -266,13 +266,15 @@ void Graphic3d_Group::SetGroupPrimitivesAspect (const Handle(Graphic3d_AspectFil
|
|||||||
|
|
||||||
/*** Texture map ***/
|
/*** Texture map ***/
|
||||||
Handle(Graphic3d_TextureMap) GroupTextureMap = CTX->TextureMap();
|
Handle(Graphic3d_TextureMap) GroupTextureMap = CTX->TextureMap();
|
||||||
if (! GroupTextureMap.IsNull() )
|
if (! GroupTextureMap.IsNull() ) {
|
||||||
MyCGroup.ContextFillArea.Texture.TexId = GroupTextureMap->TextureId();
|
MyCGroup.ContextFillArea.Texture.TexId = GroupTextureMap->TextureId();
|
||||||
else
|
MyCGroup.ContextFillArea.Texture.doTextureMap =
|
||||||
|
CTX->TextureMapState () ? 1 : 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
MyCGroup.ContextFillArea.Texture.TexId = -1;
|
MyCGroup.ContextFillArea.Texture.TexId = -1;
|
||||||
|
MyCGroup.ContextFillArea.Texture.doTextureMap = 0;
|
||||||
MyCGroup.ContextFillArea.Texture.doTextureMap =
|
}
|
||||||
CTX->TextureMapState () ? 1 : 0;
|
|
||||||
|
|
||||||
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
// OCC4895 SAN 22/03/04 High-level interface for controlling polygon offsets
|
||||||
Standard_Integer aPolyMode;
|
Standard_Integer aPolyMode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user