Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Object.h

Go to the documentation of this file.
00001 
00007 #ifndef _OBJECT_H_
00008 #define _OBJECT_H_
00009 
00010 #include <stdio.h>
00011 #include <Math.h>
00012 #include "Set.h"
00013 #include "Log.h"
00014 
00015 struct Vertex {
00016         float tu, tv;
00017         float nx, ny, nz;
00018         float vx, vy, vz;
00019 };
00020 
00021 enum Primitive {
00022         PRIM_TRIANGLES          = 0,
00023         PRIM_TRIANGLE_STRIP     = 1,
00024         PRIM_QUADS                      = 2,
00025         PRIM_QUAD_STRIP         = 3,
00026 };
00027 
00028 enum AttributeType {
00029         ATT_VERTEX      = 0,
00030         ATT_NORMAL      = 1,
00031         ATT_COLOR       = 2,
00032         ATT_TEX         = 3,
00033 };
00034 
00035 enum AttributeFormat {
00036         ATT_FLOAT                       = 0,
00037         ATT_UNSIGNED_BYTE       = 1,
00038 };
00039 
00040 struct Format {
00041         AttributeType attType;
00042         AttributeFormat attFormat;
00043         unsigned int size;
00044         unsigned int offset;
00045 };
00046 
00047 class Object {
00048         public:
00049                 Object();
00050                 ~Object();
00051                 void clear();
00052                 void setPrimitive(const Primitive prim);
00053                 void setVertices(void *vertexArray, const unsigned int numVertices, const unsigned int size);
00054                 void setIndices(void *indiceArray, const unsigned int numIndices, const unsigned int size);
00055                 void addFormat(const AttributeType attType, const AttributeFormat attFormat, const unsigned int size, const unsigned int offset);
00056 
00057                 char *getVertices() { return vertices; };
00058 
00059                 bool flipNormals();
00060                 bool findAttribute(const AttributeType attType, unsigned int *where) const;
00061                 //bool loadModel(const char *fileName);
00062 
00063                 //virtual bool createVertexBuffer();
00064                 //virtual bool clearVertexBuffer();
00065                 virtual void draw() = 0;
00066 
00067         protected:
00068                 char *vertices;
00069                 char *indices;
00070 
00071                 unsigned int nVertices;
00072                 unsigned int nIndices;
00073                 unsigned int vertexSize;
00074                 unsigned int indiceSize;
00075 
00076                 Set <Format> formats;
00077                 Primitive primitive;
00078 };
00079 
00080 #endif

Generated on Sun Jun 5 15:47:04 2005 for Defacto by  doxygen 1.4.3