SuperTuxKart
Loading...
Searching...
No Matches
arena_node.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_ARENA_NODE_HPP
20#define HEADER_ARENA_NODE_HPP
21
22#include "tracks/quad.hpp"
23#include "utils/cpp2011.hpp"
24
25#include <line3d.h>
26#include <vector>
27
31class ArenaNode : public Quad
32{
33private:
34 core::line3df m_line;
35
36 std::vector<int> m_adjacent_nodes;
37
38 std::vector<int> m_nearby_nodes;
39
40public:
41 ArenaNode(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
42 const Vec3 &normal, unsigned int node_index);
43 // ------------------------------------------------------------------------
44 virtual ~ArenaNode() {}
45 // ------------------------------------------------------------------------
46 const std::vector<int>& getAdjacentNodes() { return m_adjacent_nodes; }
47 // ------------------------------------------------------------------------
48 std::vector<int>* getNearbyNodes() { return &m_nearby_nodes; }
49 // ------------------------------------------------------------------------
50 void setAdjacentNodes(const std::vector<int>& nodes)
51 {
52 m_adjacent_nodes = nodes;
53 }
54 // ------------------------------------------------------------------------
55 void setNearbyNodes(const std::vector<int>& nodes)
56 {
57 m_nearby_nodes = nodes;
58 }
59 // ------------------------------------------------------------------------
63 bool isNearEdge() const { return m_adjacent_nodes.size() != 4; }
64 // ------------------------------------------------------------------------
65 virtual float getDistance2FromPoint(const Vec3 &xyz) const OVERRIDE;
66
67};
68
69#endif
Definition: arena_node.hpp:32
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: arena_node.cpp:41
bool isNearEdge() const
Returns true if the quad lies near the edge, which means it doesn't have 4 adjacent quads.
Definition: arena_node.hpp:63
Definition: quad.hpp:38
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35