Ignore:
Timestamp:
11/23/08 21:31:29 (16 years ago)
Author:
mattausch
Message:

normal mappingt: first working version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp

    r3153 r3154  
    8686                        Vector3 normal =  Normalize(mNormals[i]); 
    8787 
    88                         float dotProd = DotProd(tangent,normal); 
    89  
    90                         tangent -= normal * dotProd; 
    91                         tangent = Normalize(tangent); 
     88                        float dotProd = DotProd(tangent, normal); 
     89                        //tangent -= normal * dotProd;tangent = Normalize(tangent); 
    9290 
    9391                        //mTangents[i] = tangent; 
    94                         mTangents[i] = Vector3(0,1,0);//tangent * 0.5f + Vector3(0.5f); 
     92                        mTangents[i] = tangent * 0.5f + Vector3(0.5f); 
    9593                } 
    9694 
     
    9896                        ((Vector3 *)data)[mNumVertices * 2 + i] = mTangents[i]; 
    9997 
    100                 for (int i = 0; i < 3; ++ i) 
    101                         cout << ((Vector3 *)data)[mNumVertices * 2 + i] << " "; 
    102  
    10398                currentPData += mNumVertices * 3; 
    10499        } 
     
    125120        if (mTangents) 
    126121        { 
    127                 cout << "dotprods: " << endl; 
    128  
    129                 for (int i = 0; i < 1000; ++ i) 
     122                //cout << "dotprods: " << endl; 
     123 
     124                /*for (int i = 0; i < 100; ++ i) 
    130125                { 
    131126                        //cout << mTangents[i] << " " << mNormals[i] << " " << DotProd(Normalize(mTangents[i]), Normalize(mNormals[i])) << endl; 
     
    135130                } 
    136131                cout << endl; 
     132                */ 
    137133         
     134                for (int i = 0; i < 50; ++ i) 
     135                { 
     136                        cout << mTexCoords[i].first << "," << mTexCoords[i].second << " "; 
     137                } 
     138 
    138139                glColorPointer(3, GL_FLOAT, 0, (char *)NULL + currentPVbo); 
    139140                currentPVbo += mNumVertices * sizeof(Vector3); 
     
    159160        if (mHasTangents) 
    160161        { 
    161                 cout<<"x"; 
    162162                glEnableClientState(GL_COLOR_ARRAY); 
    163163        } 
     164 
    164165        if (state->GetCurrentVboId() != mVboId) 
    165166        { 
Note: See TracChangeset for help on using the changeset viewer.