[406] | 1 | #ifndef _RenderSimulator_h__
|
---|
| 2 | #define _RenderSimulator_h__
|
---|
| 3 |
|
---|
| 4 | #include "common.h"
|
---|
[414] | 5 | #include "Statistics.h"
|
---|
[406] | 6 |
|
---|
| 7 | class BspTree;
|
---|
| 8 | class KdTree;
|
---|
| 9 | class ViewCell;
|
---|
[407] | 10 | class KdLeaf;
|
---|
[406] | 11 |
|
---|
[414] | 12 | class SimulationStatistics: public StatisticsBase |
---|
| 13 | { |
---|
| 14 | public: |
---|
| 15 | /// view cell with the biggest "cost" |
---|
| 16 | float maxCost; |
---|
| 17 | /// view cell with the minimal "cost" |
---|
| 18 | float minCost; |
---|
| 19 | /// average render time |
---|
| 20 | float avgRenderTime; |
---|
| 21 | /// average render time with the overhead when crossing view cells |
---|
| 22 | float avgRtWithoutOverhead; |
---|
| 23 | |
---|
| 24 | void Reset() |
---|
| 25 | { |
---|
| 26 | maxCost = 0; |
---|
| 27 | minCost = 999999; |
---|
| 28 | avgRenderTime = 0; |
---|
| 29 | avgRtWithoutOverhead = 0; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | void Print(ostream &app) const; |
---|
| 33 | |
---|
| 34 | friend ostream &operator<<(ostream &s, const SimulationStatistics &stat) |
---|
| 35 | { |
---|
| 36 | stat.Print(s); |
---|
| 37 | return s; |
---|
| 38 | } |
---|
| 39 | };
|
---|
| 40 |
|
---|
[406] | 41 | /** Simulated rendering using a simple render heuristics. Used to evaluate the |
---|
| 42 | quality of the view cell partition. |
---|
| 43 | */ |
---|
| 44 | class RenderSimulator |
---|
| 45 | { |
---|
[414] | 46 | |
---|
[406] | 47 | public: |
---|
| 48 | RenderSimulator(); |
---|
[409] | 49 | RenderSimulator(float objRendercost, float vcOverhead, float moveSpeed); |
---|
[406] | 50 | virtual Real SimulateRendering() = 0; |
---|
| 51 | |
---|
[409] | 52 | /// render time for single object of the PVS |
---|
[406] | 53 | float mObjRenderCost; |
---|
[409] | 54 | /// const overhead for crossing a view cell border |
---|
[406] | 55 | float mVcOverhead; |
---|
[409] | 56 | /// move speed of player |
---|
| 57 | float mMoveSpeed; |
---|
[414] | 58 | |
---|
| 59 | SimulationStatistics mStat; |
---|
[406] | 60 | }; |
---|
| 61 | |
---|
[409] | 62 | class BspViewCellRenderSimulator: public RenderSimulator |
---|
[406] | 63 | { |
---|
| 64 | public: |
---|
[411] | 65 | BspViewCellRenderSimulator(float objRenderCost, |
---|
| 66 | float vcOverhead, |
---|
| 67 | float moveSpeed, |
---|
| 68 | BspTree *bspTree); |
---|
[406] | 69 | |
---|
| 70 | Real SimulateRendering(); |
---|
| 71 | |
---|
| 72 | protected: |
---|
| 73 | /** Simulates rendering of the pvs of one view cell, with given rendering time for an object. |
---|
| 74 | @param viewCell the view cell holding the Pvs |
---|
| 75 | @param objRenderTime estimated render time for one object of the Pvs |
---|
| 76 | */ |
---|
| 77 | Real RenderPvs(ViewCell &viewCell, const float objRenderTime) const; |
---|
| 78 | |
---|
| 79 | BspTree *mBspTree; |
---|
| 80 | }; |
---|
| 81 | |
---|
[409] | 82 | class KdViewCellRenderSimulator: public RenderSimulator |
---|
[406] | 83 | { |
---|
| 84 | public: |
---|
[411] | 85 | KdViewCellRenderSimulator(float objRenderCost, |
---|
| 86 | float vcOverhead, |
---|
| 87 | float moveSpeed, |
---|
| 88 | KdTree *kdTree); |
---|
[407] | 89 | Real SimulateRendering();
|
---|
[406] | 90 | |
---|
[407] | 91 | protected: |
---|
[406] | 92 | |
---|
[407] | 93 | Real RenderPvs(KdLeaf *leaf, float objRenderTime) const; |
---|
| 94 | |
---|
[406] | 95 | KdTree *mKdTree; |
---|
| 96 | };
|
---|
| 97 |
|
---|
| 98 | #endif // RenderSimulator
|
---|