- Timestamp:
- 11/29/05 00:01:43 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.cpp
r420 r439 26 26 {} 27 27 28 RenderSimulator::RenderSimulator(float objRenderCost, float vcOverhead, float moveSpeed): 29 mObjRenderCost(objRenderCost), mVcOverhead(vcOverhead), mMoveSpeed(moveSpeed) 30 { 31 } 32 33 /***************************************************** 34 * class ViewCellRenderSimulator implementation * 35 *****************************************************/ 36 37 BspViewCellRenderSimulator::BspViewCellRenderSimulator(float objRenderCost, 28 RenderSimulator::RenderSimulator(float objRenderCost, 29 float vcOverhead, 30 float moveSpeed): 31 mObjRenderCost(objRenderCost), 32 mVcOverhead(vcOverhead), 33 mMoveSpeed(moveSpeed) 34 { 35 } 36 37 void RenderSimulator::SetObjectRenderCost(const float objRenderCost) 38 { 39 mObjRenderCost = objRenderCost; 40 } 41 42 void RenderSimulator::SetVcOverhead(const float vcOverhead) 43 { 44 mVcOverhead = vcOverhead; 45 } 46 47 void RenderSimulator::SetMoveSpeed(const float moveSpeed) 48 { 49 mMoveSpeed = moveSpeed; 50 } 51 52 /********************************************************/ 53 /* class BspRenderSimulator implementation */ 54 /********************************************************/ 55 56 BspRenderSimulator::BspRenderSimulator(float objRenderCost, 38 57 float vcOverhead, 39 58 float moveSpeed, … … 43 62 } 44 63 45 Real BspViewCellRenderSimulator::SimulateRendering() 46 { 47 mStat.Reset(); 48 mStat.Start(); 64 SimulationStatistics BspRenderSimulator::SimulateRendering() 65 { 66 SimulationStatistics simStat; 67 68 simStat.Reset(); 69 simStat.Start(); 49 70 50 71 Real renderTime = 0; … … 84 105 renderTime += vcCost; 85 106 86 if (vcCost > mStat.maxCost)87 mStat.maxCost = vcCost;88 else if (vcCost < mStat.minCost)89 mStat.minCost = vcCost;107 if (vcCost > simStat.maxCost) 108 simStat.maxCost = vcCost; 109 else if (vcCost < simStat.minCost) 110 simStat.minCost = vcCost; 90 111 91 112 // probability that a view cell border is crossed … … 94 115 // crossing the border of a view cell is also depending on the move speed 95 116 loadPvsOverhead += pCrossVc * mVcOverhead; 96 overallarea +=area;117 overallarea += area; 97 118 pInVcTotal += pInVc; 98 119 } … … 102 123 loadPvsOverhead /= pCrossVcTotal; 103 124 104 mStat.avgRtWithoutOverhead = renderTime;105 mStat.avgRenderTime = renderTime + loadPvsOverhead;106 107 mStat.maxCost /= pInVcTotal;108 mStat.minCost /= pInVcTotal;109 110 mStat.Stop();111 112 return renderTime + loadPvsOverhead;113 } 114 115 Real Bsp ViewCellRenderSimulator::RenderPvs(ViewCell &viewCell,125 simStat.avgRtWithoutOverhead = renderTime; 126 simStat.avgRenderTime = renderTime + loadPvsOverhead; 127 128 simStat.maxCost /= pInVcTotal; 129 simStat.minCost /= pInVcTotal; 130 131 simStat.Stop(); 132 133 return simStat; 134 } 135 136 Real BspRenderSimulator::RenderPvs(ViewCell &viewCell, 116 137 float objRenderTime) const 117 138 { … … 123 144 *******************************************************/ 124 145 125 Kd ViewCellRenderSimulator::KdViewCellRenderSimulator(float objRenderCost,146 KdRenderSimulator::KdRenderSimulator(float objRenderCost, 126 147 float vcOverhead, 127 148 float moveSpeed, … … 131 152 } 132 153 133 Real KdViewCellRenderSimulator::SimulateRendering() 134 { 154 SimulationStatistics KdRenderSimulator::SimulateRendering() 155 { 156 SimulationStatistics simStat; 157 135 158 //mKdTree->CollectLeavesPvs(); 136 mStat.Reset();137 mStat.Start();159 simStat.Reset(); 160 simStat.Start(); 138 161 139 162 // total render time … … 170 193 renderTime += vcCost; 171 194 172 if (vcCost > mStat.maxCost)173 mStat.maxCost = vcCost;174 else if (vcCost < mStat.minCost)175 mStat.minCost = vcCost;195 if (vcCost > simStat.maxCost) 196 simStat.maxCost = vcCost; 197 else if (vcCost < simStat.minCost) 198 simStat.minCost = vcCost; 176 199 177 200 // probability that a view cell border is crossed … … 186 209 loadPvsOverhead /= pCrossVcTotal; 187 210 188 mStat.avgRtWithoutOverhead = renderTime;189 mStat.avgRenderTime = renderTime + loadPvsOverhead;190 191 mStat.maxCost /= pInVcTotal;192 mStat.minCost /= pInVcTotal;193 194 mStat.Stop();195 196 return renderTime + loadPvsOverhead;197 } 198 199 Real Kd ViewCellRenderSimulator::RenderPvs(KdLeaf *leaf,200 211 simStat.avgRtWithoutOverhead = renderTime; 212 simStat.avgRenderTime = renderTime + loadPvsOverhead; 213 214 simStat.maxCost /= pInVcTotal; 215 simStat.minCost /= pInVcTotal; 216 217 simStat.Stop(); 218 219 return simStat; 220 } 221 222 Real KdRenderSimulator::RenderPvs(KdLeaf *leaf, 223 float objRenderTime) const 201 224 { 202 225 return leaf->mKdPvs.GetSize() * objRenderTime;
Note: See TracChangeset
for help on using the changeset viewer.