//=======================================================================
OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
-: myNbPriorities (theNbPriorities),
+: myDefaultLayerIndex (0),
+ myNbPriorities (theNbPriorities),
myNbStructures (0),
- myImmediateNbStructures (0)
+ myImmediateNbStructures (0),
+ myModifStateOfRaytraceable (0)
{
// insert default priority layers
myLayers.Append (OpenGl_Layer (myNbPriorities));
myLayers.Append (OpenGl_Layer (myNbPriorities));
myLayerIds.Bind (Graphic3d_ZLayerId_TopOSD, myLayers.Upper());
+
+ myDefaultLayerIndex = myLayerIds.Find (Graphic3d_ZLayerId_Default);
}
//=======================================================================
myLayerIds.UnBind (theLayerId);
// updated sequence indexes in map
- OpenGl_LayerSeqIds::Iterator aMapIt (myLayerIds);
- for ( ; aMapIt.More (); aMapIt.Next ())
+ for (OpenGl_LayerSeqIds::Iterator aMapIt (myLayerIds); aMapIt.More(); aMapIt.Next())
{
- Standard_Integer& aSeqIdx = aMapIt.ChangeValue ();
+ Standard_Integer& aSeqIdx = aMapIt.ChangeValue();
if (aSeqIdx > aRemovePos)
aSeqIdx--;
}
+
+ myDefaultLayerIndex = myLayerIds.Find (Graphic3d_ZLayerId_Default);
}
//=======================================================================
--myImmediateNbStructures;
}
- if (theStructure->IsRaytracable())
+ if (aLayerId == Graphic3d_ZLayerId_Default
+ && theStructure->IsRaytracable())
{
- ++myModificationState;
+ ++myModifStateOfRaytraceable;
}
return;
--myImmediateNbStructures;
}
- if (theStructure->IsRaytracable())
+ if (aSeqId == myDefaultLayerIndex
+ && theStructure->IsRaytracable())
{
- ++myModificationState;
+ ++myModifStateOfRaytraceable;
}
return;
}
// if the structure is not found there, scan through all other layers
if (aLayer.Remove (theStructure, aPriority, Standard_False))
{
+ if (theOldLayerId == Graphic3d_ZLayerId_Default
+ && theStructure->IsRaytracable())
+ {
+ ++myModifStateOfRaytraceable;
+ }
+
--myNbStructures;
if (aLayer.LayerSettings().IsImmediate)
{
OpenGl_Layer& aLayerEx = anIts.ChangeValue();
if (aLayerEx.Remove (theStructure, aPriority, Standard_True))
{
+ if (aSeqId == myDefaultLayerIndex
+ && theStructure->IsRaytracable())
+ {
+ ++myModifStateOfRaytraceable;
+ }
+
--myNbStructures;
if (aLayerEx.LayerSettings().IsImmediate)
{
aCtx->core11fwd->glGetIntegerv (GL_DEPTH_FUNC, &aDefaultSettings.DepthFunc);
aCtx->core11fwd->glGetBooleanv (GL_DEPTH_WRITEMASK, &aDefaultSettings.DepthMask);
- Standard_Integer aSeqId = myLayers.Lower(), aMainId = myLayerIds.Find (Graphic3d_ZLayerId_Default);
+ Standard_Integer aSeqId = myLayers.Lower();
for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
{
if (theLayersToProcess == OpenGl_LF_Bottom)
{
- if (aSeqId >= aMainId) continue;
+ if (aSeqId >= myDefaultLayerIndex) continue;
}
else if (theLayersToProcess == OpenGl_LF_Upper)
{
- if (aSeqId <= aMainId) continue;
+ if (aSeqId <= myDefaultLayerIndex) continue;
}
else if (theLayersToProcess == OpenGl_LF_Default)
{
- if (aSeqId != aMainId) continue;
+ if (aSeqId != myDefaultLayerIndex) continue;
}
const OpenGl_Layer& aLayer = anIts.Value();
typedef NCollection_Sequence<OpenGl_Layer> OpenGl_SequenceOfLayers;
typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
+//! Class defining the list of layers.
class OpenGl_LayerList
{
public:
void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId);
//! Returns structure modification state (for ray-tracing).
- Standard_Size ModificationState() const { return myModificationState; }
+ Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; }
protected:
// number of structures temporary put to default layer
OpenGl_SequenceOfLayers myLayers;
OpenGl_LayerSeqIds myLayerIds;
+ Standard_Integer myDefaultLayerIndex; //!< index of Graphic3d_ZLayerId_Default layer in myLayers sequence
Standard_Integer myNbPriorities;
Standard_Integer myNbStructures;
Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers
- mutable Standard_Size myModificationState;
+ mutable Standard_Size myModifStateOfRaytraceable;
public: