#ifndef _RenderSimulator_h__ #define _RenderSimulator_h__ #include "common.h" #include "Statistics.h" #include "Renderer.h" namespace GtpVisibilityPreprocessor { class SimulationStatistics: public StatisticsBase { public: /// view cell with the biggest "cost" float maxCost; /// view cell with the minimal "cost" float minCost; /// average render time float avgRenderTime; /// average render time with the overhead when crossing view cells float avgRtWithoutOverhead; //-- options counting only valid view cells /// view cell with the biggest "cost" float validMaxCost; /// view cell with the minimal "cost" float validMinCost; /// average render time float validAvgRenderTime; /// average render time with the overhead when crossing view cells float validAvgRtWithoutOverhead; void Reset() { maxCost = 0; minCost = 999999; avgRenderTime = 0; avgRtWithoutOverhead = 0; validMaxCost = 0; validMinCost = 999999; validAvgRenderTime = 0; validAvgRtWithoutOverhead = 0; } void Print(ostream &app) const; friend ostream &operator<<(ostream &s, const SimulationStatistics &stat) { stat.Print(s); return s; } SimulationStatistics() { Reset(); } }; /** Simulated rendering using a simple render heuristics. Used to evaluate the quality of the view cell partition. Evaluates some statistics of the simulation. */ class RenderSimulator: public Renderer { public: RenderSimulator(ViewCellsManager *viewCellsManager); /** Constructor taking the estimated render cost, the view cell overhead, and the average move speed of the player into account. */ RenderSimulator(ViewCellsManager *viewCellsManager, float objRendercost, float vcOverhead, float moveSpeed); /** Sets estimated render time for a single object in the PVS. */ void SetObjectRenderCost(const float objRenderCost); /** Contant overhead for crossing a view cell border. */ void SetVcOverhead(const float vcOverhead); /** Average move speed of the player during rendering. */ void SetMoveSpeed(const float moveSpeed); /** Returns simulation statistics. */ void GetStatistics(SimulationStatistics &simStats) const; /** Simulates rendering of the scene. */ bool RenderScene(); /** If only valid view space should be rendered. */ void SetRenderOnlyValid(const bool onlyValid); protected: /** Probability for crossing one view cell. */ float GetCrossVcProbability() const; /// render time for single object of the PVS float mObjRenderCost; /// const overhead for crossing a view cell border float mVcOverhead; /// move speed of player float mMoveSpeed; /// Simulation statistics SimulationStatistics mSimulationStatistics; }; } #endif // RenderSimulator