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 */
|
2012-12-28 20:21:05 +00:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
|
|
|
|
* \brief Class to build a shape node. It contains a Rep, which is the shape geometry
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "../geometry/BBox.h"
|
|
|
|
|
#include "../geometry/Geom.h"
|
|
|
|
|
|
|
|
|
|
#include "../system/FreestyleConfig.h"
|
|
|
|
|
|
|
|
|
|
#include "FrsMaterial.h"
|
|
|
|
|
#include "Node.h"
|
|
|
|
|
#include "Rep.h"
|
2008-04-30 15:41:54 +00:00
|
|
|
|
|
|
|
|
using namespace std;
|
2013-04-09 00:46:49 +00:00
|
|
|
|
|
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2008-04-30 15:41:54 +00:00
|
|
|
using namespace Geometry;
|
|
|
|
|
|
2014-04-17 14:19:10 +09:00
|
|
|
class NodeShape : public Node {
|
2008-04-30 15:41:54 +00:00
|
|
|
public:
|
2023-03-29 16:50:54 +02:00
|
|
|
inline NodeShape() : Node() {}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
virtual ~NodeShape();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Adds a Rep to the _Shapes list
|
2012-12-28 20:21:05 +00:00
|
|
|
* The delete of the rep is done when it is not used any more by the Scene Manager.
|
|
|
|
|
* So, it must not be deleted by the caller
|
|
|
|
|
*/
|
|
|
|
|
virtual void AddRep(Rep *iRep)
|
|
|
|
|
{
|
2023-08-01 21:15:52 +10:00
|
|
|
if (nullptr == iRep) {
|
2012-12-28 20:21:05 +00:00
|
|
|
return;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2012-12-28 20:21:05 +00:00
|
|
|
_Shapes.push_back(iRep);
|
|
|
|
|
iRep->addRef();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
// updates bbox:
|
|
|
|
|
AddBBox(iRep->bbox());
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Accept the corresponding visitor */
|
2012-12-28 20:21:05 +00:00
|
|
|
virtual void accept(SceneVisitor &v);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Sets the shape material */
|
2012-12-28 20:21:05 +00:00
|
|
|
inline void setFrsMaterial(const FrsMaterial &iMaterial)
|
|
|
|
|
{
|
|
|
|
|
_FrsMaterial = iMaterial;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** accessors */
|
|
|
|
|
/** returns the shape's material */
|
2012-12-28 20:21:05 +00:00
|
|
|
inline FrsMaterial &frs_material()
|
|
|
|
|
{
|
|
|
|
|
return _FrsMaterial;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
inline const vector<Rep *> &shapes()
|
|
|
|
|
{
|
|
|
|
|
return _Shapes;
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-04-30 15:41:54 +00:00
|
|
|
private:
|
2021-06-24 15:57:33 +10:00
|
|
|
/** list of shapes */
|
2012-12-28 20:21:05 +00:00
|
|
|
vector<Rep *> _Shapes;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-06-24 15:57:33 +10:00
|
|
|
/** Shape Material */
|
2012-12-28 20:21:05 +00:00
|
|
|
FrsMaterial _FrsMaterial;
|
2008-04-30 15:41:54 +00:00
|
|
|
};
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
} /* namespace Freestyle */
|