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

Revision 468, 2.1 KB checked in by mattausch, 19 years ago (diff)

updated rendersimulator

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();
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(float objRendercost, float vcOverhead, float moveSpeed);
56
57        /** Sets estimated render time for a single object in the PVS.
58        */
59        void SetObjectRenderCost(const float objRenderCost);
60
61        /** Contant overhead for crossing a view cell border.
62        */
63        void SetVcOverhead(const float vcOverhead);
64
65        /** Average move speed of the player during rendering.
66        */
67        void SetMoveSpeed(const float moveSpeed);
68
69        /** Returns simulation statistics.
70        */
71        void GetStatistics(SimulationStatistics &simStats) const;
72
73        /** Simulates rendering of the scene.
74        */
75        bool RenderScene();
76
77protected:
78
79        /** Probability for crossing one view cell.
80        */
81        float GetCrossVcProbability();
82
83        /// render time for single object of the PVS
84        float mObjRenderCost;
85       
86        /// const overhead for crossing a view cell border
87        float mVcOverhead;
88
89        /// move speed of player
90        float mMoveSpeed;
91
92        /// Simulation statistics
93        SimulationStatistics mSimulationStatistics;
94};
95
96#endif // RenderSimulator
Note: See TracBrowser for help on using the repository browser.