mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0027137: Visualization - handle shadow structures within V3d_View::Gravity()
OpenGl_StructureShadow - copy bounding box from parent structure. Prs3d_PresentationShadow::CalculateBoundBox() - do nothing. V3d_View::Gravity() - skip presentations with transformation persistence flags. Use cached presentation bounding box.
This commit is contained in:
parent
66dce5e76b
commit
770fa4d4cf
@ -124,8 +124,7 @@ public:
|
||||
Standard_EXPORT void Remove();
|
||||
|
||||
//! Computes axis-aligned bounding box of a structure.
|
||||
//! Category: Methods to modify the class definition
|
||||
Standard_EXPORT void CalculateBoundBox();
|
||||
Standard_EXPORT virtual void CalculateBoundBox();
|
||||
|
||||
//! If <theToSet> is Standard_True then <me> is infinite and
|
||||
//! the MinMaxValues method method return :
|
||||
|
@ -33,6 +33,7 @@ OpenGl_StructureShadow::OpenGl_StructureShadow (const Handle(Graphic3d_Structure
|
||||
ContainsFacet = myParent->ContainsFacet;
|
||||
IsInfinite = myParent->IsInfinite;
|
||||
Transformation = myParent->Transformation;
|
||||
myBndBox = myParent->BoundingBox();
|
||||
|
||||
UpdateTransformation();
|
||||
myInstancedStructure = const_cast<OpenGl_Structure*> (myParent->InstancedStructure());
|
||||
|
@ -30,3 +30,12 @@ Prs3d_PresentationShadow::Prs3d_PresentationShadow (const Handle(Graphic3d_Struc
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CalculateBoundBox
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Prs3d_PresentationShadow::CalculateBoundBox()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ public:
|
||||
//! Returns view affinity of the parent presentation
|
||||
Standard_EXPORT inline const Handle(Graphic3d_ViewAffinity)& ParentAffinity() const { return myParentAffinity; }
|
||||
|
||||
//! Do nothing - axis-aligned bounding box should be initialized from parent structure.
|
||||
Standard_EXPORT virtual void CalculateBoundBox() Standard_OVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation)
|
||||
|
@ -2190,21 +2190,31 @@ void V3d_View::Gravity (Standard_Real& theX,
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||
if (!aStruct->IsVisible()
|
||||
|| (hasSelection && !aStruct->IsHighlighted())
|
||||
|| aStruct->IsEmpty())
|
||||
|| aStruct->IsInfinite()
|
||||
|| (hasSelection && !aStruct->IsHighlighted()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Bnd_Box aBox = aStruct->MinMaxValues();
|
||||
if (aBox.IsVoid() || aStruct->IsInfinite())
|
||||
const Graphic3d_BndBox4f& aBox = aStruct->CStructure()->BoundingBox();
|
||||
if (!aBox.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip transformation-persistent objects
|
||||
if (aStruct->TransformPersistence().Flags != Graphic3d_TMF_None)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// use camera projection to find gravity point
|
||||
aBox.Get (Xmin, Ymin, Zmin,
|
||||
Xmax, Ymax, Zmax);
|
||||
Xmin = (Standard_Real )aBox.CornerMin().x();
|
||||
Ymin = (Standard_Real )aBox.CornerMin().y();
|
||||
Zmin = (Standard_Real )aBox.CornerMin().z();
|
||||
Xmax = (Standard_Real )aBox.CornerMax().x();
|
||||
Ymax = (Standard_Real )aBox.CornerMax().y();
|
||||
Zmax = (Standard_Real )aBox.CornerMax().z();
|
||||
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =
|
||||
{
|
||||
gp_Pnt (Xmin, Ymin, Zmin), gp_Pnt (Xmin, Ymin, Zmax),
|
||||
@ -2228,21 +2238,10 @@ void V3d_View::Gravity (Standard_Real& theX,
|
||||
|
||||
if (aNbPoints == 0)
|
||||
{
|
||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (aSetOfStructures);
|
||||
aStructIter.More(); aStructIter.Next())
|
||||
// fallback - just use bounding box of entire scene
|
||||
Bnd_Box aBox = myView->MinMaxValues (Standard_True);
|
||||
if (!aBox.IsVoid())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||
if (aStruct->IsEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Bnd_Box aBox = aStruct->MinMaxValues();
|
||||
if (aBox.IsVoid() || aStruct->IsInfinite())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
aBox.Get (Xmin, Ymin, Zmin,
|
||||
Xmax, Ymax, Zmax);
|
||||
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =
|
||||
|
Loading…
x
Reference in New Issue
Block a user