Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef AESOP_MAP_KDTREE_H__
00033 #define AESOP_MAP_KDTREE_H__
00034
00035
00036
00037 #include "glut/renderable.h"
00038 #include "map-dynamics/map-dynamics.h"
00039 #include "kdtree/kdtree.h"
00040
00041
00042 namespace aesop {
00043
00044
00079
00082 struct map_draw_stats_t {
00083
00084 map_draw_stats_t(void) throw() { this->clear(); }
00085 void clear(void) throw() {
00086 nObjects = 0;
00087 }
00088
00089
00090 int nObjects;
00091 };
00092
00093
00094
00095 struct kd_node_t {
00096 rect3d_t rect;
00097 int depth;
00098 };
00099
00100
00101 typedef void (*kdtree_callback_fn)(IN const kd_node_t& node,
00102 IN void * context);
00103
00104 typedef void (*kdtree_object_fn)(IN glut::Renderable * model,
00105 IN const glut::render_context_t& rc,
00106 IN glut::RenderQueue * rq,
00107 IN void * context);
00108
00109
00111 class MapKdTree {
00112 public:
00113
00114 virtual ~MapKdTree(void) throw();
00115
00116
00117
00119 virtual MapDynamics * getMapDynamics(void) throw() = 0;
00120
00122 virtual void walkNodes(IN kdtree_callback_fn callback,
00123 IN void * context) = 0;
00124
00126 virtual void walkFrontToBack(IN const glut::render_context_t& rc,
00127 IN glut::RenderQueue * rq,
00128 IN kdtree_object_fn callback,
00129 IN void * context) = 0;
00130
00131
00132 static smart_ptr<MapKdTree> create(IN smart_ptr<MapDynamics>& map);
00133 };
00134
00135
00136
00140 void drawMap(IN MapKdTree * mapKdTree,
00141 IN const glut::render_context_t& rc,
00142 IN glut::RenderQueue * rq,
00143 OUT map_draw_stats_t& stats);
00144
00145
00146
00147 };
00148
00149 #endif // AESOP_MAP_KDTREE_H__
00150