00001 /**************************************************************************** 00002 ** 00003 ** Author: Jaime Valls Miro <jaime.vallsmiro@eng.uts.edu.au> 00004 ** Hue Tuan Thi <huetuan.thi@uts.edu.au>, (C) 2006 00005 ** 00006 ** This file is part of the S3D Viewer Project 00007 ** 00008 ** This file may be used under the terms of the GNU General Public 00009 ** License version 2.0 as published by the Free Software Foundation 00010 ** and appearing in the file LICENSE.GPL included in the packaging of 00011 ** this file. Please review the following information to ensure GNU 00012 ** General Public Licensing requirements will be met: 00013 ** http://www.trolltech.com/products/qt/opensource.html 00014 ** 00015 ** If you are unsure which license is appropriate for your use, please 00016 ** review the following information: 00017 ** http://www.trolltech.com/products/qt/licensing.html or contact the 00018 ** sales department at sales@trolltech.com. 00019 ** 00020 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00021 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00022 ** 00023 ****************************************************************************/ 00024 00032 #ifndef FILEREADER_H 00033 #define FILEREADER_H 00034 00035 #include <stdio.h> 00036 #include <stdlib.h> 00037 #include <fcntl.h> 00038 #include <GL/glu.h> 00039 #include <stdio.h> 00040 #include <QString> 00041 00045 typedef struct{ 00046 char info[100]; 00047 int colorFormat; 00048 int nrow; 00049 int ncol; 00050 int np; 00051 00052 int encoding; 00053 00054 }S3DHead; 00055 00059 typedef struct{ 00060 unsigned char color; 00064 }TPixelBW; 00065 00069 typedef struct{ 00070 unsigned char r,g,b; 00074 }TPixelColor; 00075 00079 typedef struct{ 00080 float x,y,z; 00081 int info2d; 00082 00083 00084 00085 00086 00087 00088 00089 }TPoint3D; 00090 00091 const int MAXPIXELWIDTH = 4096; 00092 const int MAXPIXELHEIGHT = 4096; 00093 00098 class FileReader{ 00099 public: 00100 FileReader(); 00101 ~FileReader(); 00102 00103 int getColorFormat(); 00104 int getNRow(); 00105 int getNCol(); 00106 int getNp(); 00107 int getEncoding(); 00108 int getInfo2d(); 00109 char getColor(); 00110 char getR(); 00111 char getG(); 00112 char getB(); 00113 float getX(); 00114 float getY(); 00115 float getZ(); 00116 QString getColorText(); 00117 QString getInfo(); 00118 void readFile(QString &fileName); 00119 00121 GLubyte imagePixels[MAXPIXELHEIGHT][MAXPIXELWIDTH][3]; 00122 float pointArray[1048576][6]; 00123 00124 private: 00125 S3DHead *head; 00126 TPixelBW *image_bw; 00127 TPixelColor *image_color; 00128 TPoint3D *points; 00129 QString colorFormatText; 00130 }; 00131 00132 #endif