-
Notifications
You must be signed in to change notification settings - Fork 2
/
vtkOsgConverter.h
58 lines (47 loc) · 1.23 KB
/
vtkOsgConverter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* \file vtkOsgConverter.h
* 27/07/2011 LB Initial implementation
* Derived from class vtkOsgActor from Bjoern Zehner
*/
#ifndef VTKOSGCONVERTER_H
#define VTKOSGCONVERTER_H
#include <OpenSG/OSGChunkMaterial.h>
#include <OpenSG/OSGNode.h>
#include <OpenSG/OSGRefPtr.h>
#include <OpenSG/OSGTextureChunk.h>
#include <OpenSG/OSGTransform.h>
class vtkActor;
class vtkMapper;
class vtkTexture;
/// @brief Converts a vtkActor to an OpenSG-Node.
/// Example usage:
///
/// @code
/// vtkOsgConverter* osgConverter = new vtkOsgConverter(aVtkActor);
/// if(osgConverter->convert())
/// {
/// beginEditCP(rootNode);
/// rootNode->addChild(osgConverter->getNode());
/// endEditCP(rootNode);
/// }
/// @endcode
class vtkOsgConverter
{
public:
vtkOsgConverter(vtkActor* actor);
virtual ~vtkOsgConverter();
bool convert();
void SetVerbose(bool value);
OSG::NodePtr getNode();
protected:
private:
vtkActor* _actor;
enum {NOT_GIVEN, PER_VERTEX, PER_CELL};
bool _verbose;
//For the translation to OpenSG
OSG::RefPtr<OSG::NodePtr> _osgRoot;
OSG::RefPtr<OSG::TransformPtr> _osgTransform;
OSG::TextureChunkPtr CreateTexture(vtkTexture* vtkTexture);
OSG::ChunkMaterialPtr CreateMaterial(bool lit, bool hasTexCoords);
};
#endif // VTKOSGCONVERTER_H