blender-geom-writer.h
Go to the documentation of this file.
1 //
2 // transform-writer.h
3 // gepetto-viewer
4 //
5 // Created by Joseph Mirabel in November 2015.
6 // Copyright (c) 2015 LAAS-CNRS. All rights reserved.
7 //
8 
9 #ifndef GEPETTO_VIEWER_BLENDER_GEOM_WRITER_VISITOR_HH
10 #define GEPETTO_VIEWER_BLENDER_GEOM_WRITER_VISITOR_HH
11 
12 #include <iostream>
13 #include <fstream>
14 #include <stack>
17 
18 namespace gepetto {
19 namespace viewer {
20 
22 
24  {
25  public:
26  BlenderGeomWriterVisitor (const std::string& filename);
27 
28  // virtual ~BlenderGeomWriter () {}
29 
30  void apply (Node& node);
31  void apply (GroupNode& node);
32  void apply (LeafNodeArrow& node);
33  void apply (LeafNodeBox& node);
34  void apply (LeafNodeCapsule& node);
35  void apply (LeafNodeCollada& node);
36  void apply (LeafNodeCone& node);
37  void apply (LeafNodeCylinder& node);
38  void apply (LeafNodeFace& node);
39  void apply (LeafNodeGround& node);
40  void apply (LeafNodeLight& node);
41  void apply (LeafNodeLine& node);
42  void apply (LeafNodeSphere& node);
43  void apply (LeafNodeXYZAxis& node);
44 
45  protected:
46  std::ofstream& out () { return file_; }
47 
48  // The scale multiplier is requited for LeafNodeBox
49  void standardApply (Node& node, osgVector3 scaleMultiplier = osgVector3(1,1,1));
50 
51  bool openFile ();
52  void closeFile () {
53  file_.close ();
54  }
55  void unimplemented(const char* type, Node& n);
56 
57  std::ofstream file_;
58  std::string filename_;
59  unsigned int nodeCount_;
60  std::size_t groupDepth_;
61  };
62 } /* namespace viewer */
63 } /* namespace gepetto */
64 
65 #endif /* GEPETTO_VIEWER_BLENDER_GEOM_WRITER_VISITOR_HH */
Definition: leaf-node-xyzaxis.h:21
Definition: leaf-node-collada.h:21
unsigned int nodeCount_
Definition: blender-geom-writer.h:59
::osg::Vec3f osgVector3
Definition: config-osg.h:109
Definition: leaf-node-cone.h:19
std::string filename_
Definition: blender-geom-writer.h:58
Definition: leaf-node-ground.h:18
Definition: leaf-node-light.h:20
void closeFile()
Definition: blender-geom-writer.h:52
Definition: leaf-node-box.h:19
Definition: node-visitor.h:35
Definition: leaf-node-face.h:20
Definition: action-search-bar.hh:27
std::ofstream & out()
Definition: blender-geom-writer.h:46
Definition: leaf-node-cylinder.h:19
Definition: leaf-node-line.h:18
Definition: blender-geom-writer.h:23
Definition: leaf-node-sphere.h:19
Definition: leaf-node-capsule.h:21
#define DEF_CLASS_SMART_PTR(className)
Definition: macros.h:50
Definition: group-node.h:19
std::ofstream file_
Definition: blender-geom-writer.h:57
std::size_t groupDepth_
Definition: blender-geom-writer.h:60
Abstract base class of 3D objects in a scene.
Definition: node.h:27
Definition: leaf-node-arrow.h:20