ATLAS Offline Software
VP1ExtraSepLayerHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef VP1EXTRASEPLAYERHELPER_H
6 #define VP1EXTRASEPLAYERHELPER_H
7 
8 class SoNode;
9 class SoSeparator;
10 class SoMaterial;
11 
12 //When a large number of nodes are to be placed under a given
13 //separator ("topsep"), in an order which does not matter, it can
14 //potentially be much more performant (3D rendering wise) to add a
15 //layer of extra separators below topsep, each with, say, 32, of the
16 //nodes. Caching works a lot better this way.
17 //
18 //NB: It is assumed that you never call
19 //addChild/removeChild/removeAllChildren directly on topsep (at least
20 //not before the instance of VP1ExtraSepLayerHelper is deleted again).
21 
23 public:
24 
25  VP1ExtraSepLayerHelper( SoSeparator* topsep, int numberOfNodesPerExtraSep = 32 );
27 
28  SoSeparator * topSeparator() const;
29  int numberOfNodesPerExtraSep() const;
30 
31  //For efficiency these next two do NOT do any error checking in opt builds!
32  void addNode(SoNode*); //Adds node as a grandchild of topsep (under relevant extra separator)
33  void removeNode(SoNode*);//Removes node (and reshuffles contents of extra separators as necessay).
34 
35  //To avoid propagating notifications needlessly (always call first ...Begin then ...End):
36  void largeChangesBegin();//Disables notifications on topsep
37  void largeChangesEnd();//Restores previous notifications enabled state on topsep and touches it.
38 
39  //By using the following methods, the node is ensured to be placed in
40  //the tree such that the passed material is the last material node
41  //in front of it (the point is that several nodes can share a
42  //material while the material is only placed once in the graph -
43  //thus leading to potentially large gains in rendering performance.
44  void addNodeUnderMaterial(SoNode*,SoMaterial*);
45  void removeNodeUnderMaterial(SoNode*,SoMaterial*);
46  void moveNodeToNewMaterial(SoNode*,SoMaterial* oldmat,SoMaterial* newmat);
47 
48 private:
49 
50  // It is illegal to copy/assign a VP1ExtraSepLayerHelper:
53 
54  class Imp;
55  Imp * m_d;
56 
57 };
58 
59 #endif
VP1ExtraSepLayerHelper::numberOfNodesPerExtraSep
int numberOfNodesPerExtraSep() const
Definition: VP1ExtraSepLayerHelper.cxx:184
VP1ExtraSepLayerHelper::removeNode
void removeNode(SoNode *)
Definition: VP1ExtraSepLayerHelper.cxx:95
VP1ExtraSepLayerHelper::Imp
Definition: VP1ExtraSepLayerHelper.cxx:14
VP1ExtraSepLayerHelper::addNodeUnderMaterial
void addNodeUnderMaterial(SoNode *, SoMaterial *)
Definition: VP1ExtraSepLayerHelper.cxx:190
VP1ExtraSepLayerHelper::removeNodeUnderMaterial
void removeNodeUnderMaterial(SoNode *, SoMaterial *)
Definition: VP1ExtraSepLayerHelper.cxx:216
VP1ExtraSepLayerHelper::VP1ExtraSepLayerHelper
VP1ExtraSepLayerHelper(SoSeparator *topsep, int numberOfNodesPerExtraSep=32)
Definition: VP1ExtraSepLayerHelper.cxx:33
VP1ExtraSepLayerHelper::moveNodeToNewMaterial
void moveNodeToNewMaterial(SoNode *, SoMaterial *oldmat, SoMaterial *newmat)
Definition: VP1ExtraSepLayerHelper.cxx:231
VP1ExtraSepLayerHelper::VP1ExtraSepLayerHelper
VP1ExtraSepLayerHelper(const VP1ExtraSepLayerHelper &)
VP1ExtraSepLayerHelper
Definition: VP1ExtraSepLayerHelper.h:22
VP1ExtraSepLayerHelper::largeChangesEnd
void largeChangesEnd()
Definition: VP1ExtraSepLayerHelper.cxx:156
VP1ExtraSepLayerHelper::largeChangesBegin
void largeChangesBegin()
Definition: VP1ExtraSepLayerHelper.cxx:135
VP1ExtraSepLayerHelper::m_d
Imp * m_d
Definition: VP1ExtraSepLayerHelper.h:54
VP1ExtraSepLayerHelper::addNode
void addNode(SoNode *)
Definition: VP1ExtraSepLayerHelper.cxx:54
VP1ExtraSepLayerHelper::operator=
VP1ExtraSepLayerHelper & operator=(const VP1ExtraSepLayerHelper &)
VP1ExtraSepLayerHelper::~VP1ExtraSepLayerHelper
~VP1ExtraSepLayerHelper()
Definition: VP1ExtraSepLayerHelper.cxx:40
VP1ExtraSepLayerHelper::topSeparator
SoSeparator * topSeparator() const
Definition: VP1ExtraSepLayerHelper.cxx:178