Mondschein Engine  0.3.0
buffer.h
1 #ifndef MBD_BUFFER_H_INCLUDED
2 #define MBD_BUFFER_H_INCLUDED
3 
4 /* Mondschein Engine is a fast, powerful, and easy-to-use 3D realtime rendering engine.
5  *
6  * Copyright (C) 2009-2013 by Andreas Amereller
7  * E-Mail: andreas.amereller.dev@googlemail.com
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the Free
11  * Software Foundation; either version 3 of the License, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but WITHOUT
15  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17  * more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
24 
25 #include "mbd_types.h"
26 #include "mbd/mbd.pb.h"
27 #include "core/buffer.h"
28 #include "core/camera.h"
29 #include "core/light.h"
30 #include "core/material.h"
31 #include "core/mesh.h"
32 #include "core/pose.h"
33 #include "core/texture.h"
34 #include "core/scenegraph.h"
35 #include "core/beziercurve.h"
36 #include "core/bezierpatch.h"
37 #include "core/nurbscurve.h"
38 #include "core/nurbspatch.h"
39 
40 namespace mondschein
41 {
42  namespace io
43  {
47  class MBD_Buffer : virtual public Buffer
48  {
49  private:
50  const std::string version;
51  bool check_version(const std::string &_version) const;
52  void parse_pb(const mbd::data &_data);
53  void parse_camera(const mbd::data_camera &_pb,io_objects_t &_io);
54  void parse_light(const mbd::data_light &_pb,io_objects_t &_io);
55  void parse_material(const mbd::data_material &_pb,io_objects_t &_io);
56  void parse_mesh(const mbd::data_mesh &_pb,io_objects_t &_io);
57  void parse_pose(const mbd::data_pose &_pb,io_objects_t &_io);
58  void parse_texture(const mbd::data_texture &_pb,io_objects_t &_io);
59  void parse_scenegraph(const mbd::data_scenegraph &_pb,io_objects_t &_io);
60  void parse_beziercurve(const mbd::data_beziercurve &_pb,io_objects_t &_io);
61  void parse_bezierpatch(const mbd::data_bezierpatch &_pb,io_objects_t &_io);
62  void parse_nurbscurve(const mbd::data_nurbscurve &_pb,io_objects_t &_io);
63  void parse_nurbspatch(const mbd::data_nurbspatch &_pb,io_objects_t &_io);
64  math::Beziercurve_p generate_beziercurve(const mbd::data_beziercurve &_pb);
65  math::NURBScurve_p generate_nurbscurve(const mbd::data_nurbscurve &_pb);
66 
67  public:
68  MBD_Buffer();
69  MBD_Buffer(MBD_Buffer_c _b);
70  virtual ~MBD_Buffer();
71  virtual MBD_Buffer &operator=(MBD_Buffer_c _b);
72 
73  virtual void parse_istream(std::istream &_in);
74  virtual void parse_string(const std::string &_in);
75  virtual void serialize_ostream(std::ostream &_out) const;
76  virtual void serialize_string(std::string &_out) const;
77  };
78  }
79 }
80 #endif // MBD_BUFFER_H_INCLUDED