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 )
111 for (
int i = 0;
i < 3; ++
i) {
112 boost::hash_combine(
seed,
cp.coord[
i]);
113 boost::hash_combine(
seed,
cp.normal[
i]);
114 boost::hash_combine(
seed,
cp.color[
i]);
116 boost::hash_combine(
seed,
cp.shininess);
117 boost::hash_combine(
seed,
cp.transparency);
205 unsigned int _currentDrawStyle;
207 unsigned int _currentVertexOrdering;
211 void _writeVRML2Header(std::ofstream&
outFile);
213 void _writeVRML2PointSet(std::ofstream&
outFile);
215 void _writeVRML2LineSet(std::ofstream&
outFile);
217 void _writeVRML2FaceSet(std::ofstream&
outFile);
220 int _vecToStr(
const SbVec3f& vec,
char*
buf,
size_t numEntries=0,
size_t currNum=0);
232 static SoCallbackAction::Response preCB(
void *userData,
250 typedef std::vector<COLORED_POINT> pointsVec;
252 typedef std::vector<COLORED_POINT> linesVec;
254 typedef std::vector<COLORED_POINT> trianglesVec;
258 std::vector<pointsVec> _points;
260 std::vector<linesVec> _lines;
262 std::vector<trianglesVec> _triangles;
266 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