37 :
count(0), origin(origin), regions(), world(world)
63 glScalef(scale, scale, 1.0);
66 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
74 std::vector<GLfloat> rects(1000);
95 const GLfloat xx = p + (x <<
RBITS);
96 const GLfloat yy = q + (y <<
RBITS);
100 rects.push_back(xx + 1);
102 rects.push_back(xx + 1);
103 rects.push_back(yy + 1);
105 rects.push_back(yy + 1);
110 const GLfloat xx = p + (x <<
RBITS);
111 const GLfloat yy = q + (y <<
RBITS);
112 const double dx = 0.1;
114 rects.push_back(xx + dx);
115 rects.push_back(yy + dx);
116 rects.push_back(xx + 1 - dx);
117 rects.push_back(yy + dx);
118 rects.push_back(xx + 1 - dx);
119 rects.push_back(yy + 1 - dx);
120 rects.push_back(xx + dx);
121 rects.push_back(yy + 1 - dx);
129 assert(rects.size() % 8 == 0);
130 glVertexPointer(2, GL_FLOAT, 0, &rects[0]);
131 glDrawArrays(GL_QUADS, 0, rects.size() / 2);
141 static inline const std::vector<GLfloat>
DrawBlock(GLfloat x, GLfloat y, GLfloat zmin, GLfloat zmax)
143 std::vector<GLfloat> v(60);
216 glScalef(scale, scale, 1.0);
219 glEnable(GL_DEPTH_TEST);
220 glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
222 std::vector<GLfloat> verts(1000);
223 std::vector<GLfloat> colors(1000);
232 const std::vector<Block *> &blocks = r->
cells[p + (q *
REGIONWIDTH)].blocks[layer];
236 const GLfloat xx(p + (x <<
RBITS));
237 const GLfloat yy(q + (y <<
RBITS));
243 const std::vector<GLfloat> v =
245 verts.insert(verts.end(), v.begin(), v.end());
247 for (
unsigned int i = 0; i < 20; i++) {
248 colors.push_back(c.
r);
249 colors.push_back(c.
g);
250 colors.push_back(c.
b);
259 assert(verts.size() % 60 == 0);
261 glEnableClientState(GL_COLOR_ARRAY);
263 glVertexPointer(3, GL_FLOAT, 0, &verts[0]);
264 glColorPointer(3, GL_FLOAT, 0, &colors[0]);
266 glDrawArrays(GL_QUADS, 0, verts.size() / 3);
268 glDisableClientState(GL_COLOR_ARRAY);
308 blocks[layer].push_back(b);
352 std::vector<Block *> &blks(blocks[layer]);
353 const size_t len(blks.size());
363 if( (blks.size() == 1) &&
377 Block **start = &blks[0];
378 Block **r = &blks[0];
379 Block **w = &blks[0];
381 while (r < start + len)
387 blks.resize(w - start);
391 region->RemoveBlock();
std::vector< Block * > blocks[2]
double Resolution() const
double max
largest value in range, initially zero
The Stage library uses its own namespace.
const uint32_t SRBITS(RBITS+SBITS)
void DrawVoxels(unsigned int layer) const
Region regions[SUPERREGIONSIZE]
void EraseAll(T thing, C &cont)
double min
smallest value in range, initially zero
std::vector< Cell > cells
void AddBlock(Block *b, unsigned int index)
SuperRegion * superregion
void DrawOccupancy(void) const
Bounds global_z
z extent in global coordinates.
void RemoveBlock(Block *b, unsigned int index)
const int32_t REGIONWIDTH(1<< RBITS)
std::vector< Cell * > rendered_cells[2]
const int32_t SUPERREGIONSIZE(SUPERREGIONWIDTH *SUPERREGIONWIDTH)
SuperRegion(World *world, point_int_t origin)
static const std::vector< GLfloat > DrawBlock(GLfloat x, GLfloat y, GLfloat zmin, GLfloat zmax)
BlockGroup * group
The BlockGroup to which this Block belongs.
const int32_t SUPERREGIONWIDTH(1<< SBITS)