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 | 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 | }
|
---|
41 | };
|
---|
42 |
|
---|
43 | /** Simulated rendering using a simple render heuristics. Used to evaluate the
|
---|
44 | quality of the view cell partition. Evaluates some statistics of the simulation.
|
---|
45 | */
|
---|
46 | class RenderSimulator: public Renderer
|
---|
47 | {
|
---|
48 |
|
---|
49 | public:
|
---|
50 | RenderSimulator(ViewCellsManager *viewCellsManager);
|
---|
51 | /** Constructor taking the estimated render cost,
|
---|
52 | the view cell overhead,
|
---|
53 | and the average move speed of the player into account.
|
---|
54 | */
|
---|
55 | RenderSimulator(ViewCellsManager *viewCellsManager,
|
---|
56 | float objRendercost,
|
---|
57 | float vcOverhead,
|
---|
58 | float moveSpeed);
|
---|
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 |
|
---|
72 | /** Returns simulation statistics.
|
---|
73 | */
|
---|
74 | void GetStatistics(SimulationStatistics &simStats) const;
|
---|
75 |
|
---|
76 | /** Simulates rendering of the scene.
|
---|
77 | */
|
---|
78 | bool RenderScene();
|
---|
79 |
|
---|
80 | protected:
|
---|
81 |
|
---|
82 | /** Probability for crossing one view cell.
|
---|
83 | */
|
---|
84 | float GetCrossVcProbability() const;
|
---|
85 |
|
---|
86 | /// render time for single object of the PVS
|
---|
87 | float mObjRenderCost;
|
---|
88 |
|
---|
89 | /// const overhead for crossing a view cell border
|
---|
90 | float mVcOverhead;
|
---|
91 |
|
---|
92 | /// move speed of player
|
---|
93 | float mMoveSpeed;
|
---|
94 |
|
---|
95 | /// Simulation statistics
|
---|
96 | SimulationStatistics mSimulationStatistics;
|
---|
97 | };
|
---|
98 |
|
---|
99 | #endif // RenderSimulator |
---|