- Timestamp:
- 11/13/05 22:38:46 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp
r406 r407 27 27 Real renderTime = 0; 28 28 29 // render time for 1 object of PVS30 const float objRt = mObjRenderCost;31 // const overhead for crossing a view cell border32 const float vcOverhead = mVcOverhead;33 34 29 // total area of view cells 35 30 float totalArea = 0;//= mKdTree->GetBox().SurfaceArea(); … … 40 35 41 36 ViewCellContainer::const_iterator it, it_end = viewCells.end(); 42 37 38 // surface area substitute for probability 39 PolygonContainer cell; 40 43 41 for (it = viewCells.begin(); it != it_end; ++ it) 44 42 { 45 // surface area substitute for probability46 PolygonContainer cell;47 float area = 0;48 49 43 mBspTree->ConstructGeometry(dynamic_cast<BspViewCell *>(*it), cell); 50 51 area = Polygon3::GetArea(cell);44 CLEAR_CONTAINER(cell); 45 float area = Polygon3::GetArea(cell); 52 46 53 renderTime += area * RenderPvs(*(*it), objRt) + vcOverhead;47 renderTime += area * (RenderPvs(*(*it), mObjRenderCost) + mVcOverhead); 54 48 totalArea += area; 55 CLEAR_CONTAINER(cell);56 49 } 57 50 … … 64 57 } 65 58 66 Real BspTreeRenderSimulator::RenderPvs(ViewCell &viewCell, float objRenderTime) const 59 Real BspTreeRenderSimulator::RenderPvs(ViewCell &viewCell, 60 float objRenderTime) const 67 61 { 68 62 return viewCell.GetPvs().GetSize() * objRenderTime; 69 63 } 70 64 71 /***************************************************** 72 * class KdLeafRenderSimulator implementation *73 ***************************************************** /65 /******************************************************** 66 * class KdLeafRenderSimulator implementation * 67 *******************************************************/ 74 68 75 69 KdTreeRenderSimulator::KdTreeRenderSimulator(float objRenderCost, … … 82 76 Real KdTreeRenderSimulator::SimulateRendering() 83 77 { 78 //mKdTree->CollectLeavesPvs(); 79 80 // total render time 84 81 Real renderTime = 0; 82 // overhead for loading a view cell 83 float loadOverhead = 0; 85 84 86 // total area of view cells87 float totalArea = 0;//= mKdTree->GetBox().SurfaceArea();85 // probability that view point lies in a view cell 86 float pInVcTotal = 0;//mKdTree->GetBox().GetVolume(); 88 87 89 return renderTime; 88 // total probability that a view cell border is crossed 89 float pCrossVcTotal = 0; 90 91 vector<KdLeaf *> leaves; 92 mKdTree->CollectLeaves(leaves); 93 94 AxisAlignedBox3 box; 95 96 vector<KdLeaf *>::const_iterator it, it_end = leaves.end(); 97 98 for (it = leaves.begin(); it != it_end; ++ it) 99 { 100 box = mKdTree->GetBox(*it); 101 102 // volume substitute for view point probability 103 float pInVc = 0; 104 105 if (0) 106 pInVc = box.GetVolume(); 107 else 108 pInVc = box.SurfaceArea(); 109 110 // probability that a view cell border is crossed 111 const float pCrossVc = box.SurfaceArea(); 112 113 renderTime += pInVc * RenderPvs(*it, mObjRenderCost); 114 loadOverhead += pCrossVc * mVcOverhead; 115 116 pInVcTotal += pInVc; 117 pCrossVcTotal += pCrossVc; 118 } 119 120 renderTime /= pInVcTotal; 121 loadOverhead /= pCrossVcTotal; 122 123 return renderTime + loadOverhead; 90 124 } 125 126 Real KdTreeRenderSimulator::RenderPvs(KdLeaf *leaf, 127 float objRenderTime) const 128 { 129 return leaf->mKdPvs.GetSize() * objRenderTime; 130 }
Note: See TracChangeset
for help on using the changeset viewer.