SuperTuxKart
drive_node_3d.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2016 SuperTuxKart-Team
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_DRIVE_NODE_3D_HPP
20 #define HEADER_DRIVE_NODE_3D_HPP
21 
22 #include "tracks/bounding_box_3d.hpp"
23 #include "tracks/drive_node.hpp"
24 #include "utils/cpp2011.hpp"
25 
26 #include <line3d.h>
27 
31 class DriveNode3D : public DriveNode,
32  public BoundingBox3D
33 {
34 private:
38  core::line3df m_line;
39 
40 public:
41  DriveNode3D(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
42  const Vec3 &normal, unsigned int node_index, bool invisible,
43  bool ai_ignore, bool ignored);
44  // ------------------------------------------------------------------------
45  virtual bool pointInside(const Vec3& p,
46  bool ignore_vertical = false) const OVERRIDE
47  {
48  return BoundingBox3D::pointInside(p);
49  }
50  // ------------------------------------------------------------------------
51  virtual void getDistances(const Vec3 &xyz, Vec3 *result) const OVERRIDE;
52  // ------------------------------------------------------------------------
53  virtual float getDistance2FromPoint(const Vec3 &xyz) const OVERRIDE;
54  // ------------------------------------------------------------------------
55  virtual bool is3DQuad() const OVERRIDE { return true; }
56 
57 };
58 #endif
Definition: bounding_box_3d.hpp:27
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:34
Definition: drive_node_3d.hpp:31
virtual bool is3DQuad() const OVERRIDE
Returns true if this quad is 3D, which additional 3D testing is used in pointInside.
Definition: drive_node_3d.hpp:55
This class stores a node of the drive graph, i.e.
Definition: drive_node.hpp:31
virtual float getDistance2FromPoint(const Vec3 &xyz) const OVERRIDE
Returns the square of the distance between the given point and any point on the 'centre' line,...
Definition: drive_node_3d.cpp:63
virtual bool pointInside(const Vec3 &p, bool ignore_vertical=false) const OVERRIDE
Returns true if a point is inside this quad.
Definition: drive_node_3d.hpp:45
core::line3df m_line
Line between lower and upper center, saves computation in getDistance() later.
Definition: drive_node_3d.hpp:38
virtual void getDistances(const Vec3 &xyz, Vec3 *result) const OVERRIDE
Returns the distance a point has from this node in forward and sidewards direction,...
Definition: drive_node_3d.cpp:42