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