00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _OPENCITY_AC3DOBJECT_H_
00021 #define _OPENCITY_AC3DOBJECT_H_ 1
00022
00023 #include "ac3dsurface.h"
00024
00025 #include <vector>
00026 #include <string>
00027 #include <sstream>
00028
00029 namespace AC3D {
00030
00031 using std::vector;
00032 using std::string;
00033 using std::stringstream;
00034
00037 enum OBJECT_TYPE {
00038 OBJECT_WORLD,
00039 OBJECT_POLYGON,
00040 OBJECT_GROUP
00041 };
00042
00045 struct Vertex {
00046 float x, y, z;
00047 };
00048
00049
00050
00054 class AC3DObject{
00055 public:
00056 AC3DObject();
00057 AC3DObject( stringstream& data );
00058
00059 ~AC3DObject();
00060
00061
00062
00065 void
00066 AddKid( AC3DObject* kid );
00067
00068
00069
00073 bool
00074 IsTranslucent() const;
00075
00076
00077
00081 string
00082 GetName() const;
00083
00084
00085
00090 unsigned int
00091 GetNumberKid() const;
00092
00093
00094
00098 const string&
00099 GetTextureFile() const;
00100
00101
00102
00106 const float*
00107 GetLoc() const;
00108
00109
00110
00115 const vector<Vertex>&
00116 GetVVertex() const;
00117
00118
00119
00124 const vector<AC3DSurface*>&
00125 GetVPSurface() const;
00126
00127
00128
00133 const vector<AC3DObject*>&
00134 GetVPObject() const;
00135
00136
00137
00140 void Parse( stringstream& data );
00141
00142
00143 string ToStr() const;
00144
00145 private:
00146 OBJECT_TYPE type;
00147 string strName;
00148 int iData;
00149 string strTexture;
00150 float fTexRep[2];
00151 float fRot[9];
00152 float fLoc[3];
00153 float fCrease;
00154 string strURL;
00155
00156 uint uiNumVert;
00157 vector<Vertex> vVertex;
00158
00159 uint uiNumSurf;
00160 vector<AC3DSurface*> vpSurface;
00161
00162 uint uiKids;
00163 vector<AC3DObject*> vpObject;
00164
00165
00166
00167
00168
00169 void ac3dSetDefault();
00170
00171 void
00172 ac3dobjectParseVertex(
00173 unsigned int nb,
00174 stringstream& data,
00175 char* buffer );
00176
00177 void
00178 ac3dobjectParseSurface(
00179 unsigned int nb,
00180 stringstream& data,
00181 char* buffer );
00182 };
00183
00184 }
00185
00186 #endif
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209