source: trunk/VUT/GtpVisibilityPreprocessor/src/RenderSimulator.h @ 564

Revision 564, 2.4 KB checked in by mattausch, 19 years ago (diff)
Line 
1#ifndef _RenderSimulator_h__
2#define _RenderSimulator_h__
3
4#include "common.h"
5#include "Statistics.h"
6#include "Renderer.h"
7
8
9class SimulationStatistics: public StatisticsBase
10{
11public:
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*/
46class RenderSimulator: public Renderer
47{
48
49public:
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        /** If only valid view space should be rendered.
81        */
82        void SetRenderOnlyValid(const bool onlyValid);
83
84protected:
85
86        /** Probability for crossing one view cell.
87        */
88        float GetCrossVcProbability() const;
89
90        /// render time for single object of the PVS
91        float mObjRenderCost;
92       
93        /// const overhead for crossing a view cell border
94        float mVcOverhead;
95
96        /// move speed of player
97        float mMoveSpeed;
98
99        /// Simulation statistics
100        SimulationStatistics mSimulationStatistics;
101
102        /// if only valid view space should be rendered
103        bool mOnlyValid;
104};
105
106#endif // RenderSimulator
Note: See TracBrowser for help on using the repository browser.