- Timestamp:
- Nov 10, 2004, 2:19:31 AM (20 years ago)
- Location:
- orxonox/branches/importer/importer
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/importer/importer/Makefile.am
r2755 r2776 6 6 7 7 bin_PROGRAMS=importer 8 importer_SOURCES=framework.cc windowHandler.cc object.cc array.cc 8 importer_SOURCES=framework.cc windowHandler.cc object.cc array.cc material.cc 9 9 10 noinst_HEADERS=windowHandler.h object.h array.h 10 noinst_HEADERS=windowHandler.h object.h array.h material.h 11 11 12 12 -
orxonox/branches/importer/importer/Makefile.in
r2755 r2776 53 53 PROGRAMS = $(bin_PROGRAMS) 54 54 am_importer_OBJECTS = framework.$(OBJEXT) windowHandler.$(OBJEXT) \ 55 object.$(OBJEXT) array.$(OBJEXT) 55 object.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) 56 56 importer_OBJECTS = $(am_importer_OBJECTS) 57 57 importer_LDADD = $(LDADD) … … 60 60 am__depfiles_maybe = depfiles 61 61 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/array.Po ./$(DEPDIR)/framework.Po \ 62 @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/windowHandler.Po 62 @AMDEP_TRUE@ ./$(DEPDIR)/material.Po ./$(DEPDIR)/object.Po \ 63 @AMDEP_TRUE@ ./$(DEPDIR)/windowHandler.Po 63 64 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 64 65 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 150 151 AM_CXXFLAGS = "-I/usr/X11R6/include" 151 152 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS) 152 importer_SOURCES = framework.cc windowHandler.cc object.cc array.cc 153 noinst_HEADERS = windowHandler.h object.h array.h 153 importer_SOURCES = framework.cc windowHandler.cc object.cc array.cc material.cc 154 noinst_HEADERS = windowHandler.h object.h array.h material.h 154 155 all: all-am 155 156 … … 220 221 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@ 221 222 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/framework.Po@am__quote@ 223 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/material.Po@am__quote@ 222 224 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@ 223 225 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windowHandler.Po@am__quote@ -
orxonox/branches/importer/importer/array.h
r2773 r2776 1 //#include "windowHandler.h" 1 #ifndef _ARRAY_H 2 #define _ARRAY_H 3 2 4 #include <GL/gl.h> 3 5 #include <GL/glu.h> … … 24 26 25 27 }; 28 29 #endif -
orxonox/branches/importer/importer/object.cc
r2775 r2776 1 1 #include "object.h" 2 2 3 Object::Object () 3 4 { … … 80 81 { 81 82 readFace (Buffer+2); 83 } 84 85 else if (!strncmp(Buffer, "mtllib", 6)) 86 { 87 readMtlLib (Buffer+7); 82 88 } 83 89 … … 173 179 } 174 180 181 bool Object::readMtlLib (char* mtlFile) 182 { 183 MTL_FILE = new ifstream (mtlFile); 184 if (!MTL_FILE->is_open()) 185 { 186 printf ("unable to open file: %s\n", mtlFile); 187 return false; 188 } 189 190 char Buffer[500]; 191 vertices = new Array(); 192 faces = new Array(); 193 194 while(!MTL_FILE->eof()) 195 { 196 MTL_FILE->getline(Buffer, 500); 197 // printf("%s\n", Buffer); 198 199 200 // create new Material 201 if (!strncmp(Buffer, "newmtl ", 2)) 202 { 203 material = new Material(Buffer+7); 204 } 205 // setting a illumMode 206 else if (!strncmp(Buffer, "illum", 5)) 207 { 208 material->setIllum(Buffer+6); 209 } 210 // setting Diffuse Color 211 else if (!strncmp(Buffer, "Kd", 2)) 212 { 213 material->setDiffuse(Buffer+3); 214 } 215 // setting Ambient Color 216 else if (!strncmp(Buffer, "Ka", 2)) 217 { 218 material->setAmbient(Buffer+3); 219 } 220 // setting Specular Color 221 else if (!strncmp(Buffer, "Ks", 2)) 222 { 223 material->setSpecular(Buffer+3); 224 } 225 226 227 228 } 229 return true; 230 } 175 231 176 232 bool Object::readUseMtl (char* matString) … … 178 234 if (faceMode != -1) 179 235 glEnd(); 180 faceMode = 1; 236 faceMode = 0; 237 //printf ("%s\n", matString); 181 238 glColor3f((float)rand()/2000000000.0,(float)rand()/2000000000.0,(float)rand()/2000000000.0); 182 239 } 240 241 -
orxonox/branches/importer/importer/object.h
r2773 r2776 1 #ifndef OBJECT_H2 #define OBJECT_H1 #ifndef _OBJECT_H 2 #define _OBJECT_H 3 3 4 4 #include <GL/gl.h> … … 6 6 7 7 #include "array.h" 8 #include "material.h" 8 9 #include <fstream.h> 9 10 … … 32 33 int faceMode; 33 34 bool readVertices; 35 Material* material; 34 36 35 37 ifstream* OBJ_FILE; … … 39 41 bool readFace (char* faceString); 40 42 bool readVT (char* vtString); 41 bool readUseMtl (char* matString); 43 bool readMtlLib (char* matFile); 44 bool readUseMtl (char* mtlString); 42 45 43 46 bool addGLElement (char* elementString);
Note: See TracChangeset
for help on using the changeset viewer.