Changeset 3261 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 01/09/09 19:50:56 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter.vcproj
r3258 r3261 69 69 GenerateDebugInformation="true" 70 70 SubSystem="1" 71 LargeAddressAware="2" 71 72 TargetMachine="1" 72 73 /> … … 122 123 Name="VCCLCompilerTool" 123 124 AdditionalOptions=" /D "_CRT_SECURE_NO_WARNINGS"" 125 Optimization="3" 126 InlineFunctionExpansion="2" 127 EnableIntrinsicFunctions="true" 128 FavorSizeOrSpeed="1" 129 OmitFramePointers="true" 130 EnableFiberSafeOptimizations="true" 124 131 AdditionalIncludeDirectories="libs\Zlib\include" 125 132 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 133 StringPooling="true" 126 134 RuntimeLibrary="2" 135 EnableEnhancedInstructionSet="2" 136 RuntimeTypeInfo="false" 127 137 UsePrecompiledHeader="0" 128 138 WarningLevel="3" … … 145 155 AdditionalLibraryDirectories="libs\Zlib\lib" 146 156 IgnoreDefaultLibraryNames="libCMT" 147 GenerateDebugInformation=" true"157 GenerateDebugInformation="false" 148 158 SubSystem="1" 159 LargeAddressAware="2" 149 160 OptimizeReferences="2" 150 161 EnableCOMDATFolding="2" … … 198 209 </File> 199 210 <File 211 RelativePath=".\Converter\ObjConverter2.cpp" 212 > 213 </File> 214 <File 200 215 RelativePath=".\Converter\SimpleTri.cpp" 201 216 > … … 220 235 </File> 221 236 <File 237 RelativePath=".\Converter\ObjConverter2.h" 238 > 239 </File> 240 <File 222 241 RelativePath=".\Converter\SimpleTri.h" 223 242 > -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
r3260 r3261 30 30 { 31 31 string s(pch); 32 //s += "\n",33 32 triples.push_back(s); 34 33 … … 104 103 if (!normals.empty()) 105 104 { 106 //if (dummy < 3) cout << nIndices[idx1] << " " << nIndices[idx2] << " " << nIndices[idx3] << endl;107 105 faceNormals.push_back(normals[nIndices[idx1]]); 108 106 faceNormals.push_back(normals[nIndices[idx2]]); … … 140 138 { 141 139 for (size_t i = 0; i < mGeometry.size(); ++ i) 142 {143 delete [] mGeometry[i]->mVertices;144 delete [] mGeometry[i]->mNormals;145 delete [] mGeometry[i]->mTexcoords;146 147 140 delete mGeometry[i]; 148 }149 141 150 142 mGeometry.clear(); … … 211 203 212 204 for (size_t i = 0; i < mGeometry.size(); ++ i) 213 {214 delete [] mGeometry[i]->mVertices;215 delete [] mGeometry[i]->mNormals;216 delete [] mGeometry[i]->mTexcoords;217 218 205 delete mGeometry[i]; 219 }220 206 221 207 mGeometry.clear(); … … 306 292 ++ mNumShapes; 307 293 294 if (!currentMat) cout << "here3" << endl; 308 295 LoadShape(faceVertices, faceNormals, faceTexcoords, currentMat); 309 296 … … 323 310 324 311 currentMat = mMaterialTable[matName]; 325 cout << "matname: " << matName << endl;312 //cout << "matname: " << matName << endl; 326 313 } 327 314 … … 538 525 Material *mat = (*it)->mMaterial; 539 526 527 if (!mat) cerr << "error: no material specified!!" << endl; 528 540 529 ofile.write(reinterpret_cast<char *>(&mat->texture), sizeof(int)); 541 530 … … 628 617 { 629 618 string s(pch); 630 //s += "\n",631 619 strings.push_back(s); 632 620 … … 634 622 } 635 623 636 cout << endl; 637 638 639 if ((strings.size() == 2) && (strcmp(strings[0].c_str(),"newmtl") == 0)) 624 if ((strings.size() == 2) && (strcmp(strings[0].c_str(), "newmtl") == 0)) 640 625 { 641 626 currentMat = new Material(); … … 643 628 } 644 629 645 if ((strings.size() == 2) && (strcmp(strings[0].c_str(), "map_Kd") == 0))630 if ((strings.size() == 2) && (strcmp(strings[0].c_str(), "map_Kd") == 0)) 646 631 { 647 632 TextureTable::const_iterator it = mTextureTable.find(strings[1]); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.h
r3247 r3261 15 15 16 16 class Geometry; 17 18 static std::string model_path("data/city/model/"); 19 17 20 18 21 typedef std::vector<SimpleVec> VertexArray; … … 37 40 // const std::string textureFilename) const; 38 41 39 bool LoadMaterials(const std::string &m atFileName);42 bool LoadMaterials(const std::string &mtlFilename); 40 43 41 44 ~ObjConverter(); … … 45 48 struct Geometry 46 49 { 50 Geometry(): 51 mVertices(NULL), 52 mNormals(NULL), 53 mTexcoords(NULL), 54 mMaterial(NULL), 55 mVertexCount(0), 56 mTexcoordCount(0) 57 {} 58 59 ~Geometry() 60 { 61 delete [] mVertices; 62 delete [] mNormals; 63 delete [] mTexcoords; 64 } 65 47 66 SimpleVec *mVertices; 48 67 SimpleVec *mNormals; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
r3247 r3261 1 #include "ObjConverter .h"1 #include "ObjConverter2.h" 2 2 #include <iostream> 3 3 #include <time.h> … … 5 5 using namespace std; 6 6 7 static string model_path("data/city/model/");8 7 9 8 int main(int argc, char* argv[]) … … 11 10 int returnCode = 0; 12 11 13 ObjConverter converter;12 ObjConverter2 converter; 14 13 15 14 cout << "converting obj to dem format" << endl; 16 15 #if 0 17 16 if (!converter.LoadMaterials(model_path + argv[3])) 18 17 { … … 30 29 exit(0); 31 30 } 31 #else 32 33 //const int numFiles = 879; 34 const int numFiles = 100; 35 36 vector<string> filenames; 37 const string base(model_path + argv[1]); 38 39 for (int i = 0; i < numFiles; ++ i) 40 { 41 char filename[100]; 42 sprintf(filename, "%s%s%d%s", base.c_str(), ".b", i, ".obj"); 43 filenames.push_back(filename); 44 } 45 46 if (!converter.Convert2(filenames, model_path + argv[2])) 47 { 48 cerr << "conversion failed" << endl; 49 50 std::cin.get(); 51 exit(0); 52 } 53 #endif 32 54 33 55 cout << "conversion successful" << endl; 34 cout << "press any key" << std::cin.get();56 //cout << "press any key" << std::cin.get(); 35 57 36 58 return 0; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
r3258 r3261 154 154 IgnoreAllDefaultLibraries="false" 155 155 IgnoreDefaultLibraryNames="LIBCMT" 156 GenerateDebugInformation=" true"156 GenerateDebugInformation="false" 157 157 SubSystem="1" 158 158 LargeAddressAware="2" 159 159 OptimizeReferences="2" 160 160 EnableCOMDATFolding="2" 161 OptimizeForWindows98="1" 161 162 TargetMachine="1" 162 163 /> -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhExporter.cpp
r3260 r3261 78 78 bool BvhExporter::Export(const string &filename, Bvh *bvh) 79 79 { 80 cout << " Info: Exportingto file '" << filename.c_str() << "'" << endl;80 cout << "Exporting bvh to file '" << filename.c_str() << "'" << endl; 81 81 82 82 FILE *fw = fopen(filename.c_str(), "wb"); … … 121 121 } 122 122 123 cout << "writing " << (int)triangles.size() << " triangle ids ..." << endl; 124 123 125 // export sorted triangle IDs 124 for (int i = 0; i < triangles.size(); ++i)126 for (int i = 0; i < (int)triangles.size(); ++i) 125 127 { 126 128 fwrite(&triangles[i], sizeof(int), 1, fw); 127 129 } 128 130 131 cout << "writing bvh nodes ..." << endl; 132 129 133 SaveNode(bvh->GetStaticRoot(), fw); 130 134 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3260 r3261 383 383 } 384 384 385 //const bool delGeometry = true;386 const bool delGeometry = false;385 const bool delGeometry = true; 386 //const bool delGeometry = false; 387 387 return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, NULL);//tangents); 388 388 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.cpp
r3214 r3261 54 54 mImage = malloc(GetByteSize()); 55 55 56 Debug << "successfully loaded texture " << filename << " w " << mWidth << " h " << mHeight << endl; 56 Debug << "loaded texture " << filename << " w " << mWidth << " h " << mHeight << endl; 57 //cout << "loaded texture " << filename << " w " << mWidth << " h " << mHeight << endl; 57 58 58 59 ilCopyPixels(0, 0, 0, mWidth, mHeight, 1, IL_RGBA, IL_UNSIGNED_BYTE, mImage); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.h
r3214 r3261 22 22 23 23 24 /** Constructor loading texture fromfile24 /** Constructor loading a texture from a file 25 25 */ 26 26 Texture(const std::string &filename); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3260 r3261 587 587 //LoadModel("sibenik.dem", dynamicObjects); 588 588 589 LoadModel("procedural_pompeii_area6_hires/pompeii.dem", dynamicObjects); 590 591 AxisAlignedBox3 box; 592 box.Initialize(); 593 594 const Vector3 offs(.0f, 3000.0f, 180); 595 //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 596 Matrix4x4 moffs = TranslationMatrix(offs); 597 598 for (size_t i = 0; i < dynamicObjects.size(); ++ i) 599 { 600 dynamicObjects[i]->GetTransform()->SetMatrix(moffs); 601 box.Include(dynamicObjects[i]->GetWorldBoundingBox()); 602 } 603 604 cout << "pompeii bb:\n" << box << endl; 605 589 606 #if 0 590 LoadModel("hbuddha.dem", dynamicObjects);591 592 buddha = dynamicObjects.back();593 594 607 const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 595 608 //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 596 597 609 Matrix4x4 transl = TranslationMatrix(sceneCenter); 610 611 LoadModel("hbuddha.dem", dynamicObjects); 612 613 buddha = dynamicObjects.back(); 598 614 buddha->GetTransform()->SetMatrix(transl); 599 615 … … 646 662 647 663 648 ObjExporter().Export(model_path + "mycity.obj", bvh);649 BvhExporter().Export(model_path + "mycity.bvh", bvh);664 //ObjExporter().Export(model_path + "mycity.obj", bvh); 665 //BvhExporter().Export(model_path + "mycity.bvh", bvh); 650 666 651 667
Note: See TracChangeset
for help on using the changeset viewer.