#include "trueeyes.h" #include "GlobalValues.h" #include "VolumeDataStruct.h" #include "VolumeShaderStruct.h" #include #include #include using namespace std; #define OBJECT_TYPE_VOLUME 0 #define OBJECT_TYPE_SHADER 1 #define OBJECT_TYPE_SOURCE 2 #define OBJECT_TYPE_TEXTURE 3 void SaveProject(string filename) { //determine the project directory QDir projectDir(QString(filename.c_str())); cout<<"Project directory: "< 0) out< position = outSource.S.getPosition(); point3D lookat = outSource.S.getLookAt(); vector3D up = outSource.S.getUp(); out<>StepSize; in>>gpVolSize[0]; in>>gpVolSize[1]; in>>gpVolSize[2]; in>>gpCropMin[0]; in>>gpCropMin[1]; in>>gpCropMin[2]; in>>gpCropMax[0]; in>>gpCropMax[1]; in>>gpCropMax[2]; while(!in.eof()) { //get the object type int t; char c[1024]; in>>t; if(t == OBJECT_TYPE_VOLUME) { VolumeData inVol; in>>inVol.Name; in>>inVol.FileType; int num_files; in>>num_files; for(int f=0; f>c; QString relativePath = QString(c); QString fullPath = projectDir.absoluteFilePath(relativePath); inVol.Filenames.push_back(string(fullPath.toAscii())); } in>>inVol.Dim.x; in>>inVol.Dim.y; in>>inVol.Dim.z; in>>inVol.HeaderSize; in>>inVol.BitType; in>>inVol.ExternalComponents; in>>inVol.ExternalDatatype; in>>inVol.InternalComponents; in>>inVol.InternalDatatype; in>>inVol.Normalized; //add the volume data structure to the list if(inVol.FileType == VOLUME_FILE_RAW) LoadRawVolume(inVol); if(inVol.FileType == VOLUME_FILE_IMAGES) LoadImages(inVol); } else if(t == OBJECT_TYPE_TEXTURE) { TextureData inTex; in>>inTex.Name; //read the file name in>>c; QString relativePath = QString(c); QString fullPath = projectDir.absoluteFilePath(relativePath); inTex.Filename = string(fullPath.toAscii()); in>>inTex.sX; in>>inTex.sY; in>>inTex.ExternalComponents; in>>inTex.ExternalDatatype; in>>inTex.InternalComponents; in>>inTex.InternalDatatype; in>>inTex.Normalized; //add the texture data structure to the list LoadTexture(inTex); TextureList.push_back(inTex); } else if(t == OBJECT_TYPE_SHADER) { VolumeShader inShader; in>>inShader.Name; in>>c; QString relativePath = QString(c); QString fullPath = projectDir.absoluteFilePath(relativePath); inShader.Filename = string(fullPath.toAscii()); ShaderList.push_back(inShader); } else if(t == OBJECT_TYPE_SOURCE) { VolumeSource inSource; in>>inSource.Name; point3D position; point3D lookat; vector3D up; in>>position.x; in>>position.y; in>>position.z; in>>lookat.x; in>>lookat.y; in>>lookat.z; in>>up.x; in>>up.y; in>>up.z; inSource.S.setPosition(position); inSource.S.LookAt(lookat, up); SourceList.push_back(inSource); } } //close the file in.close(); //reload everything ReloadShaders(); }