[406] | 1 | #ifndef _RenderSimulator_h__
|
---|
| 2 | #define _RenderSimulator_h__
|
---|
| 3 |
|
---|
| 4 | #include "common.h"
|
---|
[414] | 5 | #include "Statistics.h"
|
---|
[468] | 6 | #include "Renderer.h"
|
---|
[406] | 7 |
|
---|
| 8 |
|
---|
[463] | 9 | class SimulationStatistics: public StatisticsBase
|
---|
| 10 | {
|
---|
| 11 | public:
|
---|
| 12 | /// view cell with the biggest "cost"
|
---|
| 13 | float maxCost;
|
---|
| 14 | /// view cell with the minimal "cost"
|
---|
| 15 | float minCost;
|
---|
| 16 | /// average render time
|
---|
| 17 | float avgRenderTime;
|
---|
| 18 | /// average render time with the overhead when crossing view cells
|
---|
| 19 | float avgRtWithoutOverhead;
|
---|
| 20 |
|
---|
| 21 | void Reset()
|
---|
| 22 | {
|
---|
| 23 | maxCost = 0;
|
---|
| 24 | minCost = 999999;
|
---|
| 25 | avgRenderTime = 0;
|
---|
| 26 | avgRtWithoutOverhead = 0;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | void Print(ostream &app) const;
|
---|
| 30 |
|
---|
| 31 | friend ostream &operator<<(ostream &s, const SimulationStatistics &stat)
|
---|
| 32 | {
|
---|
| 33 | stat.Print(s);
|
---|
| 34 | return s;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | SimulationStatistics()
|
---|
| 38 | {
|
---|
| 39 | Reset();
|
---|
| 40 | }
|
---|
[414] | 41 | };
|
---|
| 42 |
|
---|
[463] | 43 | /** Simulated rendering using a simple render heuristics. Used to evaluate the
|
---|
[468] | 44 | quality of the view cell partition. Evaluates some statistics of the simulation.
|
---|
[463] | 45 | */
|
---|
[468] | 46 | class RenderSimulator: public Renderer
|
---|
[463] | 47 | {
|
---|
| 48 |
|
---|
| 49 | public:
|
---|
[473] | 50 | RenderSimulator(ViewCellsManager *viewCellsManager);
|
---|
[463] | 51 | /** Constructor taking the estimated render cost,
|
---|
| 52 | the view cell overhead,
|
---|
| 53 | and the average move speed of the player into account.
|
---|
| 54 | */
|
---|
[473] | 55 | RenderSimulator(ViewCellsManager *viewCellsManager,
|
---|
| 56 | float objRendercost,
|
---|
| 57 | float vcOverhead,
|
---|
| 58 | float moveSpeed);
|
---|
[463] | 59 |
|
---|
| 60 | /** Sets estimated render time for a single object in the PVS.
|
---|
| 61 | */
|
---|
| 62 | void SetObjectRenderCost(const float objRenderCost);
|
---|
| 63 |
|
---|
| 64 | /** Contant overhead for crossing a view cell border.
|
---|
| 65 | */
|
---|
| 66 | void SetVcOverhead(const float vcOverhead);
|
---|
| 67 |
|
---|
| 68 | /** Average move speed of the player during rendering.
|
---|
| 69 | */
|
---|
| 70 | void SetMoveSpeed(const float moveSpeed);
|
---|
| 71 |
|
---|
[468] | 72 | /** Returns simulation statistics.
|
---|
| 73 | */
|
---|
| 74 | void GetStatistics(SimulationStatistics &simStats) const;
|
---|
[463] | 75 |
|
---|
[468] | 76 | /** Simulates rendering of the scene.
|
---|
| 77 | */
|
---|
| 78 | bool RenderScene();
|
---|
| 79 |
|
---|
[463] | 80 | protected:
|
---|
| 81 |
|
---|
[468] | 82 | /** Probability for crossing one view cell.
|
---|
| 83 | */
|
---|
[477] | 84 | float GetCrossVcProbability() const;
|
---|
[468] | 85 |
|
---|
[463] | 86 | /// render time for single object of the PVS
|
---|
| 87 | float mObjRenderCost;
|
---|
[468] | 88 |
|
---|
[463] | 89 | /// const overhead for crossing a view cell border
|
---|
| 90 | float mVcOverhead;
|
---|
[468] | 91 |
|
---|
[463] | 92 | /// move speed of player
|
---|
| 93 | float mMoveSpeed;
|
---|
| 94 |
|
---|
[468] | 95 | /// Simulation statistics
|
---|
| 96 | SimulationStatistics mSimulationStatistics;
|
---|
[406] | 97 | };
|
---|
| 98 |
|
---|
[468] | 99 | #endif // RenderSimulator |
---|