Changeset 3371 for GTP


Ignore:
Timestamp:
05/19/09 12:02:26 (15 years ago)
Author:
mattausch
Message:

fehler tritt nicht auf!!

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp

    r3360 r3371  
    168168        geom->mMaterial = mat; 
    169169 
     170        static int count = 0; 
     171        if (count ++ < 10) 
    170172        cout << "creating new geometry with " << numElements << " vertices" << endl; 
    171173 
     
    204206 
    205207 
    206 bool ObjConverter::Convert(const string &filename, const std::string &outputFilename) 
     208bool ObjConverter::Convert(const string &filename,  
     209                                                   const std::string &outputFilename) 
    207210{ 
    208211        mNumShapes = 0; 
     
    358361                str.write(reinterpret_cast<char *>(geom->mTexcoords), sizeof(float) * texCoordCount * 2); 
    359362         
    360  
    361         /////// 
    362         //-- texture 
    363 /* 
    364 #ifdef USE_TEXTURE 
    365         int texId = 0; 
    366 #else 
    367         int texId = -1; 
    368 #endif 
    369  
    370         str.write(reinterpret_cast<char *>(&texId), sizeof(int)); 
    371  
    372         bool alphaTestEnabled = false; 
    373         //bool cullFaceEnabled = false; 
    374         bool cullFaceEnabled = true; 
    375  
    376         str.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 
    377         str.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 
    378  
    379         // material 
    380         bool hasMaterial = true; 
    381         //bool hasMaterial = false; 
    382         str.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 
    383          
    384         if (hasMaterial) 
    385         { 
    386                 SimpleVec ambient, diffuse, spec, emm; 
    387  
    388                 ambient.x = ambient.y = ambient.z = 0.2f; 
    389                 //diffuse.x = diffuse.y = diffuse.z = 1.0f; 
    390                 diffuse.x = 0.7f; diffuse.y = 0.5f; diffuse.z = 0.2f; 
    391                 spec.x    = spec.y    = spec.z    =  .0f; 
    392                 emm = spec; 
    393  
    394                 // only write rgb part of the material 
    395                 str.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec)); 
    396                 str.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec)); 
    397                 str.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec)); 
    398                 str.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 
    399         } 
    400 */ 
    401363} 
    402364 
     
    407369        ogzstream ofile(filename.c_str()); 
    408370 
    409         if (!ofile.is_open()) 
    410                 return false; 
     371        if (!ofile.is_open()) return false; 
    411372         
    412373 
     
    448409        { 
    449410                WriteGeometry(ofile, *it); 
    450         } 
    451  
    452         int texId = 0; 
    453         ofile.write(reinterpret_cast<char *>(&texId), sizeof(int)); 
    454  
    455         bool alphaTestEnabled = false; 
    456         //bool cullFaceEnabled = false; 
    457         bool cullFaceEnabled = true; 
    458                  
    459         ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 
    460         ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 
    461  
    462         // material 
    463         bool hasMaterial = true; 
    464         ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 
    465          
    466         SimpleVec ambient, diffuse, spec, emm; 
    467  
    468         ambient.x = ambient.y = ambient.z = 0.2f; 
    469         diffuse.x = diffuse.y = diffuse.z = 1.0f; 
    470         spec.x = spec.y = spec.z = .0f; 
    471         emm = spec; 
    472  
    473         // only write rgb part of the material 
    474         ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec)); 
    475         ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec)); 
    476         ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec)); 
    477         ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 
    478  
     411 
     412                int texId = 0; 
     413                ofile.write(reinterpret_cast<char *>(&texId), sizeof(int)); 
     414 
     415                bool alphaTestEnabled = false; 
     416                //bool cullFaceEnabled = false; 
     417                bool cullFaceEnabled = true; 
     418 
     419                ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 
     420                ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 
     421 
     422                // material 
     423                bool hasMaterial = true; 
     424                ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 
     425 
     426                if (hasMaterial) 
     427                { 
     428                        SimpleVec ambient, diffuse, spec, emm; 
     429 
     430                        ambient.x = ambient.y = ambient.z =  .2f; 
     431                        diffuse.x = diffuse.y = diffuse.z = 1.0f; 
     432                        spec.x    = spec.y    = spec.z    =  .0f; 
     433                        emm = spec; 
     434 
     435                        // only write rgb part of the material 
     436                        ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec)); 
     437                        ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec)); 
     438                        ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec)); 
     439                        ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 
     440                } 
     441        } 
    479442 
    480443        int entityCount = 1; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp

    r3360 r3371  
    129129                                for (int j = 0; j < 3; ++ j) 
    130130                                { 
    131                                         //if (tIndices[idx[j]] >= (int)texcoords.size()) 
    132                                                 //cerr << "error: texcoord indices exceed array size " << texcoords.size() << " " << tIndices[idx[j]] << endl; 
    133131                                        const int tidx = min((int)texcoords.size() - 1, tIndices[idx[j]]); 
    134  
    135132                                        faceTexcoords.push_back(texcoords[tidx]); 
    136133                                } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp

    r3361 r3371  
    1 //#include "ObjConverter.h" 
    2 #include "PlyConverter.h" 
     1#include "ObjConverter.h" 
     2//#include "PlyConverter.h" 
    33#include <iostream> 
    44#include <time.h> 
     
    1212 
    1313        //ObjConverter2 converter; 
    14         //ObjConverter converter; 
    15         PlyConverter converter; 
     14        ObjConverter converter; 
     15        //PlyConverter converter; 
    1616 
    1717        cout << "converting obj to dem format" << endl; 
     
    6060 
    6161        cout << "conversion successful" << endl; 
    62         cout << "press any key" << std::cin.get(); 
     62        //cout << "press any key" << std::cin.get(); 
    6363 
    6464        return 0; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3370 r3371  
    845845 
    846846        //if (mRegenerateSamples) 
    847         if (1)//mUseTemporalCoherence || mRegenerateSamples) 
     847        if (//mUseTemporalCoherence ||  
     848                mRegenerateSamples) 
    848849        { 
    849850                mRegenerateSamples = false; 
     
    860861                else 
    861862                { 
    862                         //UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES); 
     863                        UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES); 
    863864                } 
    864865 
     
    867868                //if (mSortSamples) { SortSamples(); } 
    868869                sCgSsaoProgram->SetArray2f(i, (float *)samples2 + dummy, NUM_SAMPLES); 
    869  
    870                 cout << "d " << dummy << " "; 
    871870 
    872871                dummy = (dummy + NUM_SAMPLES) % NUM_PRECOMPUTED_SAMPLES; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3364 r3371  
    356356    str.read(reinterpret_cast<char *>(vertices), sizeof(Vector3) * vertexCount); 
    357357         
     358        //cout << "vertexCount: " << vertexCount << endl; 
     359 
    358360        normals = new Vector3[vertexCount]; 
    359361        str.read(reinterpret_cast<char *>(normals), sizeof(Vector3) * vertexCount); 
    360362 
     363 
    361364        Vector3 *tangents; 
    362365 
     
    374377        str.read(reinterpret_cast<char *>(&texCoordCount), sizeof(int)); 
    375378 
     379        //cout << "texCoordCount: " << texCoordCount << endl; 
    376380 
    377381        if (texCoordCount) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp

    r3370 r3371  
    181181        for (int i = 0; i < mNumSamples; ++ i) 
    182182        { 
    183                 x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1); 
    184                 //mHalton->GetNext(x); 
     183                //x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1); 
     184                mHalton->GetNext(x); 
    185185                 
    186186                const float a = 2.0f * M_PI * x[0]; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3369 r3371  
    669669#if 1 
    670670 
    671         //LoadModel("hbuddha.dem", dynamicObjects); 
     671        LoadModel("hbuddha.dem", dynamicObjects); 
    672672        //LoadModel("horse.dem", dynamicObjects); 
    673         LoadModel("happy2.dem", dynamicObjects); 
     673        //LoadModel("happy2.dem", dynamicObjects); 
    674674        //LoadModel("torus.dem", dynamicObjects); 
    675675        //LoadModel("venusm.dem", dynamicObjects); 
     
    835835        // another color buffer 
    836836        fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, ColorBufferObject::FILTER_NEAREST); 
     837 
    837838 
    838839        for (int i = 0; i < 4; ++ i) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3370 r3371  
    88//#define NUM_PRECOMPUTED_SAMPLES 8124 
    99#define NUM_PRECOMPUTED_SAMPLES 4096 
    10 #define NUM_PRECOMPUTED_SAMPLES 64 
     10//#define NUM_PRECOMPUTED_SAMPLES 1024 
    1111 
    1212//#define NUM_SAMPLES 16 
    13 //#define NUM_SAMPLES 24 
     13#define NUM_SAMPLES 16 
    1414//#define NUM_SAMPLES 32 
    15 #define NUM_SAMPLES 64 
     15//#define NUM_SAMPLES 64 
    1616 
    17 #define MIN_SAMPLES 64 
     17#define MIN_SAMPLES 16 
    1818//#define MIN_SAMPLES 48 
    1919 
     
    6666#define NUM_DOF_TABS 16 
    6767 
    68 #define USE_GTX 
     68//#define USE_GTX 
    6969 
    7070#define SSAO_FILTER_RADIUS 5 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3370 r3371  
    487487                float2 offset; 
    488488 
    489                 //const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 
    490                 const float2 ssaoOffset = dummySamples[i]; 
     489                const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 
     490                //const float2 ssaoOffset = dummySamples[i]; 
    491491 
    492492                //////////////////// 
     
    494494                //-- (affects performance for some reason!) 
    495495 
    496                 if (0)//!USE_OPTIMIZATION || 
     496                if (1)//!USE_OPTIMIZATION || 
    497497                        //(convergence < SSAO_CONVERGENCE_THRESHOLD)) 
    498498                { 
     
    685685        float3 ao; 
    686686        //$$temp matt 
    687         oldIdx = dummyIdx; 
     687        //oldIdx = dummyIdx; 
    688688 
    689689        // cull background note: this should be done with the stencil buffer 
     
    758758        //-- blend ao between old and new samples (and avoid division by zero) 
    759759 
    760         OUT.illum_col.x = ao.x;// * newWeight + oldSsao * oldWeight; 
    761         //OUT.illum_col.x /= (newWeight + oldWeight); 
     760        OUT.illum_col.x = ao.x * newWeight + oldSsao * oldWeight; 
     761        OUT.illum_col.x /= (newWeight + oldWeight); 
    762762 
    763763        OUT.illum_col.y = combinedWeight; 
Note: See TracChangeset for help on using the changeset viewer.