Blender  V2.93
ScenePrettyPrinter.cpp
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 
22 #include <iomanip>
23 
24 #include "IndexedFaceSet.h"
25 #include "ScenePrettyPrinter.h"
26 
27 namespace Freestyle {
28 
29 #define VISIT(CLASS) \
30  void ScenePrettyPrinter::visit##CLASS(CLASS &) \
31  { \
32  _ofs << _space << #CLASS << endl; \
33  }
34 
35 VISIT(Node)
36 VISIT(NodeShape)
37 VISIT(NodeGroup)
38 VISIT(NodeLight)
39 VISIT(NodeDrawingStyle)
40 VISIT(NodeTransform)
41 
42 void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape &UNUSED(shape))
43 {
44  increaseSpace();
45 }
46 
48 {
49  decreaseSpace();
50 }
51 
53 {
54  increaseSpace();
55 }
56 
58 {
59  decreaseSpace();
60 }
61 
63 {
64  increaseSpace();
65 }
66 
68 {
69  decreaseSpace();
70 }
71 
73 {
74  increaseSpace();
75 }
76 
78 {
79  decreaseSpace();
80 }
81 
86 
87 void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs)
88 {
89  const float *vertices = ifs.vertices();
90  unsigned vsize = ifs.vsize();
91 
92  _ofs << _space << "IndexedFaceSet" << endl;
93  const float *p = vertices;
94  for (unsigned int i = 0; i < vsize / 3; i++) {
95  _ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", "
96  << p[2] << endl;
97  p += 3;
98  }
99 }
100 
101 } /* namespace Freestyle */
#define UNUSED(x)
A Set of indexed faces to represent a surface object.
#define VISIT(CLASS)
Class to display textual information about a scene graph.
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
virtual const unsigned vsize() const
virtual const float * vertices() const
virtual void visitNodeGroupBefore(NodeGroup &)
virtual void visitNodeDrawingStyleBefore(NodeDrawingStyle &)
virtual void visitNodeDrawingStyleAfter(NodeDrawingStyle &)
virtual void visitNodeShapeAfter(NodeShape &)
virtual void visitNodeGroupAfter(NodeGroup &)
virtual void visitNodeTransformBefore(NodeTransform &)
virtual void visitNodeTransformAfter(NodeTransform &)
inherits from class Rep
Definition: AppCanvas.cpp:32
Definition: node.h:98