ATLAS Offline Software
Loading...
Searching...
No Matches
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
8class SoNode;
9class SoSeparator;
10class 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
23public:
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
48private:
49
50 // It is illegal to copy/assign a VP1ExtraSepLayerHelper:
53
54 class Imp;
56
57};
58
59#endif
void removeNodeUnderMaterial(SoNode *, SoMaterial *)
VP1ExtraSepLayerHelper(const VP1ExtraSepLayerHelper &)
void moveNodeToNewMaterial(SoNode *, SoMaterial *oldmat, SoMaterial *newmat)
VP1ExtraSepLayerHelper & operator=(const VP1ExtraSepLayerHelper &)
VP1ExtraSepLayerHelper(SoSeparator *topsep, int numberOfNodesPerExtraSep=32)
void addNodeUnderMaterial(SoNode *, SoMaterial *)
SoSeparator * topSeparator() const