Ignore:
Timestamp:
01/04/09 16:06:56 (15 years ago)
Author:
mattausch
Message:

pvs seems to work now

File:
1 edited

Legend:

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

    r3244 r3245  
    7676 
    7777        // get the bounding box 
     78        // exchange x and y coordinates and recompute box 
    7879        fread(&mBox, sizeof(AxisAlignedBox3), 1, fr); 
    7980 
     
    8182        Vector3 v2(mBox.Max().x, -mBox.Max().z, mBox.Max().y); 
    8283         
    83         Vector3 newMin = v1; 
    84         Vector3 newMax = v2; 
     84        mBox.Initialize(); 
    8585 
    86         Minimize(newMin, v2); 
    87         Maximize(newMax, v1); 
    88  
    89         mBox.SetMin(newMin); 
    90         mBox.SetMax(newMax); 
     86        mBox.Include(v1); 
     87        mBox.Include(v2); 
    9188 
    9289        stack<ViewCellsTreeNode **> nodeStack; 
     
    9693 
    9794        int numViewCells = 0; 
     95 
     96        int axes[] = {0, 0, 0}; 
    9897 
    9998        while (!nodeStack.empty())  
     
    108107                fread(&axis, sizeof(int), 1, fr); 
    109108 
    110                 // exchange y and z axis like we have to do for the scene 
     109                // exchange y and z axis like for whole scene 
    111110                if (axis == 2) axis = 1; 
    112111                else if (axis == 1) axis = 2; 
     
    114113                node->mAxis = axis; 
    115114 
    116                 if (node->mAxis > 2 || node->mAxis < -1) cout << "a " << node->mAxis << " "; 
    117  
    118115                if (!node->IsLeaf()) 
    119116                { 
    120                         float pos; 
    121                         fread(&pos, sizeof(float), 1, fr); 
     117                        ++ axes[node->mAxis]; 
    122118 
    123                         if (axis == 1) pos = -pos; 
    124                         node->mPosition = pos; 
    125                          
    126                         nodeStack.push(&node->mFront); 
    127                         nodeStack.push(&node->mBack); 
     119                        float mypos; 
     120                        fread(&mypos, sizeof(float), 1, fr); 
     121                        // changed coordinate system must be considered also here 
     122                        if (node->mAxis == 1)  
     123                        { 
     124                                node->mPosition = -mypos; 
     125 
     126                                nodeStack.push(&node->mBack); 
     127                                nodeStack.push(&node->mFront); 
     128                                //cout << mypos << " "; 
     129                        } 
     130                        else 
     131                        { 
     132                                node->mPosition = mypos; 
     133                                 
     134                                nodeStack.push(&node->mFront); 
     135                                nodeStack.push(&node->mBack); 
     136                        } 
    128137                } 
    129138        } 
    130139 
    131         cout << "loaded " << numViewCells << " view cells" << endl; 
     140        cout << "\nloaded " << numViewCells << " view cells" << " " << axes[0] << " " << axes[1] << " " << axes[2] << endl; 
    132141        return true; 
    133142} 
Note: See TracChangeset for help on using the changeset viewer.