SuperTuxKart
draw_calls.hpp
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 <vector>
24 
25 #include <irrArray.h>
26 #include <plane3d.h>
27 #include <vector3d.h>
28 
29 using namespace irr;
30 
31 namespace irr
32 {
33  namespace scene
34  {
35  class ISceneNode; class ICameraSceneNode;
36  }
37 }
38 
39 class ShadowMatrices;
40 
41 class DrawCalls
42 {
43 private:
44  GLsync m_sync;
45  std::vector<float> m_bounding_boxes;
46 
47  void parseSceneManager(core::array<scene::ISceneNode*> &List,
48  const scene::ICameraSceneNode *cam);
49 
50  bool isCulledPrecise(const scene::ICameraSceneNode *cam,
51  const scene::ISceneNode* node,
52  bool visualization = false);
53 
54  bool isBoxInFrontOfPlane(const core::plane3df &plane,
55  const core::vector3df* edges);
56 
57  void addEdgeForViz(const core::vector3df &p0, const core::vector3df &p1);
58 
59 public:
60  DrawCalls();
61  ~DrawCalls();
62 
63  void prepareDrawCalls(irr::scene::ICameraSceneNode *camnode);
64 
65  void renderBoundingBoxes();
66 
67  void setFenceSync() { m_sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); }
68 };
69 
70 #endif // !SERVER_ONLY
71 #endif //HEADER_DRAW_CALLS_HPP
Definition: draw_calls.hpp:42
Definition: shadow_matrices.hpp:40