source: GTP/trunk/Lib/Vis/Preprocessing/src/RenderSimulator.h @ 2176

Revision 2176, 2.8 KB checked in by mattausch, 18 years ago (diff)

removed using namespace std from .h

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