- Timestamp:
- 01/04/09 16:06:56 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.cpp
r3244 r3245 76 76 77 77 // get the bounding box 78 // exchange x and y coordinates and recompute box 78 79 fread(&mBox, sizeof(AxisAlignedBox3), 1, fr); 79 80 … … 81 82 Vector3 v2(mBox.Max().x, -mBox.Max().z, mBox.Max().y); 82 83 83 Vector3 newMin = v1; 84 Vector3 newMax = v2; 84 mBox.Initialize(); 85 85 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); 91 88 92 89 stack<ViewCellsTreeNode **> nodeStack; … … 96 93 97 94 int numViewCells = 0; 95 96 int axes[] = {0, 0, 0}; 98 97 99 98 while (!nodeStack.empty()) … … 108 107 fread(&axis, sizeof(int), 1, fr); 109 108 110 // exchange y and z axis like we have to do for the scene109 // exchange y and z axis like for whole scene 111 110 if (axis == 2) axis = 1; 112 111 else if (axis == 1) axis = 2; … … 114 113 node->mAxis = axis; 115 114 116 if (node->mAxis > 2 || node->mAxis < -1) cout << "a " << node->mAxis << " ";117 118 115 if (!node->IsLeaf()) 119 116 { 120 float pos; 121 fread(&pos, sizeof(float), 1, fr); 117 ++ axes[node->mAxis]; 122 118 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 } 128 137 } 129 138 } 130 139 131 cout << " loaded " << numViewCells << " view cells"<< endl;140 cout << "\nloaded " << numViewCells << " view cells" << " " << axes[0] << " " << axes[1] << " " << axes[2] << endl; 132 141 return true; 133 142 }
Note: See TracChangeset
for help on using the changeset viewer.