OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
collada_exporter.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GFX_COLLADA_EXPORTER_HH
20 #define OST_GFX_COLLADA_EXPORTER_HH
21 
22 /*
23  Author: Ansgar Philippsen
24 */
25 
26 #include <string>
27 #include <fstream>
28 #include <vector>
29 
30 #include "module_config.hh"
31 #include "exporter.hh"
32 
33 namespace ost { namespace gfx {
34 
36 {
37 public:
38  ColladaExporter(const std::string& collada_file, float scale=1.0);
39  virtual ~ColladaExporter();
40 
41  // exporter interface
42  virtual void SceneStart(const Scene* scene);
43  virtual void SceneEnd(const Scene* scene);
44  virtual void NodeStart(const std::string& name, NodeType t);
45  virtual void NodeEnd(const std::string& name);
46  virtual void WriteVertexData(const float* v, const float* n, const float* c, const float* t,
47  size_t stride, size_t count);
48  virtual void WritePointData(const unsigned int* i, size_t count);
49  virtual void WriteLineData(const unsigned int* ij, size_t count);
50  virtual void WriteTriData(const unsigned int* ijk, size_t count);
51  virtual void WriteQuadData(const unsigned int* ijkl, size_t count);
52 
53 private:
54  std::string file_;
55  std::ofstream out_;
56  float scale_;
57  std::vector<std::string> obj_;
58 };
59 
60 }} // ns
61 
62 #endif