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 */
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
#pragma once
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
|
|
|
|
* \brief modifiers...
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
#include "TimeStamp.h"
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2013-05-13 22:58:27 +00:00
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
|
|
|
|
# include "MEM_guardedalloc.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2008-04-30 15:41:54 +00:00
|
|
|
/* ----------------------------------------- *
|
|
|
|
|
* *
|
2012-12-28 20:21:05 +00:00
|
|
|
* modifiers *
|
2008-04-30 15:41:54 +00:00
|
|
|
* *
|
|
|
|
|
* ----------------------------------------- */
|
2012-12-28 20:21:05 +00:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Base class for modifiers.
|
2012-12-28 20:21:05 +00:00
|
|
|
* Modifiers are used in the Operators in order to "mark" the processed Interface1D.
|
2008-04-30 15:41:54 +00:00
|
|
|
*/
|
2012-12-28 20:21:05 +00:00
|
|
|
template<class Edge> struct EdgeModifier : public unary_function<Edge, void> {
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Default construction */
|
2023-03-29 16:50:54 +02:00
|
|
|
EdgeModifier() : unary_function<Edge, void>() {}
|
2012-12-28 20:21:05 +00:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** the () operator */
|
2023-03-29 16:50:54 +02:00
|
|
|
virtual void operator()(Edge &iEdge) {}
|
2013-05-13 22:58:27 +00:00
|
|
|
|
|
|
|
|
#ifdef WITH_CXX_GUARDEDALLOC
|
|
|
|
|
MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:EdgeModifier")
|
|
|
|
|
#endif
|
2008-04-30 15:41:54 +00:00
|
|
|
};
|
|
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Modifier that sets the time stamp of an Interface1D to the time stamp of the system. */
|
2008-04-30 15:41:54 +00:00
|
|
|
template<class Edge> struct TimestampModifier : public EdgeModifier<Edge> {
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Default constructor */
|
2023-03-29 16:50:54 +02:00
|
|
|
TimestampModifier() : EdgeModifier<Edge>() {}
|
2012-12-28 20:21:05 +00:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** The () operator. */
|
2012-12-28 20:21:05 +00:00
|
|
|
virtual void operator()(Edge &iEdge)
|
|
|
|
|
{
|
|
|
|
|
TimeStamp *timestamp = TimeStamp::instance();
|
|
|
|
|
iEdge.setTimeStamp(timestamp->getTimeStamp());
|
|
|
|
|
}
|
2008-04-30 15:41:54 +00:00
|
|
|
};
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
} /* namespace Freestyle */
|