Files
test/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.cpp
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00

88 lines
1.8 KiB
C++

/* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup freestyle
* \brief Class to display textual information about a scene graph.
*/
#include <iomanip>
#include "IndexedFaceSet.h"
#include "ScenePrettyPrinter.h"
namespace Freestyle {
#define VISIT(CLASS) \
void ScenePrettyPrinter::visit##CLASS(CLASS &) \
{ \
_ofs << _space << #CLASS << endl; \
}
VISIT(Node)
VISIT(NodeShape)
VISIT(NodeGroup)
VISIT(NodeLight)
VISIT(NodeDrawingStyle)
VISIT(NodeTransform)
void ScenePrettyPrinter::visitNodeShapeBefore(NodeShape &UNUSED(shape))
{
increaseSpace();
}
void ScenePrettyPrinter::visitNodeShapeAfter(NodeShape &UNUSED(shape))
{
decreaseSpace();
}
void ScenePrettyPrinter::visitNodeGroupBefore(NodeGroup &UNUSED(group))
{
increaseSpace();
}
void ScenePrettyPrinter::visitNodeGroupAfter(NodeGroup &UNUSED(group))
{
decreaseSpace();
}
void ScenePrettyPrinter::visitNodeDrawingStyleBefore(NodeDrawingStyle &UNUSED(style))
{
increaseSpace();
}
void ScenePrettyPrinter::visitNodeDrawingStyleAfter(NodeDrawingStyle &UNUSED(style))
{
decreaseSpace();
}
void ScenePrettyPrinter::visitNodeTransformBefore(NodeTransform &UNUSED(transform))
{
increaseSpace();
}
void ScenePrettyPrinter::visitNodeTransformAfter(NodeTransform &UNUSED(transform))
{
decreaseSpace();
}
VISIT(LineRep)
VISIT(OrientedLineRep)
VISIT(TriangleRep)
VISIT(VertexRep)
void ScenePrettyPrinter::visitIndexedFaceSet(IndexedFaceSet &ifs)
{
const float *vertices = ifs.vertices();
unsigned vsize = ifs.vsize();
_ofs << _space << "IndexedFaceSet" << endl;
const float *p = vertices;
for (unsigned int i = 0; i < vsize / 3; i++) {
_ofs << _space << " " << setw(3) << setfill('0') << i << ": " << p[0] << ", " << p[1] << ", "
<< p[2] << endl;
p += 3;
}
}
} /* namespace Freestyle */