[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 |
|
---|
[574] | 21 | //-- options counting only valid view cells
|
---|
| 22 |
|
---|
| 23 | /// view cell with the biggest "cost"
|
---|
| 24 | float validMaxCost;
|
---|
| 25 | /// view cell with the minimal "cost"
|
---|
| 26 | float validMinCost;
|
---|
| 27 | /// average render time
|
---|
| 28 | float validAvgRenderTime;
|
---|
| 29 | /// average render time with the overhead when crossing view cells
|
---|
| 30 | float validAvgRtWithoutOverhead;
|
---|
| 31 |
|
---|
[463] | 32 | void Reset()
|
---|
| 33 | {
|
---|
| 34 | maxCost = 0;
|
---|
| 35 | minCost = 999999;
|
---|
| 36 | avgRenderTime = 0;
|
---|
| 37 | avgRtWithoutOverhead = 0;
|
---|
[574] | 38 |
|
---|
| 39 | validMaxCost = 0;
|
---|
| 40 | validMinCost = 999999;
|
---|
| 41 | validAvgRenderTime = 0;
|
---|
| 42 | validAvgRtWithoutOverhead = 0;
|
---|
[463] | 43 | }
|
---|
| 44 |
|
---|
| 45 | void Print(ostream &app) const;
|
---|
| 46 |
|
---|
| 47 | friend ostream &operator<<(ostream &s, const SimulationStatistics &stat)
|
---|
| 48 | {
|
---|
| 49 | stat.Print(s);
|
---|
| 50 | return s;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | SimulationStatistics()
|
---|
| 54 | {
|
---|
| 55 | Reset();
|
---|
| 56 | }
|
---|
[414] | 57 | };
|
---|
| 58 |
|
---|
[463] | 59 | /** Simulated rendering using a simple render heuristics. Used to evaluate the
|
---|
[468] | 60 | quality of the view cell partition. Evaluates some statistics of the simulation.
|
---|
[463] | 61 | */
|
---|
[468] | 62 | class RenderSimulator: public Renderer
|
---|
[463] | 63 | {
|
---|
| 64 |
|
---|
| 65 | public:
|
---|
[473] | 66 | RenderSimulator(ViewCellsManager *viewCellsManager);
|
---|
[463] | 67 | /** Constructor taking the estimated render cost,
|
---|
| 68 | the view cell overhead,
|
---|
| 69 | and the average move speed of the player into account.
|
---|
| 70 | */
|
---|
[473] | 71 | RenderSimulator(ViewCellsManager *viewCellsManager,
|
---|
| 72 | float objRendercost,
|
---|
| 73 | float vcOverhead,
|
---|
| 74 | float moveSpeed);
|
---|
[463] | 75 |
|
---|
| 76 | /** Sets estimated render time for a single object in the PVS.
|
---|
| 77 | */
|
---|
| 78 | void SetObjectRenderCost(const float objRenderCost);
|
---|
| 79 |
|
---|
| 80 | /** Contant overhead for crossing a view cell border.
|
---|
| 81 | */
|
---|
| 82 | void SetVcOverhead(const float vcOverhead);
|
---|
| 83 |
|
---|
| 84 | /** Average move speed of the player during rendering.
|
---|
| 85 | */
|
---|
| 86 | void SetMoveSpeed(const float moveSpeed);
|
---|
| 87 |
|
---|
[468] | 88 | /** Returns simulation statistics.
|
---|
| 89 | */
|
---|
| 90 | void GetStatistics(SimulationStatistics &simStats) const;
|
---|
[463] | 91 |
|
---|
[468] | 92 | /** Simulates rendering of the scene.
|
---|
| 93 | */
|
---|
| 94 | bool RenderScene();
|
---|
| 95 |
|
---|
[564] | 96 | /** If only valid view space should be rendered.
|
---|
| 97 | */
|
---|
| 98 | void SetRenderOnlyValid(const bool onlyValid);
|
---|
| 99 |
|
---|
[463] | 100 | protected:
|
---|
| 101 |
|
---|
[468] | 102 | /** Probability for crossing one view cell.
|
---|
| 103 | */
|
---|
[477] | 104 | float GetCrossVcProbability() const;
|
---|
[468] | 105 |
|
---|
[463] | 106 | /// render time for single object of the PVS
|
---|
| 107 | float mObjRenderCost;
|
---|
[468] | 108 |
|
---|
[463] | 109 | /// const overhead for crossing a view cell border
|
---|
| 110 | float mVcOverhead;
|
---|
[468] | 111 |
|
---|
[463] | 112 | /// move speed of player
|
---|
| 113 | float mMoveSpeed;
|
---|
| 114 |
|
---|
[468] | 115 | /// Simulation statistics
|
---|
| 116 | SimulationStatistics mSimulationStatistics;
|
---|
[406] | 117 | };
|
---|
| 118 |
|
---|
[468] | 119 | #endif // RenderSimulator |
---|