Changeset 3261


Ignore:
Timestamp:
01/09/09 19:50:56 (15 years ago)
Author:
mattausch
Message:

worked on powerplant loading

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  
    6969                                GenerateDebugInformation="true" 
    7070                                SubSystem="1" 
     71                                LargeAddressAware="2" 
    7172                                TargetMachine="1" 
    7273                        /> 
     
    122123                                Name="VCCLCompilerTool" 
    123124                                AdditionalOptions=" /D "_CRT_SECURE_NO_WARNINGS"" 
     125                                Optimization="3" 
     126                                InlineFunctionExpansion="2" 
     127                                EnableIntrinsicFunctions="true" 
     128                                FavorSizeOrSpeed="1" 
     129                                OmitFramePointers="true" 
     130                                EnableFiberSafeOptimizations="true" 
    124131                                AdditionalIncludeDirectories="libs\Zlib\include" 
    125132                                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" 
     133                                StringPooling="true" 
    126134                                RuntimeLibrary="2" 
     135                                EnableEnhancedInstructionSet="2" 
     136                                RuntimeTypeInfo="false" 
    127137                                UsePrecompiledHeader="0" 
    128138                                WarningLevel="3" 
     
    145155                                AdditionalLibraryDirectories="libs\Zlib\lib" 
    146156                                IgnoreDefaultLibraryNames="libCMT" 
    147                                 GenerateDebugInformation="true" 
     157                                GenerateDebugInformation="false" 
    148158                                SubSystem="1" 
     159                                LargeAddressAware="2" 
    149160                                OptimizeReferences="2" 
    150161                                EnableCOMDATFolding="2" 
     
    198209                        </File> 
    199210                        <File 
     211                                RelativePath=".\Converter\ObjConverter2.cpp" 
     212                                > 
     213                        </File> 
     214                        <File 
    200215                                RelativePath=".\Converter\SimpleTri.cpp" 
    201216                                > 
     
    220235                        </File> 
    221236                        <File 
     237                                RelativePath=".\Converter\ObjConverter2.h" 
     238                                > 
     239                        </File> 
     240                        <File 
    222241                                RelativePath=".\Converter\SimpleTri.h" 
    223242                                > 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp

    r3260 r3261  
    3030        { 
    3131                string s(pch); 
    32                 //s += "\n", 
    3332                triples.push_back(s); 
    3433                 
     
    104103                        if (!normals.empty()) 
    105104                        { 
    106                                 //if (dummy < 3) cout << nIndices[idx1] << " " << nIndices[idx2] << " " << nIndices[idx3] << endl; 
    107105                                faceNormals.push_back(normals[nIndices[idx1]]); 
    108106                                faceNormals.push_back(normals[nIndices[idx2]]); 
     
    140138{ 
    141139        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  
    147140                delete mGeometry[i]; 
    148         } 
    149141         
    150142        mGeometry.clear(); 
     
    211203         
    212204        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  
    218205                delete mGeometry[i]; 
    219         } 
    220206         
    221207        mGeometry.clear(); 
     
    306292                                        ++ mNumShapes; 
    307293 
     294                                        if (!currentMat) cout << "here3" << endl; 
    308295                                        LoadShape(faceVertices, faceNormals, faceTexcoords, currentMat); 
    309296 
     
    323310 
    324311                                currentMat = mMaterialTable[matName]; 
    325                                 cout << "matname: " << matName << endl; 
     312                                //cout << "matname: " << matName << endl; 
    326313                        } 
    327314 
     
    538525                Material *mat = (*it)->mMaterial; 
    539526 
     527                if (!mat) cerr << "error: no material specified!!" << endl; 
     528 
    540529                ofile.write(reinterpret_cast<char *>(&mat->texture), sizeof(int)); 
    541530 
     
    628617                { 
    629618                        string s(pch); 
    630                         //s += "\n", 
    631619                        strings.push_back(s); 
    632620 
     
    634622                } 
    635623 
    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)) 
    640625                { 
    641626                        currentMat = new Material(); 
     
    643628                } 
    644629 
    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)) 
    646631                { 
    647632                        TextureTable::const_iterator it = mTextureTable.find(strings[1]); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.h

    r3247 r3261  
    1515 
    1616class Geometry; 
     17 
     18static std::string model_path("data/city/model/"); 
     19 
    1720 
    1821typedef std::vector<SimpleVec> VertexArray; 
     
    3740                     // const std::string textureFilename) const; 
    3841 
    39         bool LoadMaterials(const std::string &matFileName); 
     42        bool LoadMaterials(const std::string &mtlFilename); 
    4043 
    4144        ~ObjConverter(); 
     
    4548        struct Geometry 
    4649        { 
     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 
    4766                SimpleVec *mVertices; 
    4867                SimpleVec *mNormals; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp

    r3247 r3261  
    1 #include "ObjConverter.h" 
     1#include "ObjConverter2.h" 
    22#include <iostream> 
    33#include <time.h> 
     
    55using namespace std; 
    66 
    7 static string model_path("data/city/model/"); 
    87 
    98int main(int argc, char* argv[]) 
     
    1110        int returnCode = 0; 
    1211 
    13         ObjConverter converter; 
     12        ObjConverter2 converter; 
    1413 
    1514        cout << "converting obj to dem format" << endl; 
    16          
     15#if 0    
    1716        if (!converter.LoadMaterials(model_path + argv[3])) 
    1817        { 
     
    3029                exit(0); 
    3130        } 
     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 
    3254 
    3355        cout << "conversion successful" << endl; 
    34         cout << "press any key" << std::cin.get(); 
     56        //cout << "press any key" << std::cin.get(); 
    3557 
    3658        return 0; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj

    r3258 r3261  
    154154                                IgnoreAllDefaultLibraries="false" 
    155155                                IgnoreDefaultLibraryNames="LIBCMT" 
    156                                 GenerateDebugInformation="true" 
     156                                GenerateDebugInformation="false" 
    157157                                SubSystem="1" 
    158158                                LargeAddressAware="2" 
    159159                                OptimizeReferences="2" 
    160160                                EnableCOMDATFolding="2" 
     161                                OptimizeForWindows98="1" 
    161162                                TargetMachine="1" 
    162163                        /> 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhExporter.cpp

    r3260 r3261  
    7878bool BvhExporter::Export(const string &filename, Bvh *bvh) 
    7979{ 
    80          cout << "Info: Exporting to file '" << filename.c_str() << "'" << endl; 
     80         cout << "Exporting bvh to file '" << filename.c_str() << "'" << endl; 
    8181   
    8282         FILE *fw = fopen(filename.c_str(), "wb"); 
     
    121121         } 
    122122 
     123         cout << "writing " << (int)triangles.size() << " triangle ids ..." << endl; 
     124 
    123125         // export sorted triangle IDs 
    124          for (int i = 0; i < triangles.size(); ++i)  
     126         for (int i = 0; i < (int)triangles.size(); ++i)  
    125127         { 
    126128                 fwrite(&triangles[i], sizeof(int), 1, fw); 
    127129         } 
    128130 
     131         cout << "writing bvh nodes ..." << endl; 
     132          
    129133         SaveNode(bvh->GetStaticRoot(), fw); 
    130134          
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3260 r3261  
    383383        } 
    384384 
    385         //const bool delGeometry = true; 
    386         const bool delGeometry = false; 
     385        const bool delGeometry = true; 
     386        //const bool delGeometry = false; 
    387387        return new Geometry(vertices, normals, texcoords, vertexCount, delGeometry, NULL);//tangents); 
    388388} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.cpp

    r3214 r3261  
    5454                mImage = malloc(GetByteSize()); 
    5555 
    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; 
    5758 
    5859                ilCopyPixels(0, 0, 0, mWidth, mHeight, 1, IL_RGBA, IL_UNSIGNED_BYTE, mImage); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.h

    r3214 r3261  
    2222 
    2323 
    24         /** Constructor loading texture from file 
     24        /** Constructor loading a texture from a file 
    2525        */ 
    2626        Texture(const std::string &filename); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3260 r3261  
    587587        //LoadModel("sibenik.dem", dynamicObjects); 
    588588 
     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 
    589606#if 0 
    590         LoadModel("hbuddha.dem", dynamicObjects); 
    591  
    592         buddha = dynamicObjects.back(); 
    593          
    594607        const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
    595608        //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
    596          
    597609        Matrix4x4 transl = TranslationMatrix(sceneCenter); 
     610         
     611        LoadModel("hbuddha.dem", dynamicObjects); 
     612 
     613        buddha = dynamicObjects.back(); 
    598614        buddha->GetTransform()->SetMatrix(transl); 
    599615 
     
    646662 
    647663 
    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); 
    650666 
    651667 
Note: See TracChangeset for help on using the changeset viewer.