1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00: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:
apl
2013-09-19 16:58:00 +04:00
committed by bugmaster
parent 788cbaf4c4
commit 4269bd1b11
111 changed files with 4168 additions and 2293 deletions

View File

@@ -63,6 +63,8 @@ uses
Transformation from Geom,
ListOfInteger from TColStd,
Location from TopLoc,
ClipPlane_Handle from Graphic3d,
SetOfHClipPlane from Graphic3d,
-- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate )
TransModeFlags from Graphic3d,
Pnt from gp,
@@ -249,11 +251,46 @@ is
returns Integer from Standard is static;
---Purpose: Get ID of Z layer. If no presentations of object is displayed,
-- and layer ID is unavailable, the -1 value is returned.
AddClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
---Purpose: Adds clip plane for graphical clipping for all display mode
-- presentations. The composition of clip planes truncates the rendering
-- space to convex volume. Please be aware that number of supported
-- clip plane is limited. The planes which exceed the limit are ignored.
-- Besides of this, some planes can be already set in view where the object
-- is shown: the number of these planes should be substracted from limit
-- to predict the maximum possible number of object clipping planes.
-- @param thePlane [in] the clip plane to be appended to map of clip planes.
RemoveClipPlane (me : mutable; thePlane : ClipPlane_Handle from Graphic3d) is virtual;
---Purpose: Removes previously added clip plane.
-- @param thePlane [in] the clip plane to be removed from map of clip planes.
SetClipPlanes (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d) is virtual;
---Purpose: Set clip planes for graphical clipping for all display mode presentations.
-- The composition of clip planes truncates the rendering space to convex
-- volume. Please be aware that number of supported clip plane is limited.
-- The planes which exceed the limit are ignored. Besides of this, some
-- planes can be already set in view where the object is shown: the number
-- of these planes should be substracted from limit to predict the maximum
-- possible number of object clipping planes.
GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d;
---C++: inline
---C++: return const&
---Purpose: Get clip planes.
-- @return set of previously added clip planes for all display mode presentations.
UpdateClipping (me : mutable) is virtual protected;
---Purpose: General virtual method for internal update of presentation state
-- when some modifications on list of clip planes occurs. Base
-- implementation propagate clip planes to every presentation.
fields
myPresentations: Presentations from PrsMgr is protected;
myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected;
myLocation : Location from TopLoc is protected;
myClipPlanes : SetOfHClipPlane from Graphic3d is protected;
--myTransformPersistence : TransModeFlags from Graphic3d;
myTransformPersistence : CTransPersStruct from Graphic3d;

View File

@@ -36,7 +36,6 @@
//function : PrsMgr_PresentableObject
//purpose :
//=======================================================================
PrsMgr_PresentableObject::PrsMgr_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
:myPresentations(),myTypeOfPresentation3d(aTypeOfPresentation3d)
{
@@ -46,25 +45,29 @@ PrsMgr_PresentableObject::PrsMgr_PresentableObject(const PrsMgr_TypeOfPresentati
myTransformPersistence.Point.z = 0.0;
}
//=======================================================================
//function : Fill
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::Fill(const Handle(PrsMgr_PresentationManager)& aPresentationManager,
const Handle(PrsMgr_Presentation)& aPresentation,
const Standard_Integer aMode) {
if (aPresentation->DynamicType() == STANDARD_TYPE(PrsMgr_Presentation3d)) {
Compute(((Handle(PrsMgr_PresentationManager3d)&)aPresentationManager),((Handle(PrsMgr_Presentation3d)&)aPresentation)->Presentation(),aMode);
UpdateLocation(((Handle(PrsMgr_Presentation3d)&)aPresentation)->Presentation());
Handle(Graphic3d_Structure) aStruct = Handle(Graphic3d_Structure)::DownCast( ((Handle(PrsMgr_Presentation3d)&)aPresentation)->Presentation() );
if ( !aStruct.IsNull() ) {
aStruct->SetTransformPersistence( GetTransformPersistenceMode(), GetTransformPersistencePoint() );
}
void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& aPresentationManager,
const Handle(PrsMgr_Presentation)& aPresentation,
const Standard_Integer aMode)
{
if (aPresentation->DynamicType() == STANDARD_TYPE (PrsMgr_Presentation3d))
{
Handle(PrsMgr_PresentationManager3d) aPrsMgr3d =
(Handle(PrsMgr_PresentationManager3d)&)aPresentationManager;
Handle(PrsMgr_Presentation3d) aPrs3d =
(Handle(PrsMgr_Presentation3d)&)aPresentation;
Handle(Prs3d_Presentation) aStruct3d = aPrs3d->Presentation();
Compute (aPrsMgr3d, aStruct3d, aMode);
UpdateLocation (aStruct3d);
aStruct3d->SetClipPlanes (myClipPlanes);
aStruct3d->SetTransformPersistence (GetTransformPersistenceMode(), GetTransformPersistencePoint());
}
}
//=======================================================================
//function : Compute
//purpose :
@@ -75,6 +78,7 @@ void PrsMgr_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d
{
Standard_NotImplemented::Raise("cannot compute in a 3d visualizer");
}
//=======================================================================
//function : Compute
//purpose :
@@ -84,6 +88,7 @@ void PrsMgr_PresentableObject::Compute(const Handle(Prs3d_Projector)& /*aProject
{
Standard_NotImplemented::Raise("cannot compute under a specific projector");
}
//=======================================================================
//function : Compute
//purpose :
@@ -116,11 +121,11 @@ void PrsMgr_PresentableObject::Update (const Standard_Boolean AllModes) {
}
}
}
//=======================================================================
//function : Update
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::Update (const Standard_Integer aMode, const Standard_Boolean ClearOther) {
Standard_Integer l = myPresentations.Length();
for (Standard_Integer i=1; i <= l; i++) {
@@ -149,11 +154,11 @@ void PrsMgr_PresentableObject::Update (const Standard_Integer aMode, const Stand
}
}
//=======================================================================
//function : Presentations
//purpose :
//=======================================================================
PrsMgr_Presentations& PrsMgr_PresentableObject::Presentations() {
return myPresentations;
}
@@ -162,18 +167,15 @@ PrsMgr_Presentations& PrsMgr_PresentableObject::Presentations() {
//function : HasLocation
//purpose :
//=======================================================================
Standard_Boolean PrsMgr_PresentableObject::HasLocation() const
{
return !Location().IsIdentity();}
return !Location().IsIdentity();
}
//=======================================================================
//function : SetToUpdate
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::SetToUpdate(const Standard_Integer aMode)
{
for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
@@ -181,6 +183,11 @@ void PrsMgr_PresentableObject::SetToUpdate(const Standard_Integer aMode)
myPresentations(IP).Presentation()->SetUpdateStatus(Standard_True);
}
}
//=======================================================================
//function : SetToUpdate
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::SetToUpdate()
{
for(Standard_Integer IP =1; IP<=myPresentations.Length();IP++){
@@ -213,7 +220,6 @@ void PrsMgr_PresentableObject::ToBeUpdated(TColStd_ListOfInteger& OutList) const
//function : SetTypeOfPresentation
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::SetTypeOfPresentation(const PrsMgr_TypeOfPresentation3d aType)
{
myTypeOfPresentation3d = aType;
@@ -258,6 +264,10 @@ void PrsMgr_PresentableObject::ResetLocation()
myLocation = aLoc;
}
//=======================================================================
//function : UpdateLocation
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::UpdateLocation()
{
if(!HasLocation()) return;
@@ -271,12 +281,10 @@ void PrsMgr_PresentableObject::UpdateLocation()
}
}
//=======================================================================
//function : UpdateLocation
//purpose :
//=======================================================================
void PrsMgr_PresentableObject::UpdateLocation(const Handle(Prs3d_Presentation)& P)
{
if(myLocation.IsIdentity()) return;
@@ -363,3 +371,63 @@ Standard_Integer PrsMgr_PresentableObject::GetZLayer
return -1;
}
// =======================================================================
// function : AddClipPlane
// purpose :
// =======================================================================
void PrsMgr_PresentableObject::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
{
myClipPlanes.Add (thePlane);
UpdateClipping(); // process changes
}
// =======================================================================
// function : RemoveClipPlane
// purpose :
// =======================================================================
void PrsMgr_PresentableObject::RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane)
{
myClipPlanes.Remove (thePlane);
UpdateClipping(); // process changes
}
// =======================================================================
// function : SetClipPlanes
// purpose :
// =======================================================================
void PrsMgr_PresentableObject::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes)
{
myClipPlanes = thePlanes;
UpdateClipping();
}
// =======================================================================
// function : UpdateClipping
// purpose :
// =======================================================================
void PrsMgr_PresentableObject::UpdateClipping()
{
// affect generated structures
for (Standard_Integer aPrsIt = 1; aPrsIt <= myPresentations.Length(); ++aPrsIt)
{
// pass over presentation manager 3d mechanism right to the structures -
// we do not interested in display mode collections.
const PrsMgr_ModedPresentation& aModedPrs = myPresentations (aPrsIt);
Handle(PrsMgr_Presentation3d) aPrs =
Handle(PrsMgr_Presentation3d)::DownCast (aModedPrs.Presentation());
if (aPrs.IsNull())
continue;
Handle(Prs3d_Presentation) aStruct3d = aPrs->Presentation();
if (aStruct3d.IsNull())
continue;
aStruct3d->SetClipPlanes (myClipPlanes);
}
}

View File

@@ -25,3 +25,8 @@ inline PrsMgr_TypeOfPresentation3d PrsMgr_PresentableObject::TypeOfPresentation3
inline const TopLoc_Location& PrsMgr_PresentableObject::Location() const
{return myLocation;}
inline const Graphic3d_SetOfHClipPlane& PrsMgr_PresentableObject::GetClipPlanes() const
{
return myClipPlanes;
}