1 //  SuperTuxKart - a fun racing game with go-kart
2 //  Copyright (C) 2015 SuperTuxKart-Team
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 3
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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17 
18 #ifndef HEADER_DRAW_CALLS_HPP
19 #define HEADER_DRAW_CALLS_HPP
20 
21 #ifndef SERVER_ONLY
22 #include "graphics/gl_headers.hpp"
23 #include <irrlicht.h>
24 #include <vector>
25 
26 using namespace irr;
27 
28 class ShadowMatrices;
29 
30 class DrawCalls
31 {
32 private:
33     GLsync                                m_sync;
34     std::vector<float>                    m_bounding_boxes;
35 
36     void parseSceneManager(core::list<scene::ISceneNode*> &List,
37                            const scene::ICameraSceneNode *cam);
38 
39     bool isCulledPrecise(const scene::ICameraSceneNode *cam,
40                          const scene::ISceneNode* node,
41                          bool visualization = false);
42 
43     bool isBoxInFrontOfPlane(const core::plane3df &plane,
44                              const core::vector3df* edges);
45 
46     void addEdgeForViz(const core::vector3df &p0, const core::vector3df &p1);
47 
48 public:
49     DrawCalls();
50     ~DrawCalls();
51 
52     void prepareDrawCalls(irr::scene::ICameraSceneNode *camnode);
53 
54     void renderBoundingBoxes();
55 
setFenceSync()56     void setFenceSync() { m_sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); }
57 };
58 
59 #endif   // !SERVER_ONLY
60 #endif //HEADER_DRAW_CALLS_HPP
61