Blender  V2.93
SceneHash.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
23 #include "IndexedFaceSet.h"
24 #include "NodeCamera.h"
25 #include "NodeViewLayer.h"
26 #include "SceneVisitor.h"
27 
28 #include "BLI_sys_types.h"
29 
30 #ifdef WITH_CXX_GUARDEDALLOC
31 # include "MEM_guardedalloc.h"
32 #endif
33 
34 namespace Freestyle {
35 
36 class SceneHash : public SceneVisitor {
37  public:
38  inline SceneHash() : SceneVisitor()
39  {
40  _sum = 1;
41  }
42 
43  virtual ~SceneHash()
44  {
45  }
46 
50 
51  string toString();
52 
53  inline bool match()
54  {
55  return _sum == _prevSum;
56  }
57 
58  inline void store()
59  {
60  _prevSum = _sum;
61  }
62 
63  inline void reset()
64  {
65  _sum = 1;
66  }
67 
68  private:
69  void adler32(const unsigned char *data, int size);
70 
71  uint32_t _sum;
72  uint32_t _prevSum;
73 
74 #ifdef WITH_CXX_GUARDEDALLOC
75  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneHash")
76 #endif
77 };
78 
79 } /* namespace Freestyle */
A Set of indexed faces to represent a surface object.
Read Guarded memory(de)allocation.
Class to represent a light node.
Class to represent a view layer in Blender.
Class to visit (without doing anything) a scene graph structure.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
VISIT_DECL(NodeViewLayer)
VISIT_DECL(NodeCamera)
virtual ~SceneHash()
Definition: SceneHash.h:43
VISIT_DECL(IndexedFaceSet)
inherits from class Rep
Definition: AppCanvas.cpp:32
unsigned int uint32_t
Definition: stdint.h:83