mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0024070: OpenGL capped object-level clipping planes
Graphical clipping: - Use "Graphic3d_ClipPlane" to defined clipping for PrsMgr_PresentableObject (local clipping), for V3d_View (global clipping). Get rid of old implementations: - Remove Visual3d_ClipPlane. - Port V3d_Plane to Graphic3d_ClipPlane core. Selection Sensitives: - Port "Matches" method to add full set of arguments (SelectBasics_PickArgs), including min-max depth coming from selector. - Get rid of transient data for pair Matches -> ComputeDepth. - Extend SelectMgr_ViewerSelector::LoadResult to work with local clipping, add virtual callbacks to compute globa/local depth clipping for picking. Capping rendering algorithm: - Recursive rendering algorithm for OpenGl_Groups. - Introduced Rendering filter for groups. Clipping plane management in TKOpenGl: - Added OpenGl_ClippingState to OpenGl_Context. DRAWEXE commands: - Ported "vclipplane" command for new approach. - Added "vsettexturemode" command for changing texture details in views (enable / disable textures). Correct DownCast syntax (compilation error) Fix new compiler warnings tests/bugs/vis/bug22906 migrated to the new vclipplane syntax
This commit is contained in:
@@ -27,7 +27,7 @@ class DummySensitiveEntity from MeshVS inherits SensitiveEntity from SelectBasic
|
||||
uses
|
||||
EntityOwner from SelectBasics,
|
||||
ListOfBox2d from SelectBasics,
|
||||
|
||||
PickArgs from SelectBasics,
|
||||
Array1OfPnt2d from TColgp,
|
||||
|
||||
Box2d from Bnd
|
||||
@@ -38,9 +38,10 @@ is
|
||||
Areas ( me: mutable;
|
||||
aresult: in out ListOfBox2d from SelectBasics ) is redefined;
|
||||
|
||||
Matches ( me: mutable;
|
||||
X, Y, aTol: Real;
|
||||
DMin: out Real ) returns Boolean is redefined;
|
||||
Matches (me : mutable;
|
||||
thePickArgs : PickArgs from SelectBasics;
|
||||
theMatchDMin, theMatchDepth : out Real from Standard)
|
||||
returns Boolean is redefined;
|
||||
|
||||
Matches ( me: mutable;
|
||||
XMin, YMin, XMax, YMax, aTol: Real ) returns Boolean is redefined;
|
||||
|
@@ -42,9 +42,8 @@ void MeshVS_DummySensitiveEntity::Areas( SelectBasics_ListOfBox2d& )
|
||||
// Function : Matches
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean MeshVS_DummySensitiveEntity::Matches( const Standard_Real,
|
||||
const Standard_Real,
|
||||
const Standard_Real,
|
||||
Standard_Boolean MeshVS_DummySensitiveEntity::Matches( const SelectBasics_PickArgs&,
|
||||
Standard_Real&,
|
||||
Standard_Real& )
|
||||
{
|
||||
return Standard_False;
|
||||
|
@@ -30,7 +30,8 @@ uses
|
||||
Box2d from Bnd,
|
||||
Location from TopLoc,
|
||||
Lin from gp,
|
||||
ListOfBox2d from SelectBasics,
|
||||
ListOfBox2d from SelectBasics,
|
||||
PickArgs from SelectBasics,
|
||||
Projector from Select3D
|
||||
is
|
||||
|
||||
@@ -42,15 +43,12 @@ is
|
||||
|
||||
GetConnected( me: mutable; aLocation : Location from TopLoc )
|
||||
returns SensitiveEntity from Select3D is redefined;
|
||||
|
||||
ComputeDepth( me; EyeLine : Lin from gp ) returns Real from Standard
|
||||
is redefined;
|
||||
|
||||
Matches( me: mutable; X,Y : Real from Standard;
|
||||
aTol: Real from Standard;
|
||||
DMin: out Real from Standard ) returns Boolean
|
||||
is redefined;
|
||||
|
||||
|
||||
Matches (me : mutable;
|
||||
thePickArgs : PickArgs from SelectBasics;
|
||||
theMatchDMin, theMatchDepth : out Real from Standard)
|
||||
returns Boolean is redefined;
|
||||
|
||||
Matches ( me: mutable; XMin, YMin, XMax, YMax : Real;
|
||||
aTol : Real ) returns Boolean
|
||||
is redefined;
|
||||
|
@@ -60,13 +60,13 @@ Standard_Integer MeshVS_SensitiveMesh::GetMode () const
|
||||
// name : Matches
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean MeshVS_SensitiveMesh::Matches(const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real aTol,
|
||||
Standard_Real& DMin)
|
||||
Standard_Boolean MeshVS_SensitiveMesh::Matches (const SelectBasics_PickArgs& thePickArgs,
|
||||
Standard_Real& theMatchDMin,
|
||||
Standard_Real& theMatchDepth)
|
||||
{
|
||||
DMin = 0.;
|
||||
|
||||
theMatchDMin = 0.0;
|
||||
theMatchDepth = Precision::Infinite();
|
||||
|
||||
Handle(MeshVS_MeshOwner) anOwner = Handle(MeshVS_MeshOwner)::DownCast( OwnerId() );
|
||||
if( anOwner.IsNull() ) return Standard_False;
|
||||
Handle(MeshVS_Mesh) aMeshPrs = Handle(MeshVS_Mesh)::DownCast( anOwner->Selectable() );
|
||||
@@ -75,12 +75,17 @@ Standard_Boolean MeshVS_SensitiveMesh::Matches(const Standard_Real X,
|
||||
if( aDS.IsNull() ) return Standard_False;
|
||||
Handle(TColStd_HPackedMapOfInteger) NodesMap;
|
||||
Handle(TColStd_HPackedMapOfInteger) ElemsMap;
|
||||
|
||||
// Mesh data source should provide the algorithm for computation
|
||||
// of detected entities from 2D point
|
||||
Standard_Boolean isDetected = aDS->GetDetectedEntities( aMeshPrs, X, Y, aTol, NodesMap, ElemsMap, DMin );
|
||||
Standard_Boolean isDetected =
|
||||
aDS->GetDetectedEntities (aMeshPrs, thePickArgs.X(), thePickArgs.Y(),
|
||||
thePickArgs.Tolerance(), NodesMap,
|
||||
ElemsMap, theMatchDMin);
|
||||
|
||||
// The detected entites will be available from mesh owner
|
||||
anOwner->SetDetectedEntities( NodesMap, ElemsMap );
|
||||
|
||||
|
||||
return isDetected;
|
||||
}
|
||||
|
||||
@@ -148,15 +153,6 @@ Handle(Select3D_SensitiveEntity) MeshVS_SensitiveMesh::GetConnected( const TopLo
|
||||
return aMeshEnt;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ComputeDepth
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real MeshVS_SensitiveMesh::ComputeDepth( const gp_Lin& /*EyeLine*/ ) const
|
||||
{
|
||||
return Precision::Infinite();
|
||||
}
|
||||
|
||||
//==================================================
|
||||
// Function: ProjectOneCorner
|
||||
// Purpose :
|
||||
@@ -181,8 +177,6 @@ void MeshVS_SensitiveMesh::ProjectOneCorner(const Handle(Select3D_Projector)& th
|
||||
//==================================================
|
||||
void MeshVS_SensitiveMesh::Project(const Handle(Select3D_Projector)& aProj)
|
||||
{
|
||||
Select3D_SensitiveEntity::Project(aProj); // to set the field last proj...
|
||||
|
||||
mybox2d.SetVoid();
|
||||
if (mybox.IsVoid())
|
||||
return;
|
||||
|
@@ -31,6 +31,7 @@ uses
|
||||
Box2d from Bnd,
|
||||
Lin from gp,
|
||||
ListOfBox2d from SelectBasics,
|
||||
PickArgs from SelectBasics,
|
||||
Array1OfPnt from TColgp,
|
||||
HArray1OfPnt from TColgp,
|
||||
HArray1OfPnt2d from TColgp,
|
||||
@@ -47,10 +48,10 @@ is
|
||||
GetConnected( me:mutable; aLocation: Location from TopLoc ) returns SensitiveEntity from Select3D
|
||||
is redefined;
|
||||
|
||||
Matches( me : mutable;
|
||||
X,Y : Real from Standard;
|
||||
aTol : Real from Standard;
|
||||
DMin : out Real from Standard ) returns Boolean is redefined;
|
||||
Matches (me : mutable;
|
||||
thePickArgs : PickArgs from SelectBasics;
|
||||
theMatchDMin, theMatchDepth : out Real from Standard)
|
||||
returns Boolean is redefined;
|
||||
|
||||
Matches( me : mutable;
|
||||
XMin,YMin,XMax,YMax : Real from Standard;
|
||||
@@ -66,7 +67,7 @@ is
|
||||
FindIntersection( me; NodesIndices : SequenceOfInteger from TColStd;
|
||||
EyeLine : Lin from gp ) returns Real is protected;
|
||||
|
||||
ComputeDepth( me; EyeLine: Lin from gp ) returns Real from Standard is redefined;
|
||||
ComputeDepth( me; EyeLine: Lin from gp ) returns Real from Standard is virtual;
|
||||
|
||||
-- ComputeSize( me ) returns Real from Standard is redefined;
|
||||
|
||||
|
@@ -33,7 +33,7 @@ MeshVS_SensitivePolyhedron::
|
||||
MeshVS_SensitivePolyhedron( const Handle( SelectBasics_EntityOwner )& Owner,
|
||||
const TColgp_Array1OfPnt& Nodes,
|
||||
const Handle( MeshVS_HArray1OfSequenceOfInteger )& Topo )
|
||||
: Select3D_SensitiveEntity( Owner ),
|
||||
: Select3D_SensitiveEntity( Owner ),
|
||||
myTopo( Topo )
|
||||
{
|
||||
Standard_Integer low = Nodes.Lower(), up = Nodes.Upper(), i;
|
||||
@@ -51,8 +51,6 @@ MeshVS_SensitivePolyhedron( const Handle( SelectBasics_EntityOwner )& Owner,
|
||||
//================================================================
|
||||
void MeshVS_SensitivePolyhedron::Project( const Handle(Select3D_Projector)& aProjector )
|
||||
{
|
||||
Select3D_SensitiveEntity::Project( aProjector );
|
||||
|
||||
if( myNodes.IsNull() || myNodes2d.IsNull() )
|
||||
return;
|
||||
|
||||
@@ -115,10 +113,9 @@ void sort( Standard_Real& a, Standard_Real& b )
|
||||
// Function : Matches
|
||||
// Purpose :
|
||||
//================================================================
|
||||
Standard_Boolean MeshVS_SensitivePolyhedron::Matches( const Standard_Real X,
|
||||
const Standard_Real Y,
|
||||
const Standard_Real aTol,
|
||||
Standard_Real& DMin )
|
||||
Standard_Boolean MeshVS_SensitivePolyhedron::Matches( const SelectBasics_PickArgs& thePickArgs,
|
||||
Standard_Real& /*theMatchDMin*/,
|
||||
Standard_Real& theMatchDepth )
|
||||
{
|
||||
if( myNodes2d.IsNull() || myTopo.IsNull() )
|
||||
return Standard_False;
|
||||
@@ -127,7 +124,7 @@ Standard_Boolean MeshVS_SensitivePolyhedron::Matches( const Standard_Real X,
|
||||
R2 = myTopo->Upper(),
|
||||
low = myNodes2d->Lower();
|
||||
|
||||
Standard_Real rTol = aTol*SensitivityFactor();
|
||||
Standard_Real rTol = thePickArgs.Tolerance() * SensitivityFactor();
|
||||
|
||||
Standard_Boolean inside = Standard_False;
|
||||
|
||||
@@ -149,15 +146,15 @@ Standard_Boolean MeshVS_SensitivePolyhedron::Matches( const Standard_Real X,
|
||||
y2 = myNodes2d->Value( low+next ).Y();
|
||||
|
||||
if( Abs( x2-x1 )<Precision::Confusion() )
|
||||
{
|
||||
{
|
||||
//vertical edge!!!
|
||||
|
||||
sort( y1, y2 );
|
||||
if( Y>=y1-rTol && Y<=y2+rTol && x1>X-rTol )
|
||||
if ( thePickArgs.Y() >= y1 - rTol && thePickArgs.Y() <= y2 + rTol && x1 > thePickArgs.X() - rTol )
|
||||
intersect++;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
//inclined edge!!!
|
||||
|
||||
k = ( y2-y1 ) / ( x2-x1 );
|
||||
@@ -165,9 +162,9 @@ Standard_Boolean MeshVS_SensitivePolyhedron::Matches( const Standard_Real X,
|
||||
|
||||
if( Abs( k )>Precision::Confusion() )
|
||||
{
|
||||
xp = ( Y-b ) / k; // absciss of point of intersection
|
||||
xp = ( thePickArgs.Y() - b ) / k; // absciss of point of intersection
|
||||
sort( x1, x2 );
|
||||
if( xp>=x1 && xp<=x2 && xp>X-rTol )
|
||||
if( xp >= x1 && xp <= x2 && xp > thePickArgs.X() - rTol )
|
||||
intersect++;
|
||||
}
|
||||
}
|
||||
@@ -177,8 +174,11 @@ Standard_Boolean MeshVS_SensitivePolyhedron::Matches( const Standard_Real X,
|
||||
|
||||
if( inside )
|
||||
{
|
||||
return Select3D_SensitiveEntity::Matches( X, Y, aTol, DMin );
|
||||
theMatchDepth = ComputeDepth (thePickArgs.PickLine());
|
||||
|
||||
return !thePickArgs.IsClipped(theMatchDepth);
|
||||
}
|
||||
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ Standard_Real MeshVS_SensitivePolyhedron::FindIntersection
|
||||
{
|
||||
Standard_Real val( Precision::Infinite() );
|
||||
for( Standard_Integer i=1, n=NodesIndices.Length(); i<=n; i++ )
|
||||
val = Min( val, ElCLib::Parameter(
|
||||
val = Min( val, ElCLib::Parameter(
|
||||
EyeLine, myNodes->Value( myNodes->Lower()+NodesIndices.Value( i ) ) ) );
|
||||
|
||||
return val;
|
||||
@@ -265,7 +265,7 @@ Standard_Real MeshVS_SensitivePolyhedron::ComputeDepth( const gp_Lin& EyeLine )
|
||||
// Function : Areas
|
||||
// Purpose :
|
||||
//================================================================
|
||||
void MeshVS_SensitivePolyhedron::Areas( SelectBasics_ListOfBox2d& aResult )
|
||||
void MeshVS_SensitivePolyhedron::Areas( SelectBasics_ListOfBox2d& aResult )
|
||||
{
|
||||
Bnd_Box2d aBox;
|
||||
GetBox2d( aBox );
|
||||
|
Reference in New Issue
Block a user