1 // This file belongs to the "MiniCore" game engine.
2 // Copyright (C) 2014 Jussi Lind <jussi.lind@iki.fi>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 // MA  02110-1301, USA.
18 //
19 
20 #ifndef MCRENDERLAYER_HH
21 #define MCRENDERLAYER_HH
22 
23 #include <map>
24 #include <set>
25 #include <vector>
26 
27 class MCCamera;
28 class MCObject;
29 class MCParticle;
30 
31 class MCRenderLayer
32 {
33 public:
34     MCRenderLayer();
35 
36     void clear();
37 
38     void setDepthTestEnabled(bool enable);
39 
40     bool depthTestEnabled() const;
41 
42     void setDepthMaskEnabled(bool enable);
43 
44     bool depthMaskEnabled() const;
45 
46     struct ObjectBatch
47     {
48         int objectViewId = -1;
49         float priority = 0;
50         std::vector<MCObject *> objects;
51     };
52 
53     typedef std::map<MCCamera *, std::vector<ObjectBatch>> CameraBatchMap;
54 
55     CameraBatchMap & objectBatches();
56 
57     CameraBatchMap & particleBatches();
58 
59 private:
60     bool m_depthTestEnabled;
61 
62     bool m_depthMaskEnabled;
63 
64     CameraBatchMap m_objectBatches;
65 
66     CameraBatchMap m_particleBatches;
67 };
68 
69 #endif // MCRENDERLAYER_HH
70