Main Page   Class Hierarchy   Compound List   File List   Compound Members  

objloader.hpp

00001 #ifndef objloader_H
00002 #define objloader_H
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include "movable.hpp" 
00008 #include "light.hpp"
00009 #include "material.hpp"
00010 #include "triangle.hpp"
00011 
00012 
00013 #include <GL/glu.h>
00014 //#include "pointMass.hpp"
00015 //#include "spring.hpp"
00016 
00017 
00018 typedef struct uv {
00019   float uorv[2];           
00020 };
00021 
00023 
00032 class objloader:public movable
00033 {
00034         enum objMode {NONE,MTLLIB,VERTEX,NORMAL,FACE};
00035         enum mtlMode {NONEM,NEWMTL,NS,D,ILLUM,KD,KA,KS};
00036         
00037 public:
00038         enum coordSystem {CARTESIAN,CYLINDRICAL,SPHERICAL};
00039 
00040         objloader();
00041         objloader(string objFile, float STEP = 0.0, coordSystem COORD_SYSTEM = CARTESIAN);
00042         ~objloader();
00043 
00045         bool load(string objFile);
00047         void process(string line);
00049         void loadMtl(string mtlFile);
00051         void processMtl(string line, material *mtl);
00053         bool matchMtl(unsigned &index, string name);
00055         void setMass(float newMass);
00056 
00057         void draw(void);
00059         void update(void);
00060 
00061         objloader& operator= (const objloader &obj1);
00062 
00063         //void InitTexture(void);
00064 
00065         void getBoundingBox(void);
00066 
00067         bool success;
00068 
00070         int counter;
00071 
00072 private:
00074         string subdir;
00075         string mtlFile;
00076         unsigned mtlIndex;
00077         triangleInd tempTriangle;
00078         unsigned kIndex;
00079         objMode theMode;
00080         mtlMode theMtlMode;
00081         vector3f tempVector;
00082         unsigned tempVectorIndex;
00083         //vector3f tempFaceIndex;
00084         bool verbose;
00085 
00086         
00087 public:
00088 
00089         std::vector<vector3f> vertices;
00090         std::vector<vector3f> normals;
00091         std::vector<material*> mtls;
00092         
00094         int listNum;
00095         
00096         std::vector<vector3f> iStack;
00097 
00099         std::vector<vector3f> surface;
00100 
00101         vector3f centerOfMass;
00102         bool translucent;
00103         
00104         
00106         std::vector<vector3f> upperI;
00107         std::vector<vector3f> lowerI;
00108 
00109 private:
00110 
00112         //void makeList(void);
00113         
00115         void findInteriorCubic(void);
00116         void findInteriorCylindrical(void);
00117         void findInteriorSpherical(void);
00118 
00119         void testInteriorPoint(vector3f testPoint);
00120 
00122         void findCenterOfMass(void);
00124         void centerPoints(void);
00125         void findIbody(void);
00127         void outputMassObj(void);
00129         void findSurface(void);
00130 };
00131 
00132 
00133 #endif
00134 

Generated on Sat May 10 10:09:36 2003 for volume-src-limited by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002