Blender  V2.93
NodeShape.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 
24 #include <vector>
25 
26 #include "../geometry/BBox.h"
27 #include "../geometry/Geom.h"
28 
29 #include "../system/FreestyleConfig.h"
30 
31 #include "FrsMaterial.h"
32 #include "Node.h"
33 #include "Rep.h"
34 
35 using namespace std;
36 
37 namespace Freestyle {
38 
39 using namespace Geometry;
40 
41 class NodeShape : public Node {
42  public:
43  inline NodeShape() : Node()
44  {
45  }
46 
47  virtual ~NodeShape();
48 
53  virtual void AddRep(Rep *iRep)
54  {
55  if (NULL == iRep) {
56  return;
57  }
58  _Shapes.push_back(iRep);
59  iRep->addRef();
60 
61  // updates bbox:
62  AddBBox(iRep->bbox());
63  }
64 
66  virtual void accept(SceneVisitor &v);
67 
69  inline void setFrsMaterial(const FrsMaterial &iMaterial)
70  {
71  _FrsMaterial = iMaterial;
72  }
73 
77  {
78  return _FrsMaterial;
79  }
80 
81  inline const vector<Rep *> &shapes()
82  {
83  return _Shapes;
84  }
85 
86  private:
88  vector<Rep *> _Shapes;
89 
91  FrsMaterial _FrsMaterial;
92 };
93 
94 } /* namespace Freestyle */
Class used to handle materials.
Abstract class for scene graph nodes. Inherits from BaseObject which defines the addRef release mecha...
Base class for all shapes. Inherits from BasicObjects for references counter management (addRef,...
ATTR_WARN_UNUSED_RESULT const BMVert * v
virtual void AddRep(Rep *iRep)
Definition: NodeShape.h:53
const vector< Rep * > & shapes()
Definition: NodeShape.h:81
void setFrsMaterial(const FrsMaterial &iMaterial)
Definition: NodeShape.h:69
FrsMaterial & frs_material()
Definition: NodeShape.h:76
virtual const BBox< Vec3f > & bbox() const
Definition: Rep.h:123
inherits from class Rep
Definition: AppCanvas.cpp:32