| Line |
Branch |
Exec |
Source |
| 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 <gepetto/viewer/config-osg.h> |
| 13 |
|
|
#include <gepetto/viewer/node-visitor.h> |
| 14 |
|
|
|
| 15 |
|
|
#include <fstream> |
| 16 |
|
|
#include <iostream> |
| 17 |
|
|
#include <stack> |
| 18 |
|
|
|
| 19 |
|
|
namespace gepetto { |
| 20 |
|
|
namespace viewer { |
| 21 |
|
|
|
| 22 |
|
|
DEF_CLASS_SMART_PTR(BlenderGeomWriterVisitor) |
| 23 |
|
|
|
| 24 |
|
|
class BlenderGeomWriterVisitor : public NodeVisitor { |
| 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, |
| 50 |
|
|
osgVector3 scaleMultiplier = osgVector3(1, 1, 1)); |
| 51 |
|
|
|
| 52 |
|
|
bool openFile(); |
| 53 |
|
|
void closeFile() { file_.close(); } |
| 54 |
|
|
void unimplemented(const char* type, Node& n); |
| 55 |
|
|
|
| 56 |
|
|
std::ofstream file_; |
| 57 |
|
|
std::string filename_; |
| 58 |
|
|
unsigned int nodeCount_; |
| 59 |
|
|
std::size_t groupDepth_; |
| 60 |
|
|
}; |
| 61 |
|
|
} /* namespace viewer */ |
| 62 |
|
|
} /* namespace gepetto */ |
| 63 |
|
|
|
| 64 |
|
|
#endif /* GEPETTO_VIEWER_BLENDER_GEOM_WRITER_VISITOR_HH */ |
| 65 |
|
|
|