RayTracing
|
00001 #include "Sphere.h" 00002 #include "Thor.h" 00003 #include "Vector3D.h" 00004 #include "Material.h" 00005 #include "Light.h" 00006 #include <QMainWindow> 00007 #include <QFile> 00008 00010 #define XML true 00011 00012 #define Bin false 00013 00015 #define WR true 00016 00017 #define RE false 00018 00019 //class QFile; 00025 class Serializer 00026 { 00027 public: 00029 QFile * File; 00031 bool readWrite; 00033 bool format; 00034 00036 QString FileName; 00037 00039 Serializer(); 00041 ~Serializer(); 00042 00046 virtual bool Start(QString FileName) = 0; 00047 00051 virtual void SerStr(char * Value, char * Name = "String") = 0; 00055 virtual void SerBool(bool &Value, char * Name = "Bool") = 0; 00059 virtual void SerInt(int &Value, char * Name = "Int") = 0; 00063 virtual void SerFloat(float &Value, char * Name = "Float") = 0; 00067 virtual void SerVec(Vector3D &Value, char * Name = "Vector") = 0; 00072 void SerPic(int &Width, int &Height, char *Name = "Screen"); 00076 void SerCam(Vector3D &Camera, char * Name = "Camera"); 00080 void SerMat(Mater &Material, char * Name = "Material"); 00084 void SerSph(Sphere &Sph, char *Name = "Sphere"); 00088 void SerThor(Thor &Th, char *Name = "Thor"); 00092 void SerLight(Light &Li, char *Name = "Light"); 00093 00095 virtual void End() = 0; 00096 }; 00097 00098 00104 class XMLS : public Serializer 00105 { 00106 public: 00108 XMLS(); 00110 ~XMLS(); 00111 00115 bool Start(QString FileName); 00116 00120 void SerStr(char * Value, char * Name = "String"); 00124 void SerBool(bool &Value, char * Name = "Bool"); 00128 void SerInt(int &Value, char * Name = "Int"); 00132 void SerFloat(float &Value, char * Name = "Float"); 00136 void SerVec(Vector3D &Value, char * Name = "Vector"); 00137 00139 void End(); 00140 }; 00141 00147 class XMLL : public Serializer 00148 { 00149 public: 00151 XMLL(); 00153 ~XMLL(); 00154 00158 bool Start(QString FileName); 00159 00163 void SerStr(char * Value, char * Name = "String"); 00167 void SerBool(bool &Value, char * Name = "Bool"); 00171 void SerInt(int &Value, char * Name = "Int"); 00175 void SerFloat(float &Value, char * Name = "Float"); 00179 void SerVec(Vector3D &Value, char * Name = "Vector"); 00180 00182 void End(); 00183 }; 00184 00191 class BinS : public Serializer 00192 { 00193 public: 00195 BinS(); 00197 ~BinS(); 00198 00202 bool Start(QString FileName); 00203 00207 void SerStr(char * Value, char * Name = "String"); 00211 void SerBool(bool &Value, char * Name = "Bool"); 00215 void SerInt(int &Value, char * Name = "Int"); 00219 void SerFloat(float &Value, char * Name = "Float"); 00223 void SerVec(Vector3D &Value, char * Name = "Vector"); 00224 00226 void End(); 00227 }; 00228 00234 class BinL : public Serializer 00235 { 00236 public: 00238 BinL(); 00240 ~BinL(); 00241 00245 bool Start(QString FileName); 00246 00250 void SerStr(char * Value, char * Name = "String"); 00254 void SerBool(bool &Value, char * Name = "Bool"); 00258 void SerInt(int &Value, char * Name = "Int"); 00262 void SerFloat(float &Value, char * Name = "Float"); 00266 void SerVec(Vector3D &Value, char * Name = "Vector"); 00267 00269 void End(); 00270 };