forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkOBJImporter.h
96 lines (79 loc) · 2.78 KB
/
vtkOBJImporter.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*=========================================================================
Program: Visualization Toolkit
Module: vtkOBJImporter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkOBJImporter
* @brief import from .obj wavefront files
*
* from Wavefront .obj & associated .mtl files.
* @par Thanks - Peter Karasev (Georgia Tech / Keysight Technologies Inc),:
* Allen Tannenbaum (SUNY Stonybrook), Patricio Vela (Georgia Tech)
* @sa
* vtkImporter
*/
#ifndef vtkOBJImporter_h
#define vtkOBJImporter_h
#include "vtkIOImportModule.h" // For export macro
#include "vtkSmartPointer.h"
#include "vtkImporter.h"
class vtkRenderWindow;
class vtkRenderer;
class vtkPolydata;
class vtkOBJPolyDataProcessor;
/** @note{updated by peter karasev, 2015 to read texture coordinates + material properties}
@note{An example of a supported (*).mtl file is show below.
Lighting values and texture images are specified, and a corresponding vtkActor
with properties and vtkTexture will be created upon import. }
# Wavefront material file saved from Meshlab
newmtl material_0
Ka 0.400000 0.400000 0.400000
Kd 0.5 0.5 0.5
Ks 0.85 0.9 0.9
illum 2
Ns 0.000000
map_Kd map1024.png
newmtl material_1
Ka 0.200000 0.200000 0.200000
Kd 0.666667 0.666667 0.666667
Ks 1.000000 0.9 1.000000
illum 2
Ns 0.000000
map_Kd flare.jpg
**/
class VTKIOIMPORT_EXPORT vtkOBJImporter : public vtkImporter
{
public:
static vtkOBJImporter *New();
vtkTypeMacro(vtkOBJImporter,vtkImporter);
void PrintSelf(ostream& os, vtkIndent indent);
//@{
/**
* Specify the name of the file to read.
*/
void SetFileName(const char* arg);
void SetFileNameMTL(const char* arg);
void SetTexturePath(const char* path);
const char* GetFileName() const;
const char* GetFileNameMTL() const;
const char* GetTexturePath() const;
//@}
protected:
vtkOBJImporter();
~vtkOBJImporter();
virtual int ImportBegin() /*override*/;
virtual void ImportEnd () /*override*/;
virtual void ReadData() /* override */;
vtkSmartPointer<vtkOBJPolyDataProcessor> Impl;
private:
vtkOBJImporter(const vtkOBJImporter&) VTK_DELETE_FUNCTION;
void operator=(const vtkOBJImporter&) VTK_DELETE_FUNCTION;
};
#endif
// VTK-HeaderTest-Exclude: vtkOBJImporter.h