1 | /* |
2 | Open Asset Import Library (assimp) |
3 | ---------------------------------------------------------------------- |
4 | |
5 | Copyright (c) 2006-2017, assimp team |
6 | |
7 | All rights reserved. |
8 | |
9 | Redistribution and use of this software in source and binary forms, |
10 | with or without modification, are permitted provided that the |
11 | following conditions are met: |
12 | |
13 | * Redistributions of source code must retain the above |
14 | copyright notice, this list of conditions and the |
15 | following disclaimer. |
16 | |
17 | * Redistributions in binary form must reproduce the above |
18 | copyright notice, this list of conditions and the |
19 | following disclaimer in the documentation and/or other |
20 | materials provided with the distribution. |
21 | |
22 | * Neither the name of the assimp team, nor the names of its |
23 | contributors may be used to endorse or promote products |
24 | derived from this software without specific prior |
25 | written permission of the assimp team. |
26 | |
27 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
28 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
29 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
30 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
31 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
32 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
33 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
34 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
35 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
36 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
37 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
38 | |
39 | @author: Richard Steffen, 2014 |
40 | |
41 | ---------------------------------------------------------------------- |
42 | */ |
43 | |
44 | /** @file StepExporter.h |
45 | * Declares the exporter class to write a scene to a Collada file |
46 | */ |
47 | #ifndef AI_STEPEXPORTER_H_INC |
48 | #define AI_STEPEXPORTER_H_INC |
49 | |
50 | #include <assimp/ai_assert.h> |
51 | #include <assimp/matrix4x4.h> |
52 | #include <assimp/Exporter.hpp> |
53 | #include <sstream> |
54 | |
55 | |
56 | struct aiScene; |
57 | struct aiNode; |
58 | |
59 | namespace Assimp |
60 | { |
61 | |
62 | /// Helper class to export a given scene to a StepFile. |
63 | /// Note: an StepFile uses a left hand system. Assimp used a right hand system (OpenGL), therefore we have to transform everything |
64 | class StepExporter |
65 | { |
66 | public: |
67 | /// Constructor for a specific scene to export |
68 | StepExporter(const aiScene* pScene, IOSystem* pIOSystem, const std::string& path, const std::string& file, const ExportProperties* pProperties); |
69 | |
70 | protected: |
71 | /// Starts writing the contents |
72 | void WriteFile(); |
73 | |
74 | public: |
75 | |
76 | /// Stringstream to write all output into |
77 | std::stringstream mOutput; |
78 | |
79 | protected: |
80 | |
81 | /// hold the properties pointer |
82 | const ExportProperties* mProperties; |
83 | |
84 | /// The IOSystem for output |
85 | IOSystem* mIOSystem; |
86 | |
87 | /// Name of the file (without extension) where the scene will be exported |
88 | std::string mFile; |
89 | |
90 | /// Path of the directory where the scene will be exported |
91 | std::string mPath; |
92 | |
93 | /// The scene to be written |
94 | const aiScene* mScene; |
95 | |
96 | /// current line end string for simple stream insertion |
97 | std::string endstr; |
98 | |
99 | /// accumultated transformations for nodes |
100 | std::map<const aiNode*, aiMatrix4x4> trafos; |
101 | |
102 | /// map to all meshed of nodes |
103 | typedef std::multimap<const aiNode*, unsigned int> MeshesByNodeMap; |
104 | MeshesByNodeMap meshes; |
105 | |
106 | }; |
107 | |
108 | } |
109 | |
110 | #endif // !! AI_STEPEXPORTER_H_INC |
111 | |