0024307: TKOpenGl - efficient culling of large number of presentations

Implement SAT intersection tests and frustum culling algorithm using BVH trees.

New Draw command vfrustumculling to manage frustum culling.
Add test cases bugs/vis/bug24307_1 and bugs/vis/bug24307_2.
Remove CALL_DEF_BOUNDBOX and CALL_DEF_BOUNDS.
This commit is contained in:
vpa
2014-06-20 11:26:14 +04:00
committed by apn
parent c1c1aefa71
commit b7cd4ba795
53 changed files with 1885 additions and 538 deletions
-19
View File
@@ -297,25 +297,6 @@ is
---Purpose: Sets the context <CTX> in the view <me>.
---Category: Methods to modify the class definition
SetTransform ( me : mutable;
AMatrix : Array2OfReal from TColStd )
---Level: Internal
---Purpose: Sets the transformation matrix that is applied
-- to <MyViewOrientation> field of the view <me>.
--
-- <AMatrix> is defined as a 4*4 real matrix.
--
-- -------------------
-- | a11 a12 a13 t1 |
-- | a21 a22 a23 t2 |
-- | a31 a32 a33 t3 |
-- | 0 0 0 1 |
-- -------------------
--
-- Category: Methods to modify the class definition
-- Warning: Raises TransformError if the matrix isn't a 4x4 matrix.
raises TransformError from Visual3d is static;
SetViewMappingDefault ( me : mutable )
is static;
---Level: Public
+18 -4
View File
@@ -1189,8 +1189,7 @@ Standard_Integer Index = IsComputed (AStructure);
<< ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush;
#endif
MyGraphicDriver->EraseStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(MyCOMPUTEDSequence.Value (Index)->CStructure()), NewPriority);
MyGraphicDriver->ChangePriority (*(MyCOMPUTEDSequence.Value (Index)->CStructure()), MyCView, NewPriority);
}
else
{
@@ -1201,8 +1200,7 @@ Standard_Integer Index = IsComputed (AStructure);
<< ", " << OldPriority << ", " << NewPriority << ")\n";
cout << flush;
#endif
MyGraphicDriver->EraseStructure (MyCView, *(AStructure->CStructure()));
MyGraphicDriver->DisplayStructure (MyCView, *(AStructure->CStructure()), NewPriority);
MyGraphicDriver->ChangePriority (*(AStructure->CStructure()), MyCView, NewPriority);
}
}
@@ -1381,6 +1379,7 @@ Standard_Integer Index = IsComputed (AStructure);
if (Answer == Visual3d_TOA_YES ) {
if (IsDisplayed (AStructure)) return;
AStructure->CalculateBoundBox();
MyGraphicDriver->DisplayStructure (MyCView, *(AStructure->CStructure()), AStructure->DisplayPriority());
MyDisplayedStructure.Add (AStructure);
if (AnUpdateMode == Aspect_TOU_ASAP) Update ();
@@ -1628,6 +1627,14 @@ Standard_Integer Index = IsComputed (AStructure);
MyCOMPUTEDSequence.Value (Index)->GraphicTransform (ATrsf);
}
Standard_Integer aLayerId = AStructure->GetZLayer();
if (!AStructure->IsMutable()
&& !AStructure->CStructure()->IsForHighlight
&& !AStructure->CStructure()->IsInfinite)
{
AStructure->CalculateBoundBox();
MyGraphicDriver->InvalidateBVHData (MyCView, aLayerId);
}
}
void Visual3d_View::UnHighlight (const Handle(Graphic3d_Structure)& AStructure) {
@@ -2089,6 +2096,13 @@ Graphic3d_SequenceOfStructure FooSequence;
}
void Visual3d_View::ReCompute (const Handle(Graphic3d_Structure)& AStructure) {
if (MyCView.IsCullingEnabled)
{
AStructure->CalculateBoundBox();
Standard_Integer aLayerId = AStructure->DisplayPriority();
MyGraphicDriver->InvalidateBVHData(MyCView, aLayerId);
}
if (!ComputedMode()) return;
if (IsDeleted ()) return;