19#ifndef HEADER_GRAPH_HPP
20#define HEADER_GRAPH_HPP
22#include "utils/no_copy.hpp"
23#include "utils/vec3.hpp"
25#include <dimension2d.h>
33 namespace scene {
class ISceneNode;
class IMesh;
class IMeshBuffer; }
34 namespace video {
class ITexture;
struct S3DVertex;
class SColor; }
55 static Graph* m_graph;
57 std::vector<Quad*> m_all_nodes;
63 const Vec3 &p3,
unsigned int node_index,
64 bool invisible,
bool ai_ignore,
bool is_arena,
95 bool enable_transparency=
false,
96 const video::SColor *track_color=NULL,
97 bool invert_x_z =
false,
bool flatten =
false);
100 bool enable_transparency=
false,
101 const video::SColor *track_color=NULL,
102 bool invert_x_z =
false);
106 virtual bool hasLapLine()
const = 0;
108 virtual void differentNodeColor(
int n, video::SColor* c)
const = 0;
111 static const int UNKNOWN_SECTOR;
113 static const float MIN_HEIGHT_TESTING;
114 static const float MAX_HEIGHT_TESTING;
124 assert(m_graph == NULL);
147 const std::string &name,
148 const video::SColor &fill_color,
153 Quad* getQuad(
unsigned int i)
const
155 assert(i < m_all_nodes.size());
156 return m_all_nodes[i];
159 unsigned int getNumNodes()
const {
return (
unsigned int)m_all_nodes.size(); }
162 std::vector<int> *all_sectors = NULL,
163 bool ignore_vertical =
false)
const;
166 const int curr_sector = UNKNOWN_SECTOR,
167 std::vector<int> *all_sectors = NULL,
168 bool ignore_vertical =
false)
const;
172 const Vec3& getBBMax()
const {
return m_bb_max; }
174 const int* getBBNodes()
const {
return m_bb_nodes; }
This class stores a graph of quads.
Definition: graph.hpp:53
void createMeshSP(bool show_invisible=true, bool enable_transparency=false, const video::SColor *track_color=NULL, bool invert_x_z=false)
Creates the actual mesh that is used by createDebugMesh() or makeMiniMap()
Definition: graph.cpp:292
void createQuad(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3, unsigned int node_index, bool invisible, bool ai_ignore, bool is_arena, bool ignore)
Factory method to dynamic create 2d / 3d quad for drive and arena graph.
Definition: graph.cpp:598
void findRoadSector(const Vec3 &XYZ, int *sector, std::vector< int > *all_sectors=NULL, bool ignore_vertical=false) const
findRoadSector returns in which sector on the road the position xyz is.
Definition: graph.cpp:667
scene::ISceneNode * m_node
The node of the graph mesh.
Definition: graph.hpp:79
scene::IMeshBuffer * m_mesh_buffer
The actual mesh buffer storing the graph.
Definition: graph.hpp:85
void loadBoundingBoxNodes()
Map 4 bounding box points to 4 closest graph nodes.
Definition: graph.cpp:825
static void destroy()
Cleans up the graph.
Definition: graph.hpp:131
int findOutOfRoadSector(const Vec3 &xyz, const int curr_sector=UNKNOWN_SECTOR, std::vector< int > *all_sectors=NULL, bool ignore_vertical=false) const
findOutOfRoadSector finds the sector where XYZ is, but as it name implies, it is more accurate for th...
Definition: graph.cpp:741
float m_scaling
Scaling for mini map.
Definition: graph.hpp:88
static void setGraph(Graph *graph)
Set the graph (either drive or arena graph for now).
Definition: graph.hpp:122
void createMesh(bool show_invisible=true, bool enable_transparency=false, const video::SColor *track_color=NULL, bool invert_x_z=false, bool flatten=false)
Creates the actual mesh that is used by createDebugMesh() or makeMiniMap()
Definition: graph.cpp:140
void createDebugMesh()
Creates the debug mesh to display the graph on top of the track model.
Definition: graph.cpp:76
scene::IMesh * m_mesh
The mesh of the graph mesh.
Definition: graph.hpp:82
std::unique_ptr< RenderTarget > m_render_target
The render target used for drawing the minimap.
Definition: graph.hpp:91
void mapPoint2MiniMap(const Vec3 &xyz, Vec3 *out) const
Returns the 2d coordinates of a point when drawn on the mini map texture.
Definition: graph.cpp:590
void cleanupDebugMesh()
Cleans up the debug mesh.
Definition: graph.cpp:125
RenderTarget * makeMiniMap(const core::dimension2du &dimension, const std::string &name, const video::SColor &fill_color, bool invert_x_z)
Takes a snapshot of the graph so they can be used as minimap.
Definition: graph.cpp:425
int m_bb_nodes[4]
The 4 closest graph nodes to the bounding box.
Definition: graph.hpp:76
static Graph * get()
Returns the one instance of this object.
Definition: graph.hpp:119
Vec3 m_bb_min
The 2d bounding box, used for hashing.
Definition: graph.hpp:72
Utility class, you can inherit from this class to disallow the assignment operator and copy construct...
Definition: no_copy.hpp:26
Definition: render_target.hpp:42
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35