2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2014-01-28 23:24:59 +09:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
2014-01-28 23:24:59 +09:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "IndexedFaceSet.h"
|
2014-10-05 00:29:09 +09:00
|
|
|
#include "NodeCamera.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "NodeViewLayer.h"
|
2014-01-28 23:24:59 +09:00
|
|
|
#include "SceneVisitor.h"
|
|
|
|
|
|
2014-10-05 00:29:09 +09:00
|
|
|
#include "BLI_sys_types.h"
|
|
|
|
|
|
2024-11-13 13:39:49 +01:00
|
|
|
#include "MEM_guardedalloc.h"
|
2014-01-28 23:24:59 +09:00
|
|
|
|
|
|
|
|
namespace Freestyle {
|
|
|
|
|
|
|
|
|
|
class SceneHash : public SceneVisitor {
|
|
|
|
|
public:
|
|
|
|
|
inline SceneHash() : SceneVisitor()
|
|
|
|
|
{
|
2014-10-05 00:29:09 +09:00
|
|
|
_sum = 1;
|
2014-01-28 23:24:59 +09:00
|
|
|
}
|
|
|
|
|
|
2023-03-29 16:50:54 +02:00
|
|
|
virtual ~SceneHash() {}
|
2014-01-28 23:24:59 +09:00
|
|
|
|
2019-05-31 23:21:16 +10:00
|
|
|
VISIT_DECL(NodeCamera);
|
|
|
|
|
VISIT_DECL(NodeViewLayer);
|
|
|
|
|
VISIT_DECL(IndexedFaceSet);
|
2014-01-28 23:24:59 +09:00
|
|
|
|
2014-10-05 00:29:09 +09:00
|
|
|
string toString();
|
|
|
|
|
|
|
|
|
|
inline bool match()
|
|
|
|
|
{
|
|
|
|
|
return _sum == _prevSum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void store()
|
|
|
|
|
{
|
|
|
|
|
_prevSum = _sum;
|
2014-01-28 23:24:59 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void reset()
|
|
|
|
|
{
|
2014-10-05 00:29:09 +09:00
|
|
|
_sum = 1;
|
2014-01-28 23:24:59 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2023-07-25 12:51:50 +10:00
|
|
|
void adler32(const uchar *data, int size);
|
2014-10-05 00:29:09 +09:00
|
|
|
|
|
|
|
|
uint32_t _sum;
|
|
|
|
|
uint32_t _prevSum;
|
2014-01-28 23:24:59 +09:00
|
|
|
|
|
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:SceneHash")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} /* namespace Freestyle */
|