Changeset 2771 for GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
- Timestamp:
- 06/18/08 17:33:16 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Bvh.cpp
r2770 r2771 124 124 Bvh::Bvh(): 125 125 mCamera(NULL), 126 mFrameId(-1),127 126 mRoot(NULL), 128 127 mVertices(NULL), … … 138 137 Bvh::Bvh(const SceneEntityContainer &entities): 139 138 mCamera(NULL), 140 mFrameId(-1),141 139 mRoot(NULL), 142 140 mVertices(NULL), … … 349 347 350 348 351 void Bvh::InitFrame( Camera *camera, int currentFrameId)349 void Bvh::InitFrame() 352 350 { 353 351 // = 0011 1111 which means that at the beginning, all six planes have to frustum culled 354 352 mRoot->mPlaneMask = 0x3f; 355 mCamera = camera;356 357 mFrameId = currentFrameId;358 353 359 354 mCamera->CalcFrustum(sFrustum); … … 809 804 int Bvh::Render(BvhNode *node, RenderState *state) 810 805 { 811 //cout << "r " << node->mFirst << " " << node->mLast << endl; 812 813 int rendered = 0; 806 int renderedTriangles = 0; 814 807 815 808 for (int i = node->mFirst; i <= node->mLast; ++ i) 816 809 { 817 if (mGeometry[i]->GetLastRendered() != mFrameId) 818 { 819 mGeometry[i]->Render(state); 820 mGeometry[i]->SetLastRendered(mFrameId); 821 ++ rendered; 822 } 823 } 824 825 return rendered; 810 renderedTriangles += mGeometry[i]->GetGeometry()->CountTriangles(); 811 mGeometry[i]->Render(state); 812 } 813 814 return renderedTriangles; 826 815 } 827 816
Note: See TracChangeset
for help on using the changeset viewer.