00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __SGL_INTERLEAVED_GEOMETRY_HPP
00026 #define __SGL_INTERLEAVED_GEOMETRY_HPP
00027
00028 #include <sgl.h>
00029 #include <sglDrawable.hpp>
00030
00031
00032
00149 class SGL_DLL_API sglInterleavedGeometry : public sglDrawable
00150 {
00151 public:
00153 sglInterleavedGeometry();
00155 virtual ~sglInterleavedGeometry();
00156
00158 virtual AAEnum getAAType() const;
00159
00163 void setGLPrimType(GLenum prim_type);
00165 GLenum getGLPrimType() const { return m_prim_type; }
00167 virtual sglStats::PrimEnum getPrimType() const;
00169 virtual unsigned int getPrimSize() const;
00170
00176 unsigned int getNumPrims() const {return m_num_prims;}
00178 void setNumPrims(unsigned int num);
00179
00181 unsigned int *getPrimLengths() const {return m_lengths;}
00183 void setPrimLengths(unsigned int *lengths);
00184
00190 void setInterleavedArray(GLenum format,
00191 void *array,
00192 GLsizei stride = 0);
00193
00195 void getInterleavedArray(GLenum *format,
00196 void **array,
00197 GLsizei *stride);
00198
00200 virtual bool isValid() const;
00201
00203 virtual void drawGeometry(const vector<sglTexCoords> &tex_coords) const;
00204
00206 virtual void addStats(sglStats &stats) const;
00207
00209 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00210
00211 protected:
00212 virtual bool computeBounds();
00213
00214 private:
00215 sglInterleavedGeometry(const sglInterleavedGeometry &);
00216 sglInterleavedGeometry &operator=(const sglInterleavedGeometry &);
00217
00218 private:
00219 GLenum m_prim_type;
00220 unsigned int m_num_prims;
00221 unsigned int *m_lengths;
00222
00223 void *m_array;
00224 GLenum m_array_format;
00225 GLsizei m_array_stride;
00226
00227 enum BoundsEnum {ePRIM_TYPE = 0x01,
00228 eNUMPRIMS = 0x02,
00229 eLENGTHS = 0x04,
00230 eARRAY = 0x08,
00231 eARRAY_FORMAT = 0x10};
00232 unsigned int m_compute_bounds;
00233 };
00234
00235
00236
00237
00238
00239
00240
00241
00242 struct sglC4ubV2fStruct
00243 {
00244 unsigned char color[4];
00245 sglVec2f vertex;
00246 };
00247
00248 struct sglC4ubV3fStruct
00249 {
00250 unsigned char color[4];
00251 sglVec3f vertex;
00252 };
00253
00254 struct sglC3fV3fStruct
00255 {
00256 sglVec3f color;
00257 sglVec3f vertex;
00258 };
00259
00260 struct sglN3fV3fStruct
00261 {
00262 sglVec3f normal;
00263 sglVec3f vertex;
00264 };
00265
00266 struct sglC4fN3fV3fStruct
00267 {
00268 sglVec4f color;
00269 sglVec3f normal;
00270 sglVec3f vertex;
00271 };
00272
00273 struct sglT2fV3fStruct
00274 {
00275 sglVec2f tex_coord;
00276 sglVec3f vertex;
00277 };
00278
00279 struct sglT4fV4fStruct
00280 {
00281 sglVec4f tex_coord;
00282 sglVec4f vertex;
00283 };
00284
00285 struct sglT2fC4ubV3fStruct
00286 {
00287 sglVec2f tex_coord;
00288 unsigned char color[4];
00289 sglVec3f vertex;
00290 };
00291
00292 struct sglT2fC3fV3fStruct
00293 {
00294 sglVec2f tex_coord;
00295 sglVec3f color;
00296 sglVec3f vertex;
00297 };
00298
00299 struct sglT2fN3fV3fStruct
00300 {
00301 sglVec2f tex_coord;
00302 sglVec3f normal;
00303 sglVec3f vertex;
00304 };
00305
00306 struct sglT2fC4fN3fV3fStruct
00307 {
00308 sglVec2f tex_coord;
00309 sglVec4f color;
00310 sglVec3f normal;
00311 sglVec3f vertex;
00312 };
00313
00314 struct sglT4fC4fN3fV4fStruct
00315 {
00316 sglVec4f tex_coord;
00317 sglVec4f color;
00318 sglVec3f normal;
00319 sglVec4f vertex;
00320 };
00321
00322
00323
00324 #endif