1 | #ifndef _RenderSimulator_h__
|
---|
2 | #define _RenderSimulator_h__
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "Statistics.h"
|
---|
6 | #include "Renderer.h"
|
---|
7 |
|
---|
8 |
|
---|
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 | //-- 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 |
|
---|
32 | void Reset()
|
---|
33 | {
|
---|
34 | maxCost = 0;
|
---|
35 | minCost = 999999;
|
---|
36 | avgRenderTime = 0;
|
---|
37 | avgRtWithoutOverhead = 0;
|
---|
38 |
|
---|
39 | validMaxCost = 0;
|
---|
40 | validMinCost = 999999;
|
---|
41 | validAvgRenderTime = 0;
|
---|
42 | validAvgRtWithoutOverhead = 0;
|
---|
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 | }
|
---|
57 | };
|
---|
58 |
|
---|
59 | /** Simulated rendering using a simple render heuristics. Used to evaluate the
|
---|
60 | quality of the view cell partition. Evaluates some statistics of the simulation.
|
---|
61 | */
|
---|
62 | class RenderSimulator: public Renderer
|
---|
63 | {
|
---|
64 |
|
---|
65 | public:
|
---|
66 | RenderSimulator(ViewCellsManager *viewCellsManager);
|
---|
67 | /** Constructor taking the estimated render cost,
|
---|
68 | the view cell overhead,
|
---|
69 | and the average move speed of the player into account.
|
---|
70 | */
|
---|
71 | RenderSimulator(ViewCellsManager *viewCellsManager,
|
---|
72 | float objRendercost,
|
---|
73 | float vcOverhead,
|
---|
74 | float moveSpeed);
|
---|
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 |
|
---|
88 | /** Returns simulation statistics.
|
---|
89 | */
|
---|
90 | void GetStatistics(SimulationStatistics &simStats) const;
|
---|
91 |
|
---|
92 | /** Simulates rendering of the scene.
|
---|
93 | */
|
---|
94 | bool RenderScene();
|
---|
95 |
|
---|
96 | /** If only valid view space should be rendered.
|
---|
97 | */
|
---|
98 | void SetRenderOnlyValid(const bool onlyValid);
|
---|
99 |
|
---|
100 | protected:
|
---|
101 |
|
---|
102 | /** Probability for crossing one view cell.
|
---|
103 | */
|
---|
104 | float GetCrossVcProbability() const;
|
---|
105 |
|
---|
106 | /// render time for single object of the PVS
|
---|
107 | float mObjRenderCost;
|
---|
108 |
|
---|
109 | /// const overhead for crossing a view cell border
|
---|
110 | float mVcOverhead;
|
---|
111 |
|
---|
112 | /// move speed of player
|
---|
113 | float mMoveSpeed;
|
---|
114 |
|
---|
115 | /// Simulation statistics
|
---|
116 | SimulationStatistics mSimulationStatistics;
|
---|
117 | };
|
---|
118 |
|
---|
119 | #endif // RenderSimulator |
---|