#ifndef _RenderSimulator_h__ #define _RenderSimulator_h__ #include "common.h" #include "Statistics.h" class BspTree; class KdTree; class ViewCell; class KdLeaf; 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; void Reset() { maxCost = 0; minCost = 999999; avgRenderTime = 0; avgRtWithoutOverhead = 0; } void Print(ostream &app) const; friend ostream &operator<<(ostream &s, const SimulationStatistics &stat) { stat.Print(s); return s; } }; /** Simulated rendering using a simple render heuristics. Used to evaluate the quality of the view cell partition. */ class RenderSimulator { public: RenderSimulator(); RenderSimulator(float objRendercost, float vcOverhead, float moveSpeed); virtual Real SimulateRendering() = 0; /// 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; SimulationStatistics mStat; }; class BspViewCellRenderSimulator: public RenderSimulator { public: BspViewCellRenderSimulator(float objRenderCost, float vcOverhead, float moveSpeed, BspTree *bspTree); Real SimulateRendering(); protected: /** Simulates rendering of the pvs of one view cell, with given rendering time for an object. @param viewCell the view cell holding the Pvs @param objRenderTime estimated render time for one object of the Pvs */ Real RenderPvs(ViewCell &viewCell, const float objRenderTime) const; BspTree *mBspTree; }; class KdViewCellRenderSimulator: public RenderSimulator { public: KdViewCellRenderSimulator(float objRenderCost, float vcOverhead, float moveSpeed, KdTree *kdTree); Real SimulateRendering(); protected: Real RenderPvs(KdLeaf *leaf, float objRenderTime) const; KdTree *mKdTree; }; #endif // RenderSimulator