75 glScalef( scale, scale, 1.0 );
78 glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
88 std::vector<GLfloat> rects(1000);
113 const GLfloat xx = p+(x<<
RBITS);
114 const GLfloat yy = q+(y<<
RBITS);
116 rects.push_back( xx );
117 rects.push_back( yy );
118 rects.push_back( xx+1 );
119 rects.push_back( yy );
120 rects.push_back( xx+1 );
121 rects.push_back( yy+1 );
122 rects.push_back( xx );
123 rects.push_back( yy+1 );
128 const GLfloat xx = p+(x<<
RBITS);
129 const GLfloat yy = q+(y<<
RBITS);
130 const double dx = 0.1;
132 rects.push_back( xx+dx );
133 rects.push_back( yy+dx );
134 rects.push_back( xx+1-dx );
135 rects.push_back( yy+dx );
136 rects.push_back( xx+1-dx );
137 rects.push_back( yy+1-dx );
138 rects.push_back( xx+dx );
139 rects.push_back( yy+1-dx );
149 assert( rects.size() % 8 == 0 );
150 glVertexPointer( 2, GL_FLOAT, 0, &rects[0] );
151 glDrawArrays( GL_QUADS, 0, rects.size()/2 );
168 static inline const std::vector<GLfloat>
DrawBlock( GLfloat x, GLfloat y, GLfloat zmin, GLfloat zmax )
170 std::vector<GLfloat> v(60);
173 v[0]=x; v[1]=y; v[2]=zmax;
174 v[3]=1+x; v[4]=y; v[5]=zmax;
175 v[6]=1+x; v[7]=1+y; v[8]=zmax;
176 v[9]=x; v[10]=1+y; v[11]=zmax;
179 v[12]=x; v[13]=y; v[14]=zmax;
180 v[15]=x; v[16]=1+y; v[17]=zmax;
181 v[18]=x; v[19]=1+y; v[20]=zmin;
182 v[21]=x; v[22]=y; v[23]=zmin;
183 v[24]=1+x; v[25]=y; v[26]=zmax;
184 v[27]=x; v[28]=y; v[29]=zmax;
185 v[30]=x; v[31]=y; v[32]=zmin;
186 v[33]=1+x; v[34]=y; v[35]=zmin;
187 v[36]=1+x; v[37]=1+y; v[38]=zmax;
188 v[39]=1+x; v[40]=y; v[41]=zmax;
189 v[42]=1+x; v[43]=y; v[44]=zmin;
190 v[45]=1+x; v[46]=1+y; v[47]=zmin;
191 v[48]=x; v[49]=1+y; v[50]=zmax;
192 v[51]=1+x; v[52]=1+y; v[53]=zmax;
193 v[54]=1+x; v[55]=1+y; v[56]=zmin;
194 v[57]=x; v[58]=1+y; v[59]=zmin;
203 glScalef( scale, scale, 1.0 );
207 glEnable( GL_DEPTH_TEST );
208 glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
210 std::vector<GLfloat> verts(1000);
211 std::vector<GLfloat> colors(1000);
222 const std::vector<Block*>& blocks =
227 const GLfloat xx(p+(x<<
RBITS));
228 const GLfloat yy(q+(y<<
RBITS));
236 verts.insert( verts.end(), v.begin(), v.end() );
238 for(
unsigned int i=0; i<20; i++ )
240 colors.push_back( c.
r );
241 colors.push_back( c.
g );
242 colors.push_back( c.
b );
252 assert( verts.size() % 60 == 0 );
254 glEnableClientState( GL_COLOR_ARRAY );
256 glVertexPointer( 3, GL_FLOAT, 0, &verts[0] );
257 glColorPointer( 3, GL_FLOAT, 0, &colors[0] );
259 glDrawArrays( GL_QUADS, 0, verts.size()/3 );
261 glDisableClientState( GL_COLOR_ARRAY );
269 blocks[layer].push_back( b );
276 std::vector<Block*>& blks( blocks[layer] );
277 const size_t len( blks.size() );
288 if( (blks.size() == 1) &&
301 Block **start = &blks[0];
302 Block **r = &blks[0];
303 Block **w = &blks[0];
305 while( r < start + len )
311 blks.resize( w-start );
315 region->RemoveBlock();
double max
largest value in range, initially zero
The Stage library uses its own namespace.
const int32_t SRBITS(RBITS+SBITS)
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 DrawVoxels(unsigned int layer) const
double Resolution() const
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)
void DrawOccupancy(void) const
std::vector< Block * > blocks[2]
SuperRegion(World *world, point_int_t origin)
static const std::vector< GLfloat > DrawBlock(GLfloat x, GLfloat y, GLfloat zmin, GLfloat zmax)
const int32_t SUPERREGIONWIDTH(1<< SBITS)