NGL  6.5
The NCCA Graphics Library
AbstractSerializer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 Jon Macey
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #ifndef ABSTRACT_SERIALIZER_H_
18 #define ABSTRACT_SERIALIZER_H_
19 #include "Types.h"
22 #include <vector>
23 #include <string>
24 #include <iostream>
25 #include "Colour.h"
26 #include "Mat3.h"
27 #include "Quaternion.h"
28 
29 namespace ngl
30 {
31 class Light;
32 class Plane;
33 class Mat3;
34 class Mat4;
35 class Vec2;
36 class Vec3;
37 class Vec4;
38 class Quaternion;
39 class AABB;
40 class BBox;
41 class Camera;
42 class BezierCurve;
43 class Material;
44 class PathCamera;
45 class SpotLight;
46 class Transformation;
47 
48 
49 
50 //----------------------------------------------------------------------------------------------------------------------
56 //----------------------------------------------------------------------------------------------------------------------
58 {
59 
60 public :
61  enum ACCESSMODE{READ,WRITE};
62  //----------------------------------------------------------------------------------------------------------------------
65  //----------------------------------------------------------------------------------------------------------------------
66  AbstractSerializer(const std::string &_fname,ACCESSMODE _mode) noexcept;
67  //----------------------------------------------------------------------------------------------------------------------
69  //----------------------------------------------------------------------------------------------------------------------
70  virtual ~AbstractSerializer() noexcept;
71 
72  //----------------------------------------------------------------------------------------------------------------------
75  //----------------------------------------------------------------------------------------------------------------------
76  virtual void read(AABB &_s) noexcept=0;
77  //----------------------------------------------------------------------------------------------------------------------
80  //----------------------------------------------------------------------------------------------------------------------
81  virtual void write(const AABB &_s) noexcept=0;
82  //----------------------------------------------------------------------------------------------------------------------
85  //----------------------------------------------------------------------------------------------------------------------
86  virtual void read(BBox &_s) noexcept=0;
87  //----------------------------------------------------------------------------------------------------------------------
90  //----------------------------------------------------------------------------------------------------------------------
91  virtual void write(const BBox &_s) noexcept=0;
92  //----------------------------------------------------------------------------------------------------------------------
95  //----------------------------------------------------------------------------------------------------------------------
96  virtual void read(BezierCurve &_s) noexcept=0;
97  //----------------------------------------------------------------------------------------------------------------------
100  //----------------------------------------------------------------------------------------------------------------------
101  virtual void write(const BezierCurve &_s) noexcept=0;
102  //----------------------------------------------------------------------------------------------------------------------
105  //----------------------------------------------------------------------------------------------------------------------
106  virtual void read(Camera &_s) noexcept=0;
107  //----------------------------------------------------------------------------------------------------------------------
110  //----------------------------------------------------------------------------------------------------------------------
111  virtual void write(const Camera &_s) noexcept=0;
112  //----------------------------------------------------------------------------------------------------------------------
115  //----------------------------------------------------------------------------------------------------------------------
116  virtual void read(Colour &_s) noexcept=0;
117  //----------------------------------------------------------------------------------------------------------------------
120  //----------------------------------------------------------------------------------------------------------------------
121  virtual void write(const Colour &_s) noexcept=0;
122  //----------------------------------------------------------------------------------------------------------------------
125  //----------------------------------------------------------------------------------------------------------------------
126  virtual void read(Light &_s) noexcept=0;
127  //----------------------------------------------------------------------------------------------------------------------
130  //----------------------------------------------------------------------------------------------------------------------
131  virtual void write(const Light &_s) noexcept=0;
132  //----------------------------------------------------------------------------------------------------------------------
135  //----------------------------------------------------------------------------------------------------------------------
136  virtual void read(Mat3 &_s) noexcept=0;
137  //----------------------------------------------------------------------------------------------------------------------
140  //----------------------------------------------------------------------------------------------------------------------
141  virtual void write(const Mat3 &_s) noexcept=0;
142  //----------------------------------------------------------------------------------------------------------------------
145  //----------------------------------------------------------------------------------------------------------------------
146  virtual void read(Mat4 &_s) noexcept=0;
147  //----------------------------------------------------------------------------------------------------------------------
150  //----------------------------------------------------------------------------------------------------------------------
151  virtual void write(const Mat4 &_s) noexcept=0;
152  //----------------------------------------------------------------------------------------------------------------------
155  //----------------------------------------------------------------------------------------------------------------------
156  virtual void read(Material &_s) noexcept=0;
157  //----------------------------------------------------------------------------------------------------------------------
160  //----------------------------------------------------------------------------------------------------------------------
161  virtual void write(const Material &_s) noexcept=0;
162  //----------------------------------------------------------------------------------------------------------------------
165  //----------------------------------------------------------------------------------------------------------------------
166  virtual void read(PathCamera &_s) noexcept=0;
167  //----------------------------------------------------------------------------------------------------------------------
170  //----------------------------------------------------------------------------------------------------------------------
171  virtual void write(const PathCamera &_s) noexcept=0;
172  //----------------------------------------------------------------------------------------------------------------------
175  //----------------------------------------------------------------------------------------------------------------------
176  virtual void read(Plane &_s) noexcept=0;
177  //----------------------------------------------------------------------------------------------------------------------
180  //----------------------------------------------------------------------------------------------------------------------
181  virtual void write(const Plane &_s) noexcept=0;
182  //----------------------------------------------------------------------------------------------------------------------
185  //----------------------------------------------------------------------------------------------------------------------
186  virtual void read(Quaternion &_s) noexcept=0;
187  //----------------------------------------------------------------------------------------------------------------------
190  //----------------------------------------------------------------------------------------------------------------------
191  virtual void write(const Quaternion &_s) noexcept=0;
192  //----------------------------------------------------------------------------------------------------------------------
195  //----------------------------------------------------------------------------------------------------------------------
196  virtual void read(SpotLight &_s) noexcept=0;
197  //----------------------------------------------------------------------------------------------------------------------
200  //----------------------------------------------------------------------------------------------------------------------
201  virtual void write(const SpotLight &_s) noexcept=0;
202  //----------------------------------------------------------------------------------------------------------------------
205  //----------------------------------------------------------------------------------------------------------------------
206  virtual void read(Transformation &_s) noexcept=0;
207  //----------------------------------------------------------------------------------------------------------------------
210  //----------------------------------------------------------------------------------------------------------------------
211  virtual void write(const Transformation &_s) noexcept=0;
212  //----------------------------------------------------------------------------------------------------------------------
215  //----------------------------------------------------------------------------------------------------------------------
216  virtual void read(Vec2 &_s) noexcept=0;
217  //----------------------------------------------------------------------------------------------------------------------
220  //----------------------------------------------------------------------------------------------------------------------
221  virtual void write(const Vec2 &_s) noexcept=0;
222  //----------------------------------------------------------------------------------------------------------------------
225  //----------------------------------------------------------------------------------------------------------------------
226  virtual void read(Vec3 &_s) noexcept=0;
227  //----------------------------------------------------------------------------------------------------------------------
230  //----------------------------------------------------------------------------------------------------------------------
231  virtual void write(const Vec3 &_s) noexcept=0;
232  //----------------------------------------------------------------------------------------------------------------------
235  //----------------------------------------------------------------------------------------------------------------------
236  virtual void read(Vec4 &_s) noexcept=0;
237  //----------------------------------------------------------------------------------------------------------------------
240  //----------------------------------------------------------------------------------------------------------------------
241  virtual void write(const Vec4 &_s) noexcept=0;
242 
243 private :
245  AbstractSerializer(const AbstractSerializer &)=delete;
247  AbstractSerializer &operator=(const AbstractSerializer &)=delete;
248 };
249 
250 
251 } // end of namespace ngl
252 
253 
254 #endif // end of the class
Mat3 basic 3x3 matrix for certain glsl ops.
Definition: Mat3.h:43
Generic Bezier Curve Class allowing the user to generate basic curves using a number of different con...
Definition: BezierCurve.h:45
simple Vec2 encapsulates a 3 float object like glsl Vec2 but not maths use the Vec2 class for maths a...
Definition: Vec2.h:49
simple class to hold colour information and set the basic opengl colour state. also has overloaded me...
Definition: Colour.h:40
simple Vector class for OpenGL graphics, contains overloaded operators for most math functions...
Definition: Vec4.h:57
a simple colour class for RGBA colour
main definition of types and namespace
#define NGL_DLLEXPORT
Definition: Types.h:65
Simple class to encapsulate OpenGL Light functions this will fill in the following structure...
Definition: Light.h:68
FMT_FUNC void write(std::ostream &os, Writer &w)
Definition: ostream.cc:15
an abstract base clase for all serialization in NGL
Definition: AABB.h:42
Inherits from Camera and adds a path for both eye and look using two Bezier Curves.
Definition: PathCamera.h:33
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
Definition: Vec3.h:51
implementation files for RibExport class
Definition: AABB.cpp:22
Encapsulation of OpenGL spotlight inherits from the Light class.
Definition: SpotLight.h:58
simple camera class to allow movement in an opengl scene. a lot of this stuff is from the HILL book C...
Definition: Camera.h:54
Defines the class Quaternion based on John Vinces lecture notes basically we have a scalar part and t...
a simple 3x3 TX matrix
Transformation describes a transformation (translate, scale, rotation) modifed by j macey and include...
Simple Bounding box class used in various parts of ngl and other example programs.
Definition: BBox.h:40
Matrix Class to do simple matrix operations included operator overloaded functions for maths and matr...
Definition: Mat4.h:58
GLsizei const GLchar *const * string
Definition: glew.h:1847