mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +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();
|
Standard_EXPORT void Remove();
|
||||||
|
|
||||||
//! Computes axis-aligned bounding box of a structure.
|
//! Computes axis-aligned bounding box of a structure.
|
||||||
//! Category: Methods to modify the class definition
|
Standard_EXPORT virtual void CalculateBoundBox();
|
||||||
Standard_EXPORT void CalculateBoundBox();
|
|
||||||
|
|
||||||
//! If <theToSet> is Standard_True then <me> is infinite and
|
//! If <theToSet> is Standard_True then <me> is infinite and
|
||||||
//! the MinMaxValues method method return :
|
//! the MinMaxValues method method return :
|
||||||
|
@ -33,6 +33,7 @@ OpenGl_StructureShadow::OpenGl_StructureShadow (const Handle(Graphic3d_Structure
|
|||||||
ContainsFacet = myParent->ContainsFacet;
|
ContainsFacet = myParent->ContainsFacet;
|
||||||
IsInfinite = myParent->IsInfinite;
|
IsInfinite = myParent->IsInfinite;
|
||||||
Transformation = myParent->Transformation;
|
Transformation = myParent->Transformation;
|
||||||
|
myBndBox = myParent->BoundingBox();
|
||||||
|
|
||||||
UpdateTransformation();
|
UpdateTransformation();
|
||||||
myInstancedStructure = const_cast<OpenGl_Structure*> (myParent->InstancedStructure());
|
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
|
//! Returns view affinity of the parent presentation
|
||||||
Standard_EXPORT inline const Handle(Graphic3d_ViewAffinity)& ParentAffinity() const { return myParentAffinity; }
|
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:
|
private:
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation)
|
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();
|
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||||
if (!aStruct->IsVisible()
|
if (!aStruct->IsVisible()
|
||||||
|| (hasSelection && !aStruct->IsHighlighted())
|
|| aStruct->IsInfinite()
|
||||||
|| aStruct->IsEmpty())
|
|| (hasSelection && !aStruct->IsHighlighted()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bnd_Box aBox = aStruct->MinMaxValues();
|
const Graphic3d_BndBox4f& aBox = aStruct->CStructure()->BoundingBox();
|
||||||
if (aBox.IsVoid() || aStruct->IsInfinite())
|
if (!aBox.IsValid())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip transformation-persistent objects
|
||||||
|
if (aStruct->TransformPersistence().Flags != Graphic3d_TMF_None)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// use camera projection to find gravity point
|
// use camera projection to find gravity point
|
||||||
aBox.Get (Xmin, Ymin, Zmin,
|
Xmin = (Standard_Real )aBox.CornerMin().x();
|
||||||
Xmax, Ymax, Zmax);
|
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 aPnts[THE_NB_BOUND_POINTS] =
|
||||||
{
|
{
|
||||||
gp_Pnt (Xmin, Ymin, Zmin), gp_Pnt (Xmin, Ymin, Zmax),
|
gp_Pnt (Xmin, Ymin, Zmin), gp_Pnt (Xmin, Ymin, Zmax),
|
||||||
@ -2228,21 +2238,10 @@ void V3d_View::Gravity (Standard_Real& theX,
|
|||||||
|
|
||||||
if (aNbPoints == 0)
|
if (aNbPoints == 0)
|
||||||
{
|
{
|
||||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (aSetOfStructures);
|
// fallback - just use bounding box of entire scene
|
||||||
aStructIter.More(); aStructIter.Next())
|
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,
|
aBox.Get (Xmin, Ymin, Zmin,
|
||||||
Xmax, Ymax, Zmax);
|
Xmax, Ymax, Zmax);
|
||||||
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =
|
gp_Pnt aPnts[THE_NB_BOUND_POINTS] =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user