mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
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:
@@ -383,6 +383,19 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean isProjectionMatUpdateNeeded = Standard_False;
|
||||
Standard_Boolean isOrientationMatUpdateNeeded = Standard_False;
|
||||
if (myBVHSelector.ProjectionState() != myCamera->ProjectionState())
|
||||
{
|
||||
isProjectionMatUpdateNeeded = Standard_True;
|
||||
myBVHSelector.ChangeProjectionState() = myCamera->ProjectionState();
|
||||
}
|
||||
if (myBVHSelector.ModelViewState() != myCamera->ModelViewState())
|
||||
{
|
||||
isOrientationMatUpdateNeeded = Standard_True;
|
||||
myBVHSelector.ChangeModelViewState() = myCamera->ModelViewState();
|
||||
}
|
||||
|
||||
// Set OCCT state uniform variables
|
||||
const Handle(OpenGl_ShaderManager) aManager = aContext->ShaderManager();
|
||||
if (!aManager->IsEmpty())
|
||||
@@ -429,6 +442,12 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
}
|
||||
}
|
||||
|
||||
if (isProjectionMatUpdateNeeded
|
||||
|| isOrientationMatUpdateNeeded)
|
||||
{
|
||||
myBVHSelector.SetViewVolume (myCamera);
|
||||
}
|
||||
|
||||
// ====================================
|
||||
// Step 2: Redraw background
|
||||
// ====================================
|
||||
@@ -643,6 +662,15 @@ void OpenGl_View::Render (const Handle(OpenGl_PrinterContext)& thePrintContext,
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : InvalidateBVHData
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_View::InvalidateBVHData (const Standard_Integer theLayerId)
|
||||
{
|
||||
myZLayers.InvalidateBVHData (theLayerId);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
//ExecuteViewDisplay
|
||||
@@ -1033,6 +1061,16 @@ void OpenGl_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||
myZLayers.Layer (theLayerId).SetLayerSettings (theSettings);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangePriority
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void OpenGl_View::ChangePriority (const OpenGl_Structure *theStructure,
|
||||
const Standard_Integer theNewPriority)
|
||||
{
|
||||
Standard_Integer aLayerId = theStructure->GetZLayer();
|
||||
myZLayers.ChangePriority (theStructure, aLayerId, theNewPriority);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RedrawScene
|
||||
|
Reference in New Issue
Block a user