OpenGl_ShaderManager.cxx
OpenGl_ShaderStates.hxx
OpenGl_ShaderStates.cxx
-OpenGl_SequenceOfStructure.hxx
Handle_OpenGl_ShaderObject.hxx
Handle_OpenGl_ShaderProgram.hxx
Handle_OpenGl_ShaderManager.hxx
// function : Assign
// purpose :
// =======================================================================
-void OpenGl_BVHClipPrimitiveSet::Assign (const OpenGl_ArrayOfStructure& theStructs)
+void OpenGl_BVHClipPrimitiveSet::Assign (const OpenGl_ArrayOfIndexedMapOfStructure& theStructs)
{
myStructs.Clear();
for (Standard_Integer aPriorityIdx = 0, aNbPriorities = theStructs.Length(); aPriorityIdx < aNbPriorities; ++aPriorityIdx)
{
- for (OpenGl_SequenceOfStructure::Iterator aStructIter (theStructs (aPriorityIdx)); aStructIter.More(); aStructIter.Next())
+ for (OpenGl_IndexedMapOfStructure::Iterator aStructIter (theStructs (aPriorityIdx)); aStructIter.More(); aStructIter.Next())
{
const OpenGl_Structure* aStruct = aStructIter.Value();
#include <NCollection_IndexedMap.hxx>
#include <OpenGl_Structure.hxx>
-#include <OpenGl_SequenceOfStructure.hxx>
-typedef NCollection_Array1<OpenGl_SequenceOfStructure> OpenGl_ArrayOfStructure;
+//! Defines index map of OpenGL structures.
+typedef NCollection_IndexedMap<const OpenGl_Structure*> OpenGl_IndexedMapOfStructure;
+
+//! Defines array of indexed maps of OpenGL structures.
+typedef NCollection_Array1<OpenGl_IndexedMapOfStructure> OpenGl_ArrayOfIndexedMapOfStructure;
//! Set of OpenGl_Structures for building BVH tree.
class OpenGl_BVHClipPrimitiveSet : public BVH_PrimitiveSet<Standard_ShortReal, 4>
//! Replaces the set by the given array taking into account
//! if each structure is cullable or not.
- void Assign (const OpenGl_ArrayOfStructure& theStructs);
+ void Assign (const OpenGl_ArrayOfIndexedMapOfStructure& theStructs);
//! Adds structure to the set.
void Add (const OpenGl_Structure* theStruct);
return;
}
- myArray (anIndex).Append (theStruct);
+ myArray (anIndex).Add (theStruct);
if (theStruct->IsAlwaysRendered())
{
theStruct->MarkAsNotCulled();
const Standard_Integer aNbPriorities = myArray.Length();
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{
- OpenGl_SequenceOfStructure& aSeq = myArray (aPriorityIter);
- for (OpenGl_SequenceOfStructure::Iterator aStructIter (aSeq); aStructIter.More(); aStructIter.Next())
+ OpenGl_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
+
+ const Standard_Integer anIndex = aStructures.FindIndex (theStruct);
+ if (anIndex != 0)
{
- if (aStructIter.Value() == theStruct)
+ aStructures.Swap (anIndex, aStructures.Size());
+ aStructures.RemoveLast();
+
+ if (!theStruct->IsAlwaysRendered()
+ && !isForChangePriority)
{
- aSeq.Remove (aStructIter);
- if (!theStruct->IsAlwaysRendered()
- && !isForChangePriority)
- {
- myBVHPrimitives.Remove (theStruct);
- }
- --myNbStructures;
- thePriority = aPriorityIter;
- return true;
+ myBVHPrimitives.Remove (theStruct);
}
+ --myNbStructures;
+ thePriority = aPriorityIter;
+ return true;
}
}
const Standard_Integer aViewId = theWorkspace->ActiveViewId();
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{
- for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
+ const OpenGl_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
+ for (Standard_Integer aStructIdx = 1; aStructIdx <= aStructures.Size(); ++aStructIdx)
{
- const OpenGl_Structure* aStruct = aStructIter.Value();
+ const OpenGl_Structure* aStruct = aStructures.FindKey (aStructIdx);
if (!aStruct->IsVisible())
{
continue;
const Standard_Integer aViewId = theWorkspace->ActiveViewId();
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{
- for (OpenGl_SequenceOfStructure::Iterator aStructIter (myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
+ const OpenGl_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);
+ for (Standard_Integer aStructIdx = 1; aStructIdx <= aStructures.Size(); ++aStructIdx)
{
- const OpenGl_Structure* aStruct = aStructIter.Value();
+ const OpenGl_Structure* aStruct = aStructures.FindKey (aStructIdx);
if (!aStruct->IsVisible()
|| aStruct->IsCulled())
{
// add all structures to destination priority list
for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
{
- for (OpenGl_SequenceOfStructure::Iterator aStructIter (theOther.myArray (aPriorityIter)); aStructIter.More(); aStructIter.Next())
+ const OpenGl_IndexedMapOfStructure& aStructures = theOther.myArray (aPriorityIter);
+ for (Standard_Integer aStructIdx = 1; aStructIdx <= aStructures.Size(); ++aStructIdx)
{
- Add (aStructIter.Value(), aPriorityIter);
+ Add (aStructures.FindKey (aStructIdx), aPriorityIter);
}
}
Standard_Boolean Append (const OpenGl_Layer& theOther);
//! Returns array of OpenGL structures.
- const OpenGl_ArrayOfStructure& ArrayOfStructures() const { return myArray; }
+ const OpenGl_ArrayOfIndexedMapOfStructure& ArrayOfStructures() const { return myArray; }
//! Marks BVH tree for given priority list as dirty and
//! marks primitive set for rebuild.
private:
- OpenGl_ArrayOfStructure myArray;
- Standard_Integer myNbStructures;
- Graphic3d_ZLayerSettings myLayerSettings; //!< Layer setting flags
- mutable OpenGl_BVHClipPrimitiveSet myBVHPrimitives; //<! Set of OpenGl_Structures for building BVH tree
- mutable Standard_Boolean myBVHIsLeftChildQueuedFirst; //<! Is needed for implementation of stochastic order of BVH traverse
- mutable Standard_Boolean myIsBVHPrimitivesNeedsReset; //<! Defines if the primitive set for BVH is outdated
+ OpenGl_ArrayOfIndexedMapOfStructure myArray;
+ Standard_Integer myNbStructures;
+ Graphic3d_ZLayerSettings myLayerSettings; //!< Layer setting flags
+ mutable OpenGl_BVHClipPrimitiveSet myBVHPrimitives; //!< Set of OpenGl_Structures for building BVH tree
+ mutable Standard_Boolean myBVHIsLeftChildQueuedFirst; //!< Is needed for implementation of stochastic order of BVH traverse
+ mutable Standard_Boolean myIsBVHPrimitivesNeedsReset; //!< Defines if the primitive set for BVH is outdated
public:
+++ /dev/null
-// Created on: 2014-12-18
-// Created by: Kirill Gavrilov
-// Copyright (c) 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 _OpenGl_SequenceOfStructure
-#define _OpenGl_SequenceOfStructure
-
-#include <NCollection_Sequence.hxx>
-
-class OpenGl_Structure;
-typedef NCollection_Sequence<const OpenGl_Structure*> OpenGl_SequenceOfStructure;
-
-#endif // _OpenGl_SequenceOfStructure
void InvalidateBVHData (const Standard_Integer theLayerId);
//! Returns list of immediate structures rendered on top of main presentation
- const OpenGl_SequenceOfStructure& ImmediateStructures() const
+ const OpenGl_IndexedMapOfStructure& ImmediateStructures() const
{
return myImmediateList;
}
//View_LABDepthCueing - fixed index used
- OpenGl_LayerList myZLayers; //!< main list of displayed structure, sorted by layers
- OpenGl_SequenceOfStructure myImmediateList; //!< list of immediate structures rendered on top of main presentation
+ OpenGl_LayerList myZLayers; //!< main list of displayed structure, sorted by layers
+ OpenGl_IndexedMapOfStructure myImmediateList; //!< list of immediate structures rendered on top of main presentation
const TEL_TRANSFORM_PERSISTENCE *myTransPers;
Standard_Boolean myIsTransPers;
void OpenGl_View::DisplayImmediateStructure (const Handle(Graphic3d_Structure)& theStructure)
{
const OpenGl_Structure* aStruct = reinterpret_cast<const OpenGl_Structure*> (theStructure->CStructure().operator->());
- for (OpenGl_SequenceOfStructure::Iterator anIter (myImmediateList);
- anIter.More(); anIter.Next())
- {
- if (anIter.Value() == aStruct)
- {
- return;
- }
- }
-
- myImmediateList.Append (aStruct);
+ myImmediateList.Add (aStruct);
}
//=======================================================================
void OpenGl_View::EraseImmediateStructure (const OpenGl_Structure* theStructure)
{
- for (OpenGl_SequenceOfStructure::Iterator anIter (myImmediateList);
- anIter.More(); anIter.Next())
+ const Standard_Integer anIndex = myImmediateList.FindIndex (theStructure);
+
+ if (anIndex != 0)
{
- if (anIter.Value() == theStructure)
- {
- myImmediateList.Remove (anIter);
- return;
- }
+ myImmediateList.Swap (myImmediateList.Size(), anIndex);
+ myImmediateList.RemoveLast();
}
}
if (aLayer.NbStructures() != 0)
{
- const OpenGl_ArrayOfStructure& aStructArray = aLayer.ArrayOfStructures();
+ const OpenGl_ArrayOfIndexedMapOfStructure& aStructArray = aLayer.ArrayOfStructures();
for (Standard_Integer anIndex = 0; anIndex < aStructArray.Length(); ++anIndex)
{
- for (OpenGl_SequenceOfStructure::Iterator aStructIt (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
+ for (OpenGl_IndexedMapOfStructure::Iterator aStructIt (aStructArray (anIndex)); aStructIt.More(); aStructIt.Next())
{
const OpenGl_Structure* aStructure = aStructIt.Value();
{
glDisable (GL_DEPTH_TEST);
}
- for (OpenGl_SequenceOfStructure::Iterator anIter (myView->ImmediateStructures());
- anIter.More(); anIter.Next())
+ for (OpenGl_IndexedMapOfStructure::Iterator anIter (myView->ImmediateStructures()); anIter.More(); anIter.Next())
{
const OpenGl_Structure* aStructure = anIter.Value();
if (!aStructure->IsVisible())