mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cbaea36b11 | ||
|
bf36a1fb0c | ||
|
15cb25b8f3 |
@@ -177,7 +177,6 @@ Graphic3d_TransformPersScaledAbove.hxx
|
||||
Graphic3d_TransformPersScaledAbove.cxx
|
||||
Graphic3d_TransformUtils.hxx
|
||||
Graphic3d_TransModeFlags.hxx
|
||||
Graphic3d_TypeOfAnswer.hxx
|
||||
Graphic3d_TypeOfBackfacingModel.hxx
|
||||
Graphic3d_TypeOfBackground.hxx
|
||||
Graphic3d_TypeOfConnection.hxx
|
||||
@@ -192,7 +191,6 @@ Graphic3d_TypeOfStructure.hxx
|
||||
Graphic3d_TypeOfTexture.hxx
|
||||
Graphic3d_TypeOfTextureFilter.hxx
|
||||
Graphic3d_TypeOfTextureMode.hxx
|
||||
Graphic3d_TypeOfVisualization.hxx
|
||||
Graphic3d_Vec.hxx
|
||||
Graphic3d_Vec2.hxx
|
||||
Graphic3d_Vec3.hxx
|
||||
|
@@ -34,7 +34,6 @@ Graphic3d_CView::Graphic3d_CView (const Handle(Graphic3d_StructureManager)& theM
|
||||
myIsActive (Standard_False),
|
||||
myIsRemoved (Standard_False),
|
||||
myBackfacing (Graphic3d_TypeOfBackfacingModel_Auto),
|
||||
myVisualization (Graphic3d_TOV_WIREFRAME),
|
||||
myUnitFactor (1.0)
|
||||
{
|
||||
myId = myStructureManager->Identification (this);
|
||||
@@ -79,13 +78,7 @@ void Graphic3d_CView::Activate()
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the structure can be displayed in the new context of the view, it is displayed.
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||
if (anAnswer == Graphic3d_TOA_YES
|
||||
|| anAnswer == Graphic3d_TOA_COMPUTE)
|
||||
{
|
||||
Display (aStruct);
|
||||
}
|
||||
Display (aStruct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,12 +109,7 @@ void Graphic3d_CView::Deactivate()
|
||||
continue;
|
||||
}
|
||||
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||
if (anAnswer == Graphic3d_TOA_YES
|
||||
|| anAnswer == Graphic3d_TOA_COMPUTE)
|
||||
{
|
||||
Erase (aStruct);
|
||||
}
|
||||
Erase (aStruct);
|
||||
}
|
||||
|
||||
Update();
|
||||
@@ -140,15 +128,11 @@ void Graphic3d_CView::Remove()
|
||||
return;
|
||||
}
|
||||
|
||||
Graphic3d_MapOfStructure aDisplayedStructs (myStructsDisplayed);
|
||||
|
||||
for (Graphic3d_MapIteratorOfMapOfStructure aStructIter (aDisplayedStructs); aStructIter.More(); aStructIter.Next())
|
||||
Graphic3d_ViewStructureMap aDisplayedStructs (myStructsDisplayed);
|
||||
for (Graphic3d_ViewStructureMap::Iterator aStructIter (aDisplayedStructs); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
Erase (aStructIter.Value());
|
||||
Erase (aStructIter.Key());
|
||||
}
|
||||
|
||||
myStructsToCompute.Clear();
|
||||
myStructsComputed .Clear();
|
||||
myStructsDisplayed.Clear();
|
||||
|
||||
if (!myStructureManager.IsNull())
|
||||
@@ -175,20 +159,18 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
||||
myIsInComputedMode = theMode;
|
||||
if (!myIsInComputedMode)
|
||||
{
|
||||
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||
if (aStruct->Visual() != Graphic3d_TOS_COMPUTED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Standard_Integer anIndex = IsComputed (aStruct);
|
||||
if (anIndex != 0)
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = aStructIter.Value();
|
||||
if (!aCompStruct.IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructComp = myStructsComputed.Value (anIndex);
|
||||
eraseStructure (aStructComp->CStructure());
|
||||
eraseStructure (aCompStruct->CStructure());
|
||||
displayStructure (aStruct->CStructure(), aStruct->DisplayPriority());
|
||||
Update (aStruct->GetZLayer());
|
||||
}
|
||||
@@ -196,72 +178,42 @@ void Graphic3d_CView::SetComputedMode (const Standard_Boolean theMode)
|
||||
return;
|
||||
}
|
||||
|
||||
for (Graphic3d_MapOfStructure::Iterator aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
|
||||
for (Graphic3d_ViewStructureMap::Iterator aDispStructIter (myStructsDisplayed); aDispStructIter.More(); aDispStructIter.Next())
|
||||
{
|
||||
Handle(Graphic3d_Structure) aStruct = aDispStructIter.Key();
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStruct->Visual());
|
||||
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
Handle(Graphic3d_Structure) aStruct = aDispStructIter.Key();
|
||||
if (aStruct->Visual() != Graphic3d_TOS_COMPUTED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const Standard_Integer anIndex = IsComputed (aStruct);
|
||||
if (anIndex != 0)
|
||||
Handle(Graphic3d_Structure)& aCompStruct = aDispStructIter.ChangeValue();
|
||||
if (!aDispStructIter.Value().IsNull())
|
||||
{
|
||||
eraseStructure (aStruct->CStructure());
|
||||
displayStructure (myStructsComputed.Value (anIndex)->CStructure(), aStruct->DisplayPriority());
|
||||
displayStructure (aCompStruct->CStructure(), aStruct->DisplayPriority());
|
||||
|
||||
Display (aStruct);
|
||||
if (aStruct->IsHighlighted())
|
||||
if (aStruct->IsHighlighted()
|
||||
&& !aCompStruct->IsHighlighted())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
||||
if (!aCompStruct->IsHighlighted())
|
||||
{
|
||||
aCompStruct->Highlight (aStruct->HighlightStyle(), Standard_False);
|
||||
}
|
||||
aCompStruct->Highlight (aStruct->HighlightStyle(), Standard_False);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(Graphic3d_Structure) aCompStruct;
|
||||
aStruct->computeHLR (myCamera, aCompStruct);
|
||||
if (aCompStruct.IsNull())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
aCompStruct->SetHLRValidation (Standard_True);
|
||||
|
||||
const Standard_Boolean toComputeWireframe = myVisualization == Graphic3d_TOV_WIREFRAME
|
||||
&& aStruct->ComputeVisual() != Graphic3d_TOS_SHADING;
|
||||
const Standard_Boolean toComputeShading = myVisualization == Graphic3d_TOV_SHADING
|
||||
&& aStruct->ComputeVisual() != Graphic3d_TOS_WIREFRAME;
|
||||
if (toComputeWireframe) aCompStruct->SetVisual (Graphic3d_TOS_WIREFRAME);
|
||||
if (toComputeShading ) aCompStruct->SetVisual (Graphic3d_TOS_SHADING);
|
||||
aCompStruct->SetVisual (Graphic3d_TOS_ALL);
|
||||
|
||||
if (aStruct->IsHighlighted())
|
||||
{
|
||||
aCompStruct->Highlight (aStruct->HighlightStyle(), Standard_False);
|
||||
}
|
||||
|
||||
Standard_Boolean hasResult = Standard_False;
|
||||
const Standard_Integer aNbToCompute = myStructsToCompute.Length();
|
||||
const Standard_Integer aStructId = aStruct->Identification();
|
||||
for (Standard_Integer aToCompStructIter = 1; aToCompStructIter <= aNbToCompute; ++aToCompStructIter)
|
||||
{
|
||||
if (myStructsToCompute.Value (aToCompStructIter)->Identification() == aStructId)
|
||||
{
|
||||
hasResult = Standard_True;
|
||||
myStructsComputed.ChangeValue (aToCompStructIter) = aCompStruct;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasResult)
|
||||
{
|
||||
myStructsToCompute.Append (aStruct);
|
||||
myStructsComputed .Append (aCompStruct);
|
||||
}
|
||||
|
||||
aCompStruct->CalculateBoundBox();
|
||||
eraseStructure (aStruct->CStructure());
|
||||
displayStructure (aCompStruct->CStructure(), aStruct->DisplayPriority());
|
||||
@@ -285,72 +237,46 @@ void Graphic3d_CView::ReCompute (const Handle(Graphic3d_Structure)& theStruct)
|
||||
InvalidateBVHData (aLayerId);
|
||||
}
|
||||
|
||||
if (!ComputedMode()
|
||||
if (!myIsInComputedMode
|
||||
|| !IsActive()
|
||||
|| !theStruct->IsDisplayed())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (theStruct->Visual());
|
||||
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
if (theStruct->Visual() != Graphic3d_TOS_COMPUTED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer anIndex = IsComputed (theStruct);
|
||||
if (anIndex == 0)
|
||||
Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.ChangeSeek (theStruct);
|
||||
if (aCompStruct == nullptr
|
||||
|| aCompStruct->IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// compute + validation
|
||||
Handle(Graphic3d_Structure) aCompStructOld = myStructsComputed.ChangeValue (anIndex);
|
||||
Handle(Graphic3d_Structure) aCompStruct = aCompStructOld;
|
||||
aCompStruct->SetTransformation (Handle(TopLoc_Datum3D)());
|
||||
theStruct->computeHLR (myCamera, aCompStruct);
|
||||
if (aCompStruct.IsNull())
|
||||
Handle(Graphic3d_Structure) aCompStructOld = *aCompStruct;
|
||||
(*aCompStruct)->SetTransformation (Handle(TopLoc_Datum3D)());
|
||||
theStruct->computeHLR (myCamera, *aCompStruct);
|
||||
if (aCompStruct->IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
aCompStruct->SetHLRValidation (Standard_True);
|
||||
aCompStruct->CalculateBoundBox();
|
||||
|
||||
// of which type will be the computed?
|
||||
const Standard_Boolean toComputeWireframe = myVisualization == Graphic3d_TOV_WIREFRAME
|
||||
&& theStruct->ComputeVisual() != Graphic3d_TOS_SHADING;
|
||||
const Standard_Boolean toComputeShading = myVisualization == Graphic3d_TOV_SHADING
|
||||
&& theStruct->ComputeVisual() != Graphic3d_TOS_WIREFRAME;
|
||||
if (toComputeWireframe)
|
||||
{
|
||||
aCompStruct->SetVisual (Graphic3d_TOS_WIREFRAME);
|
||||
}
|
||||
else if (toComputeShading)
|
||||
{
|
||||
aCompStruct->SetVisual (Graphic3d_TOS_SHADING);
|
||||
}
|
||||
(*aCompStruct)->SetHLRValidation (Standard_True);
|
||||
(*aCompStruct)->SetVisual (Graphic3d_TOS_ALL);
|
||||
(*aCompStruct)->CalculateBoundBox();
|
||||
|
||||
if (theStruct->IsHighlighted())
|
||||
{
|
||||
aCompStruct->Highlight (theStruct->HighlightStyle(), Standard_False);
|
||||
(*aCompStruct)->Highlight (theStruct->HighlightStyle(), Standard_False);
|
||||
}
|
||||
|
||||
// The previous calculation is removed and the new one is displayed
|
||||
eraseStructure (aCompStructOld->CStructure());
|
||||
displayStructure (aCompStruct->CStructure(), theStruct->DisplayPriority());
|
||||
|
||||
// why not just replace existing items?
|
||||
//myStructsToCompute.ChangeValue (anIndex) = theStruct;
|
||||
//myStructsComputed .ChangeValue (anIndex) = aCompStruct;
|
||||
|
||||
// hlhsr and the new associated compute are added
|
||||
myStructsToCompute.Append (theStruct);
|
||||
myStructsComputed .Append (aCompStruct);
|
||||
|
||||
// hlhsr and the new associated compute are removed
|
||||
myStructsToCompute.Remove (anIndex);
|
||||
myStructsComputed .Remove (anIndex);
|
||||
displayStructure ((*aCompStruct)->CStructure(), theStruct->DisplayPriority());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -390,7 +316,7 @@ void Graphic3d_CView::InvalidateZLayerBoundingBox (const Graphic3d_ZLayerId theL
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::DisplayedStructures (Graphic3d_MapOfStructure& theStructures) const
|
||||
{
|
||||
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
theStructures.Add (aStructIter.Key());
|
||||
}
|
||||
@@ -520,40 +446,6 @@ Bnd_Box Graphic3d_CView::MinMaxValues (const Graphic3d_MapOfStructure& theSet,
|
||||
return aResult;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : acceptDisplay
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_TypeOfAnswer Graphic3d_CView::acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const
|
||||
{
|
||||
switch (theStructType)
|
||||
{
|
||||
case Graphic3d_TOS_ALL:
|
||||
{
|
||||
return Graphic3d_TOA_YES; // The structure accepts any type of view
|
||||
}
|
||||
case Graphic3d_TOS_SHADING:
|
||||
{
|
||||
return myVisualization == Graphic3d_TOV_SHADING
|
||||
? Graphic3d_TOA_YES
|
||||
: Graphic3d_TOA_NO;
|
||||
}
|
||||
case Graphic3d_TOS_WIREFRAME:
|
||||
{
|
||||
return myVisualization == Graphic3d_TOV_WIREFRAME
|
||||
? Graphic3d_TOA_YES
|
||||
: Graphic3d_TOA_NO;
|
||||
}
|
||||
case Graphic3d_TOS_COMPUTED:
|
||||
{
|
||||
return (myVisualization == Graphic3d_TOV_SHADING || myVisualization == Graphic3d_TOV_WIREFRAME)
|
||||
? Graphic3d_TOA_COMPUTE
|
||||
: Graphic3d_TOA_NO;
|
||||
}
|
||||
}
|
||||
return Graphic3d_TOA_NO;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Compute
|
||||
// purpose :
|
||||
@@ -561,12 +453,15 @@ Graphic3d_TypeOfAnswer Graphic3d_CView::acceptDisplay (const Graphic3d_TypeOfStr
|
||||
void Graphic3d_CView::Compute()
|
||||
{
|
||||
// force HLRValidation to False on all structures calculated in the view
|
||||
for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructsComputed); aStructIter.More(); aStructIter.Next())
|
||||
for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
aStructIter.Value()->SetHLRValidation (Standard_False);
|
||||
if (!aStructIter.Value().IsNull())
|
||||
{
|
||||
aStructIter.Value()->SetHLRValidation (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ComputedMode())
|
||||
if (!myIsInComputedMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -575,12 +470,12 @@ void Graphic3d_CView::Compute()
|
||||
// Remove structures that were calculated for the previous orientation.
|
||||
// Recalculation of new structures.
|
||||
NCollection_Sequence<Handle(Graphic3d_Structure)> aStructsSeq;
|
||||
for (Graphic3d_MapOfStructure::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
for (Graphic3d_ViewStructureMap::Iterator aStructIter (myStructsDisplayed); aStructIter.More(); aStructIter.Next())
|
||||
{
|
||||
const Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (aStructIter.Key()->Visual());
|
||||
if (anAnswer == Graphic3d_TOA_COMPUTE)
|
||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Key();
|
||||
if (aStruct->Visual() == Graphic3d_TOS_COMPUTED)
|
||||
{
|
||||
aStructsSeq.Append (aStructIter.Key()); // if the structure was calculated, it is recalculated
|
||||
aStructsSeq.Append (aStruct); // if the structure was calculated, it is recalculated
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,12 +492,12 @@ void Graphic3d_CView::Compute()
|
||||
void Graphic3d_CView::Clear (Graphic3d_Structure* theStructure,
|
||||
const Standard_Boolean theWithDestruction)
|
||||
{
|
||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||
if (anIndex != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure); /// TODO
|
||||
if (aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.Value (anIndex);
|
||||
aCompStruct->GraphicClear (theWithDestruction);
|
||||
aCompStruct->SetHLRValidation (Standard_False);
|
||||
(*aCompStruct)->GraphicClear (theWithDestruction);
|
||||
(*aCompStruct)->SetHLRValidation (Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,14 +508,14 @@ void Graphic3d_CView::Clear (Graphic3d_Structure* theStructure,
|
||||
void Graphic3d_CView::Connect (const Graphic3d_Structure* theMother,
|
||||
const Graphic3d_Structure* theDaughter)
|
||||
{
|
||||
Standard_Integer anIndexM = IsComputed (theMother);
|
||||
Standard_Integer anIndexD = IsComputed (theDaughter);
|
||||
if (anIndexM != 0
|
||||
&& anIndexD != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStructM = myStructsDisplayed.Seek (theMother); /// TODO
|
||||
const Handle(Graphic3d_Structure)* aCompStructD = myStructsDisplayed.Seek (theDaughter); /// TODO
|
||||
if (aCompStructM != nullptr
|
||||
&& !aCompStructM->IsNull()
|
||||
&& aCompStructD != nullptr
|
||||
&& !aCompStructD->IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructM = myStructsComputed.Value (anIndexM);
|
||||
const Handle(Graphic3d_Structure)& aStructD = myStructsComputed.Value (anIndexD);
|
||||
aStructM->GraphicConnect (aStructD);
|
||||
(*aCompStructM)->GraphicConnect (*aCompStructD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,14 +526,14 @@ void Graphic3d_CView::Connect (const Graphic3d_Structure* theMother,
|
||||
void Graphic3d_CView::Disconnect (const Graphic3d_Structure* theMother,
|
||||
const Graphic3d_Structure* theDaughter)
|
||||
{
|
||||
Standard_Integer anIndexM = IsComputed (theMother);
|
||||
Standard_Integer anIndexD = IsComputed (theDaughter);
|
||||
if (anIndexM != 0
|
||||
&& anIndexD != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStructM = myStructsDisplayed.Seek (theMother); /// TODO
|
||||
const Handle(Graphic3d_Structure)* aCompStructD = myStructsDisplayed.Seek (theDaughter); /// TODO
|
||||
if (aCompStructM != nullptr
|
||||
&& !aCompStructM->IsNull()
|
||||
&& aCompStructD != nullptr
|
||||
&& !aCompStructD->IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructM = myStructsComputed.Value (anIndexM);
|
||||
const Handle(Graphic3d_Structure)& aStructD = myStructsComputed.Value (anIndexD);
|
||||
aStructM->GraphicDisconnect (aStructD);
|
||||
(*aCompStructM)->GraphicDisconnect (*aCompStructD);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,29 +552,19 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
// or more, of calculated type =>
|
||||
// - removes it as well as the associated old computed
|
||||
// THis happens when hlhsr becomes again of type e non computed after SetVisual.
|
||||
Standard_Integer anIndex = IsComputed (theStructure);
|
||||
if (anIndex != 0
|
||||
&& theStructure->Visual() != Graphic3d_TOS_COMPUTED)
|
||||
Standard_Integer aPrsIndex = myStructsDisplayed.FindIndex (theStructure);
|
||||
if (theStructure->Visual() != Graphic3d_TOS_COMPUTED
|
||||
&& aPrsIndex != 0)
|
||||
{
|
||||
myStructsToCompute.Remove (anIndex);
|
||||
myStructsComputed .Remove (anIndex);
|
||||
anIndex = 0;
|
||||
myStructsDisplayed.ChangeFromIndex (aPrsIndex).Nullify();
|
||||
}
|
||||
|
||||
Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (theStructure->Visual());
|
||||
if (anAnswer == Graphic3d_TOA_NO)
|
||||
const Standard_Integer anOldExtent = myStructsDisplayed.Extent();
|
||||
if (theStructure->Visual() != Graphic3d_TOS_COMPUTED
|
||||
|| !myIsInComputedMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ComputedMode())
|
||||
{
|
||||
anAnswer = Graphic3d_TOA_YES;
|
||||
}
|
||||
|
||||
if (anAnswer == Graphic3d_TOA_YES)
|
||||
{
|
||||
if (!myStructsDisplayed.Add (theStructure))
|
||||
aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
|
||||
if (aPrsIndex <= anOldExtent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -689,23 +574,15 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
Update (theStructure->GetZLayer());
|
||||
return;
|
||||
}
|
||||
else if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (anIndex != 0)
|
||||
if (aPrsIndex != 0
|
||||
&& !myStructsDisplayed.FindFromIndex (aPrsIndex).IsNull())
|
||||
{
|
||||
// Already computed, is COMPUTED still valid?
|
||||
const Handle(Graphic3d_Structure)& anOldStruct = myStructsComputed.Value (anIndex);
|
||||
const Handle(Graphic3d_Structure)& anOldStruct = myStructsDisplayed.FindFromIndex (aPrsIndex);
|
||||
if (anOldStruct->HLRValidation())
|
||||
{
|
||||
// Case COMPUTED valid, to be displayed
|
||||
if (!myStructsDisplayed.Add (theStructure))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
displayStructure (anOldStruct->CStructure(), theStructure->DisplayPriority());
|
||||
Update (anOldStruct->GetZLayer());
|
||||
return;
|
||||
@@ -718,11 +595,12 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
// 1/ Structure having the same Owner as <AStructure>
|
||||
// 2/ That is not <AStructure>
|
||||
// 3/ The COMPUTED which of is valid
|
||||
const Standard_Integer aNewIndex = HaveTheSameOwner (theStructure);
|
||||
/*const Standard_Integer aNewIndex = HaveTheSameOwner (theStructure);
|
||||
if (aNewIndex != 0)
|
||||
{
|
||||
// Case of COMPUTED invalid, WITH a valid of replacement; to be displayed
|
||||
if (!myStructsDisplayed.Add (theStructure))
|
||||
const Standard_Integer aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
|
||||
if (aPrsIndex <= anOldExtent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -733,11 +611,11 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
Update (aNewStruct->GetZLayer());
|
||||
return;
|
||||
}
|
||||
else
|
||||
else*/
|
||||
{
|
||||
// Case COMPUTED invalid, WITHOUT a valid of replacement
|
||||
// COMPUTED is removed if displayed
|
||||
if (myStructsDisplayed.Contains (theStructure))
|
||||
//if (myStructsDisplayed.Contains (theStructure))
|
||||
{
|
||||
eraseStructure (anOldStruct->CStructure());
|
||||
}
|
||||
@@ -746,61 +624,28 @@ void Graphic3d_CView::Display (const Handle(Graphic3d_Structure)& theStructure)
|
||||
}
|
||||
|
||||
// Compute + Validation
|
||||
Handle(Graphic3d_Structure) aStruct;
|
||||
if (anIndex != 0)
|
||||
aPrsIndex = myStructsDisplayed.Add (theStructure, Handle(Graphic3d_Structure)());
|
||||
Handle(Graphic3d_Structure)& aCompStruct = myStructsDisplayed.ChangeFromIndex (aPrsIndex);
|
||||
if (!aCompStruct.IsNull())
|
||||
{
|
||||
aStruct = myStructsComputed.Value (anIndex);
|
||||
aStruct->SetTransformation (Handle(TopLoc_Datum3D)());
|
||||
aCompStruct->SetTransformation (Handle(TopLoc_Datum3D)());
|
||||
}
|
||||
theStructure->computeHLR (myCamera, aStruct);
|
||||
if (aStruct.IsNull())
|
||||
theStructure->computeHLR (myCamera, aCompStruct);
|
||||
if (aCompStruct.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
aStruct->SetHLRValidation (Standard_True);
|
||||
|
||||
// TOCOMPUTE and COMPUTED associated to sequences are added
|
||||
myStructsToCompute.Append (theStructure);
|
||||
myStructsComputed .Append (aStruct);
|
||||
|
||||
// The previous are removed if necessary
|
||||
if (anIndex != 0)
|
||||
{
|
||||
myStructsToCompute.Remove (anIndex);
|
||||
myStructsComputed .Remove (anIndex);
|
||||
}
|
||||
|
||||
// Of which type will be the computed?
|
||||
const Standard_Boolean toComputeWireframe = myVisualization == Graphic3d_TOV_WIREFRAME
|
||||
&& theStructure->ComputeVisual() != Graphic3d_TOS_SHADING;
|
||||
const Standard_Boolean toComputeShading = myVisualization == Graphic3d_TOV_SHADING
|
||||
&& theStructure->ComputeVisual() != Graphic3d_TOS_WIREFRAME;
|
||||
if (!toComputeShading && !toComputeWireframe)
|
||||
{
|
||||
anAnswer = Graphic3d_TOA_NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
aStruct->SetVisual (toComputeWireframe ? Graphic3d_TOS_WIREFRAME : Graphic3d_TOS_SHADING);
|
||||
anAnswer = acceptDisplay (aStruct->Visual());
|
||||
}
|
||||
aCompStruct->SetHLRValidation (Standard_True);
|
||||
aCompStruct->SetVisual (Graphic3d_TOS_ALL);
|
||||
|
||||
if (theStructure->IsHighlighted())
|
||||
{
|
||||
aStruct->Highlight (theStructure->HighlightStyle(), Standard_False);
|
||||
aCompStruct->Highlight (theStructure->HighlightStyle(), Standard_False);
|
||||
}
|
||||
|
||||
// It is displayed only if the calculated structure
|
||||
// has a proper type corresponding to the one of the view.
|
||||
if (anAnswer == Graphic3d_TOA_NO)
|
||||
{
|
||||
return;
|
||||
}
|
||||
displayStructure (aCompStruct->CStructure(), theStructure->DisplayPriority());
|
||||
|
||||
myStructsDisplayed.Add (theStructure);
|
||||
displayStructure (aStruct->CStructure(), theStructure->DisplayPriority());
|
||||
|
||||
Update (aStruct->GetZLayer());
|
||||
Update (aCompStruct->GetZLayer());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -814,26 +659,24 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure)
|
||||
return;
|
||||
}
|
||||
|
||||
const Graphic3d_TypeOfAnswer anAnswer = myIsInComputedMode ? acceptDisplay (theStructure->Visual()) : Graphic3d_TOA_YES;
|
||||
if (anAnswer != Graphic3d_TOA_COMPUTE)
|
||||
const bool isComputedStruct = theStructure->Visual() == Graphic3d_TOS_COMPUTED
|
||||
&& myIsInComputedMode;
|
||||
if (!isComputedStruct)
|
||||
{
|
||||
eraseStructure (theStructure->CStructure());
|
||||
}
|
||||
|
||||
const Standard_Integer anIndex = !myStructsToCompute.IsEmpty() ? IsComputed (theStructure) : 0;
|
||||
if (anIndex != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure);
|
||||
if (aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull())
|
||||
{
|
||||
if (anAnswer == Graphic3d_TOA_COMPUTE
|
||||
&& myIsInComputedMode)
|
||||
if (isComputedStruct)
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||
eraseStructure (aCompStruct->CStructure());
|
||||
eraseStructure ((*aCompStruct)->CStructure());
|
||||
}
|
||||
myStructsComputed .Remove (anIndex);
|
||||
myStructsToCompute.Remove (anIndex);
|
||||
}
|
||||
|
||||
myStructsDisplayed.Remove (theStructure);
|
||||
myStructsDisplayed.RemoveKey (theStructure);
|
||||
Update (theStructure->GetZLayer());
|
||||
}
|
||||
|
||||
@@ -843,11 +686,11 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure)
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::Highlight (const Handle(Graphic3d_Structure)& theStructure)
|
||||
{
|
||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||
if (anIndex != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure);
|
||||
if (aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||
aCompStruct->Highlight (theStructure->HighlightStyle(), Standard_False);
|
||||
(*aCompStruct)->Highlight (theStructure->HighlightStyle(), Standard_False);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,8 +701,9 @@ void Graphic3d_CView::Highlight (const Handle(Graphic3d_Structure)& theStructure
|
||||
void Graphic3d_CView::SetTransform (const Handle(Graphic3d_Structure)& theStructure,
|
||||
const Handle(TopLoc_Datum3D)& theTrsf)
|
||||
{
|
||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||
if (anIndex != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure);
|
||||
if (aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull())
|
||||
{
|
||||
// Test is somewhat light !
|
||||
// trsf is transferred only if it is :
|
||||
@@ -874,8 +718,7 @@ void Graphic3d_CView::SetTransform (const Handle(Graphic3d_Structure)& theStruct
|
||||
}
|
||||
else
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||
aCompStruct->GraphicTransform (theTrsf);
|
||||
(*aCompStruct)->GraphicTransform (theTrsf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -895,56 +738,14 @@ void Graphic3d_CView::SetTransform (const Handle(Graphic3d_Structure)& theStruct
|
||||
// =======================================================================
|
||||
void Graphic3d_CView::UnHighlight (const Handle(Graphic3d_Structure)& theStructure)
|
||||
{
|
||||
Standard_Integer anIndex = IsComputed (theStructure);
|
||||
if (anIndex != 0)
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure);
|
||||
if (aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex);
|
||||
aCompStruct->CStructure()->GraphicUnhighlight();
|
||||
(*aCompStruct)->CStructure()->GraphicUnhighlight();
|
||||
}
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
// function : IsComputed
|
||||
// purpose :
|
||||
// ========================================================================
|
||||
Standard_Boolean Graphic3d_CView::IsComputed (const Standard_Integer theStructId,
|
||||
Handle(Graphic3d_Structure)& theComputedStruct) const
|
||||
{
|
||||
theComputedStruct.Nullify();
|
||||
if (!ComputedMode())
|
||||
return Standard_False;
|
||||
|
||||
const Standard_Integer aNbStructs = myStructsToCompute.Length();
|
||||
for (Standard_Integer aStructIter = 1; aStructIter <= aNbStructs; ++aStructIter)
|
||||
{
|
||||
if (myStructsToCompute.Value (aStructIter)->Identification() == theStructId)
|
||||
{
|
||||
theComputedStruct = myStructsComputed (aStructIter);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : IsComputed
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Integer Graphic3d_CView::IsComputed (const Graphic3d_Structure* theStructure) const
|
||||
{
|
||||
const Standard_Integer aStructId = theStructure->Identification();
|
||||
Standard_Integer aStructIndex = 1;
|
||||
for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructsToCompute); aStructIter.More(); aStructIter.Next(), ++aStructIndex)
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStruct = aStructIter.Value();
|
||||
if (aStruct->Identification() == aStructId)
|
||||
{
|
||||
return aStructIndex;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : IsDisplayed
|
||||
// purpose :
|
||||
@@ -974,9 +775,10 @@ void Graphic3d_CView::ChangePriority (const Handle(Graphic3d_Structure)& theStru
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||
const Handle(Graphic3d_CStructure)& aCStruct = anIndex != 0
|
||||
? myStructsComputed.Value (anIndex)->CStructure()
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure);
|
||||
const Handle(Graphic3d_CStructure)& aCStruct = aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull()
|
||||
? (*aCompStruct)->CStructure()
|
||||
: theStructure->CStructure();
|
||||
|
||||
changePriority (aCStruct, theNewPriority);
|
||||
@@ -1001,9 +803,10 @@ void Graphic3d_CView::ChangeZLayer (const Handle(Graphic3d_Structure)& theStruct
|
||||
return;
|
||||
}
|
||||
|
||||
const Standard_Integer anIndex = IsComputed (theStructure);
|
||||
Handle(Graphic3d_CStructure) aCStruct = anIndex != 0
|
||||
? myStructsComputed.Value (anIndex)->CStructure()
|
||||
const Handle(Graphic3d_Structure)* aCompStruct = myStructsDisplayed.Seek (theStructure);
|
||||
Handle(Graphic3d_CStructure) aCStruct = aCompStruct != nullptr
|
||||
&& !aCompStruct->IsNull()
|
||||
? (*aCompStruct)->CStructure()
|
||||
: theStructure->CStructure();
|
||||
|
||||
changeZLayer (aCStruct, theLayerId);
|
||||
@@ -1013,7 +816,7 @@ void Graphic3d_CView::ChangeZLayer (const Handle(Graphic3d_Structure)& theStruct
|
||||
// function : HaveTheSameOwner
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Integer Graphic3d_CView::HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const
|
||||
/*Standard_Integer Graphic3d_CView::HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const
|
||||
{
|
||||
// Find in the sequence of already calculated structures
|
||||
// 1/ Structure with the same Owner as <AStructure>
|
||||
@@ -1034,7 +837,7 @@ Standard_Integer Graphic3d_CView::HaveTheSameOwner (const Handle(Graphic3d_Struc
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
// =======================================================================
|
||||
// function : CopySettings
|
||||
@@ -1393,23 +1196,9 @@ void Graphic3d_CView::DumpJson (Standard_OStream& theOStream, Standard_Integer t
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myStructureManager)
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myCamera.get())
|
||||
|
||||
for (Graphic3d_SequenceOfStructure::Iterator anIter (myStructsToCompute); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructToCompute = anIter.Value();
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aStructToCompute.get())
|
||||
}
|
||||
|
||||
for (Graphic3d_SequenceOfStructure::Iterator anIter (myStructsComputed); anIter.More(); anIter.Next())
|
||||
{
|
||||
const Handle(Graphic3d_Structure)& aStructComputed = anIter.Value();
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aStructComputed.get())
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsInComputedMode)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsActive)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myIsRemoved)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVisualization)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBackXRCamera.get())
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myBaseXRCamera.get())
|
||||
|
@@ -33,11 +33,9 @@
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Graphic3d_Texture2Dmanual.hxx>
|
||||
#include <Graphic3d_TextureEnv.hxx>
|
||||
#include <Graphic3d_TypeOfAnswer.hxx>
|
||||
#include <Graphic3d_TypeOfBackfacingModel.hxx>
|
||||
#include <Graphic3d_TypeOfBackground.hxx>
|
||||
#include <Graphic3d_TypeOfShadingModel.hxx>
|
||||
#include <Graphic3d_TypeOfVisualization.hxx>
|
||||
#include <Graphic3d_Vec3.hxx>
|
||||
#include <Graphic3d_ZLayerId.hxx>
|
||||
#include <Graphic3d_ZLayerSettings.hxx>
|
||||
@@ -54,6 +52,28 @@ class Graphic3d_StructureManager;
|
||||
|
||||
DEFINE_STANDARD_HANDLE (Graphic3d_CView, Graphic3d_DataStructureManager)
|
||||
|
||||
/*struct Graphic3d_ViewStructure
|
||||
{
|
||||
Handle(Graphic3d_Structure) Presentation;
|
||||
Handle(Graphic3d_Structure) ViewPresentation;
|
||||
public:
|
||||
//! Returns hash code for presentation.
|
||||
static Standard_Integer HashCode (const Graphic3d_ViewStructure& thePrs,
|
||||
const Standard_Integer theUpperBound)
|
||||
{
|
||||
return ::HashCode (thePrs.Presentation, theUpperBound);
|
||||
}
|
||||
|
||||
//! Returns true if two objects are equal.
|
||||
static Standard_Boolean IsEqual (const Graphic3d_ViewStructure& thePrs1,
|
||||
const Graphic3d_ViewStructure& thePrs2)
|
||||
{
|
||||
return thePrs1.Presentation == thePrs2.Presentation;
|
||||
}
|
||||
};*/
|
||||
|
||||
typedef NCollection_IndexedDataMap<Handle(Graphic3d_Structure), Handle(Graphic3d_Structure)> Graphic3d_ViewStructureMap;
|
||||
|
||||
//! Base class of a graphical view that carries out rendering process for a concrete
|
||||
//! implementation of graphical driver. Provides virtual interfaces for redrawing its
|
||||
//! contents, management of displayed structures and render settings. The source code
|
||||
@@ -113,12 +133,6 @@ public:
|
||||
//! Sets backfacing model for the view.
|
||||
void SetBackfacingModel (const Graphic3d_TypeOfBackfacingModel theModel) { myBackfacing = theModel; }
|
||||
|
||||
//! Returns visualization type of the view.
|
||||
Graphic3d_TypeOfVisualization VisualizationType() const { return myVisualization; }
|
||||
|
||||
//! Sets visualization type of the view.
|
||||
void SetVisualizationType (const Graphic3d_TypeOfVisualization theType) { myVisualization = theType; }
|
||||
|
||||
//! Switches computed HLR mode in the view
|
||||
Standard_EXPORT void SetComputedMode (const Standard_Boolean theMode);
|
||||
|
||||
@@ -146,11 +160,6 @@ public:
|
||||
//! Returns map of objects hidden within this specific view (not viewer-wise).
|
||||
Handle(Graphic3d_NMapOfTransient)& ChangeHiddenObjects() { return myHiddenObjects; }
|
||||
|
||||
//! Returns Standard_True in case if the structure with the given <theStructId> is
|
||||
//! in list of structures to be computed and stores computed struct to <theComputedStruct>.
|
||||
Standard_EXPORT Standard_Boolean IsComputed (const Standard_Integer theStructId,
|
||||
Handle(Graphic3d_Structure)& theComputedStruct) const;
|
||||
|
||||
//! Returns the bounding box of all structures displayed in the view.
|
||||
//! If theToIncludeAuxiliary is TRUE, then the boundary box also includes minimum and maximum limits
|
||||
//! of graphical elements forming parts of infinite and other auxiliary structures.
|
||||
@@ -170,9 +179,6 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
//! Is it possible to display the structure in the view?
|
||||
Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const;
|
||||
|
||||
//! Clears the structure in this view.
|
||||
Standard_EXPORT void Clear (Graphic3d_Structure* theStructure,
|
||||
const Standard_Boolean theWithDestruction);
|
||||
@@ -202,11 +208,6 @@ private:
|
||||
//! in the view <me>.
|
||||
Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& theStructure);
|
||||
|
||||
//! Returns an index != 0 if the structure have another structure computed for the view <me>.
|
||||
Standard_EXPORT Standard_Integer IsComputed (const Graphic3d_Structure* theStructure) const;
|
||||
|
||||
Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const { return IsComputed (theStructure.get()); }
|
||||
|
||||
//! Returns true if the structure is displayed in the view.
|
||||
Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& theStructure) const;
|
||||
|
||||
@@ -221,7 +222,7 @@ private:
|
||||
|
||||
//! Returns an index != 0 if the structure have the same owner than another structure
|
||||
//! in the sequence of the computed structures.
|
||||
Standard_EXPORT Standard_Integer HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const;
|
||||
///Standard_EXPORT Standard_Integer HaveTheSameOwner (const Handle(Graphic3d_Structure)& theStructure) const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -578,15 +579,13 @@ protected:
|
||||
|
||||
Handle(Graphic3d_StructureManager) myStructureManager;
|
||||
Handle(Graphic3d_Camera) myCamera;
|
||||
Graphic3d_SequenceOfStructure myStructsToCompute;
|
||||
Graphic3d_SequenceOfStructure myStructsComputed;
|
||||
Graphic3d_MapOfStructure myStructsDisplayed;
|
||||
//Graphic3d_MapOfStructure myStructsDisplayed; /// TODO
|
||||
Graphic3d_ViewStructureMap myStructsDisplayed;
|
||||
Handle(Graphic3d_NMapOfTransient) myHiddenObjects;
|
||||
Standard_Boolean myIsInComputedMode;
|
||||
Standard_Boolean myIsActive;
|
||||
Standard_Boolean myIsRemoved;
|
||||
Graphic3d_TypeOfBackfacingModel myBackfacing;
|
||||
Graphic3d_TypeOfVisualization myVisualization;
|
||||
|
||||
Handle(Aspect_XRSession) myXRSession;
|
||||
Handle(Graphic3d_Camera) myBackXRCamera; //!< camera projection parameters to restore after closing XR session (FOV, aspect and similar)
|
||||
|
@@ -41,8 +41,7 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
|
||||
const Handle(Graphic3d_Structure)& theLinkPrs)
|
||||
: myStructureManager(theManager.get()),
|
||||
myOwner (NULL),
|
||||
myVisual (Graphic3d_TOS_ALL),
|
||||
myComputeVisual (Graphic3d_TOS_ALL)
|
||||
myVisual (Graphic3d_TOS_ALL)
|
||||
{
|
||||
if (!theLinkPrs.IsNull())
|
||||
{
|
||||
@@ -51,7 +50,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
|
||||
{
|
||||
myVisual = theLinkPrs->myVisual;
|
||||
}
|
||||
myComputeVisual = theLinkPrs->myComputeVisual;
|
||||
myCStructure = theLinkPrs->myCStructure->ShadowLink (theManager);
|
||||
}
|
||||
else
|
||||
@@ -385,13 +383,11 @@ void Graphic3d_Structure::SetVisual (const Graphic3d_TypeOfStructure theVisual)
|
||||
if (!myCStructure->stick)
|
||||
{
|
||||
myVisual = theVisual;
|
||||
SetComputeVisual (theVisual);
|
||||
}
|
||||
else
|
||||
{
|
||||
erase();
|
||||
myVisual = theVisual;
|
||||
SetComputeVisual (theVisual);
|
||||
Display();
|
||||
}
|
||||
}
|
||||
@@ -1018,5 +1014,4 @@ void Graphic3d_Structure::DumpJson (Standard_OStream& theOStream, Standard_Integ
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_POINTER (theOStream, myOwner)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVisual)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myComputeVisual)
|
||||
}
|
||||
|
@@ -383,8 +383,6 @@ public:
|
||||
&& myCStructure->IsMutable;
|
||||
}
|
||||
|
||||
Graphic3d_TypeOfStructure ComputeVisual() const { return myComputeVisual; }
|
||||
|
||||
//! Clears the structure <me>.
|
||||
Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction);
|
||||
|
||||
@@ -415,16 +413,6 @@ public:
|
||||
Standard_EXPORT void Remove (Graphic3d_Structure* thePtr,
|
||||
const Graphic3d_TypeOfConnection theType);
|
||||
|
||||
void SetComputeVisual (const Graphic3d_TypeOfStructure theVisual)
|
||||
{
|
||||
// The ComputeVisual is saved only if the structure is declared TOS_ALL, TOS_WIREFRAME or TOS_SHADING.
|
||||
// This declaration permits to calculate proper representation of the structure calculated by Compute instead of passage to TOS_COMPUTED.
|
||||
if (theVisual != Graphic3d_TOS_COMPUTED)
|
||||
{
|
||||
myComputeVisual = theVisual;
|
||||
}
|
||||
}
|
||||
|
||||
//! Transforms theX, theY, theZ with the transformation theTrsf.
|
||||
Standard_EXPORT static void Transforms (const gp_Trsf& theTrsf,
|
||||
const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ,
|
||||
@@ -491,7 +479,6 @@ protected:
|
||||
NCollection_IndexedMap<Graphic3d_Structure*> myDescendants;
|
||||
Standard_Address myOwner;
|
||||
Graphic3d_TypeOfStructure myVisual;
|
||||
Graphic3d_TypeOfStructure myComputeVisual;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -1,33 +0,0 @@
|
||||
// Created on: 1991-10-07
|
||||
// Created by: NW,JPB,CAL
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_TypeOfAnswer_HeaderFile
|
||||
#define _Graphic3d_TypeOfAnswer_HeaderFile
|
||||
|
||||
//! The answer of the method AcceptDisplay
|
||||
//! AcceptDisplay means is it possible to display the
|
||||
//! specified structure in the specified view ?
|
||||
//! TOA_YES yes
|
||||
//! TOA_NO no
|
||||
//! TOA_COMPUTE yes but we have to compute the representation
|
||||
enum Graphic3d_TypeOfAnswer
|
||||
{
|
||||
Graphic3d_TOA_YES,
|
||||
Graphic3d_TOA_NO,
|
||||
Graphic3d_TOA_COMPUTE
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_TypeOfAnswer_HeaderFile
|
@@ -21,8 +21,6 @@
|
||||
//! in wireframe, shadow mode, or both.
|
||||
enum Graphic3d_TypeOfStructure
|
||||
{
|
||||
Graphic3d_TOS_WIREFRAME,
|
||||
Graphic3d_TOS_SHADING,
|
||||
Graphic3d_TOS_COMPUTED,
|
||||
Graphic3d_TOS_ALL
|
||||
};
|
||||
|
@@ -1,30 +0,0 @@
|
||||
// Created on: 1991-10-07
|
||||
// Created by: NW,JPB,CAL
|
||||
// Copyright (c) 1991-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_TypeOfVisualization_HeaderFile
|
||||
#define _Graphic3d_TypeOfVisualization_HeaderFile
|
||||
|
||||
//! Modes of visualisation of objects in a view
|
||||
//!
|
||||
//! TOV_WIREFRAME wireframe visualisation
|
||||
//! TOV_SHADING shaded visualisation
|
||||
enum Graphic3d_TypeOfVisualization
|
||||
{
|
||||
Graphic3d_TOV_WIREFRAME,
|
||||
Graphic3d_TOV_SHADING
|
||||
};
|
||||
|
||||
#endif // _Graphic3d_TypeOfVisualization_HeaderFile
|
@@ -371,7 +371,7 @@ void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& the
|
||||
|
||||
Handle(Graphic3d_Structure) aViewDepPrs;
|
||||
Handle(Prs3d_PresentationShadow) aShadowPrs = Handle(Prs3d_PresentationShadow)::DownCast (aPrs);
|
||||
if (!aShadowPrs.IsNull() && aView->IsComputed (aShadowPrs->ParentId(), aViewDepPrs))
|
||||
/*if (!aShadowPrs.IsNull() && aView->IsComputed (aShadowPrs->ParentId(), aViewDepPrs))
|
||||
{
|
||||
const Graphic3d_ZLayerId aZLayer = aShadowPrs->GetZLayer();
|
||||
aShadowPrs.Nullify();
|
||||
@@ -386,7 +386,7 @@ void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& the
|
||||
// handles custom highlight presentations which were defined in overridden
|
||||
// HilightOwnerWithColor method of a custom AIS objects and maintain its
|
||||
// visibility in different views on their own
|
||||
else if (aShadowPrs.IsNull())
|
||||
else */if (aShadowPrs.IsNull())
|
||||
{
|
||||
aPrs->Display();
|
||||
continue;
|
||||
@@ -706,12 +706,12 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)&
|
||||
{
|
||||
const Handle(Graphic3d_CView)& aView = anActiveViewIter.Value()->View();
|
||||
Handle(Graphic3d_Structure) aViewDepParentPrs;
|
||||
if (aView->IsComputed (aParentId, aViewDepParentPrs))
|
||||
/**if (aView->IsComputed (aParentId, aViewDepParentPrs))
|
||||
{
|
||||
updatePrsTransformation (myViewDependentImmediateList,
|
||||
aViewDepParentPrs->CStructure()->Identification(),
|
||||
aTrsf);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -95,7 +95,6 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView th
|
||||
SetBackFacingModel (V3d_TOBM_AUTOMATIC);
|
||||
SetCamera (aCamera);
|
||||
SetAxis (0.,0.,0.,1.,1.,1.);
|
||||
SetVisualization (theViewer->DefaultVisualization());
|
||||
SetTwist (0.);
|
||||
SetAt (0.,0.,0.);
|
||||
SetProj (theViewer->DefaultViewProj());
|
||||
@@ -218,30 +217,11 @@ void V3d_View::Remove()
|
||||
aWin.Nullify();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Update
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::Update() const
|
||||
{
|
||||
if (!myView->IsDefined()
|
||||
|| !myView->IsActive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
myIsInvalidatedImmediate = Standard_False;
|
||||
myView->Update();
|
||||
myView->Compute();
|
||||
AutoZFit();
|
||||
myView->Redraw();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Redraw
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::Redraw() const
|
||||
void V3d_View::Redraw (bool theToCompute) const
|
||||
{
|
||||
if (!myView->IsDefined()
|
||||
|| !myView->IsActive())
|
||||
@@ -250,7 +230,14 @@ void V3d_View::Redraw() const
|
||||
}
|
||||
|
||||
myIsInvalidatedImmediate = Standard_False;
|
||||
Handle(Graphic3d_StructureManager) aStructureMgr = MyViewer->StructureManager();
|
||||
Handle(Graphic3d_StructureManager) aStructureMgr = MyViewer->StructureManager();
|
||||
|
||||
if (theToCompute)
|
||||
{
|
||||
//myView->Update();
|
||||
myView->Compute();
|
||||
}
|
||||
|
||||
for (Standard_Integer aRetryIter = 0; aRetryIter < 2; ++aRetryIter)
|
||||
{
|
||||
if (aStructureMgr->IsDeviceLost())
|
||||
@@ -586,20 +573,6 @@ void V3d_View::SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTexture)
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : SetVisualization
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void V3d_View::SetVisualization (const V3d_TypeOfVisualization theType)
|
||||
{
|
||||
myView->SetVisualizationType (static_cast <Graphic3d_TypeOfVisualization> (theType));
|
||||
|
||||
if (myImmediateUpdate)
|
||||
{
|
||||
Redraw();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : SetFront
|
||||
//purpose :
|
||||
@@ -2218,15 +2191,6 @@ Handle(Graphic3d_TextureEnv) V3d_View::TextureEnv() const
|
||||
return myView->TextureEnv();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Visualization
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
V3d_TypeOfVisualization V3d_View::Visualization() const
|
||||
{
|
||||
return static_cast<V3d_TypeOfVisualization> (myView->VisualizationType());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : IfWindow
|
||||
//purpose :
|
||||
|
@@ -108,13 +108,14 @@ public:
|
||||
Standard_EXPORT void Remove();
|
||||
|
||||
//! Deprecated, Redraw() should be used instead.
|
||||
Standard_EXPORT void Update() const;
|
||||
void Update() const
|
||||
{
|
||||
Redraw (true);
|
||||
}
|
||||
|
||||
//! Redisplays the view even if there has not
|
||||
//! been any modification.
|
||||
//! Must be called if the view is shown.
|
||||
//! (Ex: DeIconification ) .
|
||||
Standard_EXPORT virtual void Redraw() const;
|
||||
//! Redisplays the view even if there has not been any modification.
|
||||
//! Must be called if the view is shown Ex: DeIconification).
|
||||
Standard_EXPORT virtual void Redraw (bool theToCompute = false) const;
|
||||
|
||||
//! Updates layer of immediate presentations.
|
||||
Standard_EXPORT virtual void RedrawImmediate() const;
|
||||
@@ -247,9 +248,6 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
//! Defines the visualization type in the view.
|
||||
Standard_EXPORT void SetVisualization (const V3d_TypeOfVisualization theType);
|
||||
|
||||
//! Activates theLight in the view.
|
||||
Standard_EXPORT void SetLightOn (const Handle(V3d_Light)& theLight);
|
||||
|
||||
@@ -704,9 +702,6 @@ public:
|
||||
|
||||
Standard_EXPORT Handle(Graphic3d_TextureEnv) TextureEnv() const;
|
||||
|
||||
//! Returns the current visualisation mode.
|
||||
Standard_EXPORT V3d_TypeOfVisualization Visualization() const;
|
||||
|
||||
//! Returns a list of active lights.
|
||||
const V3d_ListOfLight& ActiveLights() const { return myActiveLights; }
|
||||
|
||||
|
@@ -46,7 +46,6 @@ V3d_Viewer::V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver)
|
||||
myBackground (Quantity_NOC_GRAY30),
|
||||
myViewSize (1000.0),
|
||||
myViewProj (V3d_XposYnegZpos),
|
||||
myVisualization (V3d_ZBUFFER),
|
||||
myDefaultTypeOfView (V3d_ORTHOGRAPHIC),
|
||||
myComputedMode (Standard_True),
|
||||
myDefaultComputedMode (Standard_False),
|
||||
@@ -902,7 +901,6 @@ void V3d_Viewer::DumpJson (Standard_OStream& theOStream, Standard_Integer theDep
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myViewSize)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myViewProj)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myVisualization)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myDefaultTypeOfView)
|
||||
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myDefaultRenderingParams)
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include <V3d_ListOfView.hxx>
|
||||
#include <V3d_TypeOfOrientation.hxx>
|
||||
#include <V3d_TypeOfView.hxx>
|
||||
#include <V3d_TypeOfVisualization.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
|
||||
class Aspect_Grid;
|
||||
@@ -145,12 +144,6 @@ public:
|
||||
//! Sets the default projection for creating views in the viewer.
|
||||
void SetDefaultViewProj (const V3d_TypeOfOrientation theOrientation) { myViewProj = theOrientation; }
|
||||
|
||||
//! Returns the default type of Visualization.
|
||||
V3d_TypeOfVisualization DefaultVisualization() const { return myVisualization; }
|
||||
|
||||
//! Gives the default visualization mode.
|
||||
void SetDefaultVisualization (const V3d_TypeOfVisualization theType) { myVisualization = theType; }
|
||||
|
||||
//! Returns the default type of Shading; Graphic3d_TypeOfShadingModel_Phong by default.
|
||||
Graphic3d_TypeOfShadingModel DefaultShadingModel() const { return myDefaultRenderingParams.ShadingModel; }
|
||||
|
||||
@@ -500,7 +493,6 @@ private:
|
||||
Aspect_GradientBackground myGradientBackground;
|
||||
Standard_Real myViewSize;
|
||||
V3d_TypeOfOrientation myViewProj;
|
||||
V3d_TypeOfVisualization myVisualization;
|
||||
V3d_TypeOfView myDefaultTypeOfView;
|
||||
Graphic3d_RenderingParams myDefaultRenderingParams;
|
||||
|
||||
|
Reference in New Issue
Block a user