13#ifndef SO_SCENE_WRITER_H
14#define SO_SCENE_WRITER_H
20#include <ThirdPartyWarningsDisable.h>
21#include <Inventor/SoPrimitiveVertex.h>
22#include <Inventor/nodes/SoNode.h>
23#include <Inventor/nodes/SoShape.h>
24#include <Inventor/fields/SoFields.h>
25#include <Inventor/fields/SoSFEnum.h>
26#include <Inventor/engines/SoSubEngine.h>
27#include <Inventor/sensors/SoFieldSensor.h>
28#include <Inventor/sensors/SoNodeSensor.h>
29#include <boost/unordered_map.hpp>
30#include <ThirdPartyWarningsRestore.h>
36#pragma warning(disable : 4018)
109 for (
int i = 0;
i < 3; ++
i) {
110 boost::hash_combine(
seed,
cp.coord[
i]);
111 boost::hash_combine(
seed,
cp.normal[
i]);
112 boost::hash_combine(
seed,
cp.color[
i]);
114 boost::hash_combine(
seed,
cp.shininess);
115 boost::hash_combine(
seed,
cp.transparency);
203 unsigned int _currentDrawStyle;
205 unsigned int _currentVertexOrdering;
209 void _writeVRML2Header(std::ofstream&
outFile);
211 void _writeVRML2PointSet(std::ofstream&
outFile);
213 void _writeVRML2LineSet(std::ofstream&
outFile);
215 void _writeVRML2FaceSet(std::ofstream&
outFile);
218 int _vecToStr(
const SbVec3f& vec,
char*
buf,
size_t numEntries = 0,
size_t currNum = 0);
242 typedef std::vector<COLORED_POINT> pointsVec;
244 typedef std::vector<COLORED_POINT> linesVec;
246 typedef std::vector<COLORED_POINT> trianglesVec;
250 std::vector<pointsVec> _points;
252 std::vector<linesVec> _lines;
254 std::vector<trianglesVec> _triangles;
258 boost::unordered_map<COLORED_POINT, int, hashColoredPoint> _distinctColoredVertices;
Open Inventor engine to write scene representation to file.
SoSFEnum format
format that should be written
SoSFBool bSaveNormals
save or suppress saving of normals
void inputChanged(SoField *) override
Engine dummy implementation.
void writeSimpleVRML2()
write simple VRML 2 format (oko)
SbVec3f const getNormal(const SbVec3f *pVec, const int nIdx)
compute the normal of the given triangle
static void initClass()
initializes this class
static void saveChangedCB(void *data, SoSensor *a)
forward sensor CB to saveChanged()
SoSFNode sceneGraph
Fields.
~SoSceneWriter() override
void formatFileExtension()
set filename field's extension according to format
SoSFString filename
absolute filename of the output file
SoSFBool bNormalPerVertex
save normal per vertex (or only one per facet)
static void getTriIn(void *pData, SoCallbackAction *pAct, const SoPrimitiveVertex *pV1, const SoPrimitiveVertex *pV2, const SoPrimitiveVertex *pV3)
callback function for extracting triangulation from the scene
void writeVecToStlFile(SoMFVec3f *pMVec3f)
STL File format (Stefan Zidowitz)
SoSFBool bUseGlobalColor
save only one color per object
void saveChanged()
save the scene
SoSFBool bColorPerVertex
Format Options for self-coded VRML 2.0.
void evaluate() override
Engine dummy implementation.
SoSFTrigger save
save the scene
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
struct holds point information when VRML_2 output is applied on SGI Inventor scenes
bool operator==(const COLORED_POINT &cp) const
For computing a hash value for a colored point.
size_t operator()(const COLORED_POINT &cp) const