Line | |
---|
1 | #ifndef __RENDERQUEUE_H
|
---|
2 | #define __RENDERQUEUE_H
|
---|
3 |
|
---|
4 | #include "common.h"
|
---|
5 | #include "Timer/PerfTimer.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | namespace CHCDemoEngine
|
---|
9 | {
|
---|
10 |
|
---|
11 | class RenderState;
|
---|
12 |
|
---|
13 |
|
---|
14 | /** This class implements a render queue that sorts entities according to
|
---|
15 | their materials.
|
---|
16 | */
|
---|
17 | class RenderQueue
|
---|
18 | {
|
---|
19 | public:
|
---|
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 | int GetSize() const { return (int)mEntities.size(); }
|
---|
42 | /** Renders and clears the queue.
|
---|
43 | */
|
---|
44 | void Apply();
|
---|
45 | /** Prints the ordering in the render queue.
|
---|
46 | */
|
---|
47 | void Print();
|
---|
48 |
|
---|
49 | PerfTimer sortTimer;
|
---|
50 |
|
---|
51 |
|
---|
52 | protected:
|
---|
53 |
|
---|
54 | /** Sorts the render queue according to some parameters.
|
---|
55 | */
|
---|
56 | void Sort();
|
---|
57 |
|
---|
58 |
|
---|
59 | ///////////
|
---|
60 |
|
---|
61 | RenderState *mState;
|
---|
62 | SceneEntityContainer mEntities;
|
---|
63 | int mMinSizeForSorting;
|
---|
64 | };
|
---|
65 |
|
---|
66 | }
|
---|
67 |
|
---|
68 | #endif
|
---|
Note: See
TracBrowser
for help on using the repository browser.