source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderQueue.h @ 2801

Revision 2801, 1.2 KB checked in by mattausch, 16 years ago (diff)
Line 
1#ifndef __RENDERQUEUE_H
2#define __RENDERQUEUE_H
3
4#include "common.h"
5#include "Timer/PerfTimer.h"
6
7
8namespace CHCDemoEngine
9{
10
11class RenderState;
12
13
14/** This class implements a render queue that sorts entities according to
15        their materials.
16*/
17class RenderQueue
18{
19public:
20
21        /** Default constructor
22        */
23        RenderQueue();
24        /** Constructor taking a render queue
25        */
26        RenderQueue(RenderState *state);
27        /** Enqueues an entity
28        */
29        void Enqueue(SceneEntity *entity);
30        /** Renders the contents of the render queue.
31        */
32        void Render();
33        /** Sets the current render state
34        */
35        void SetRenderState(RenderState *state);
36        /** Clears the render queue
37        */
38        void Clear();
39        /** Returns the number entities currently in the queue.
40        */
41        inline int GetSize() const { return (int)mEntities.size(); }
42        /** Renders and clears the queue.
43        */
44        void Apply();
45        /** Prints the current state of the render queue.
46        */
47        void Print();
48
49protected:
50
51        /** Sorts the render queue by materials / textures.
52        */
53        void Sort();
54
55
56        ///////////
57
58        RenderState *mState;
59        SceneEntityContainer mEntities;
60        int mMinSizeForSorting;
61};
62
63/// measures sort time for detailed benchmarks
64static PerfTimer sortTimer;
65
66
67}
68
69#endif
Note: See TracBrowser for help on using the repository browser.