void NavMesh::dtDraw() { drawObstacles(); _debugDraw.depthMask(false); duDebugDrawNavMeshWithClosedList(&_debugDraw, *_navMesh, *_navMeshQuery, DU_DRAWNAVMESH_OFFMESHCONS | DU_DRAWNAVMESH_CLOSEDLIST/* | DU_DRAWNAVMESH_COLOR_TILES*/); drawAgents(); drawOffMeshConnections(); _debugDraw.depthMask(true); }
void simulationGrid::draw() { int i, j, k, tmpAgents; /* Graphic Reinitialization */ if (!valid()) { init(); resized = true; } /* If Restart Button is pressed */ if(restartB) { tmpAgents = gui_linear_lattice_dimension*gui_linear_lattice_dimension; m.init(gui_linear_lattice_dimension, tmpAgents, NFEATURES, gui_pos_traits, OUTDEGREE, gui_delta, m.maxSide, w(), h()); restartB = false; simStepLabel->value(0); restart = false; restartS = true; } /* Catch parameters from gui and reinit if needed */ else if((m.delta != gui_delta) || (m.pos_traits != gui_pos_traits ) || (m.linear_lattice_dimension != gui_linear_lattice_dimension) || restart) { tmpAgents = gui_linear_lattice_dimension*gui_linear_lattice_dimension; if(latticeOn) { m.init(gui_linear_lattice_dimension, tmpAgents, NFEATURES, gui_pos_traits, OUTDEGREE, gui_delta, 1,w(), h()); restartS = true; } else if(kleinbergOn) { m.init(gui_linear_lattice_dimension, tmpAgents, NFEATURES, gui_pos_traits, OUTDEGREE, gui_delta, 0, w(), h()); restartS = true; } else { m.init(gui_linear_lattice_dimension, tmpAgents, NFEATURES, gui_pos_traits, OUTDEGREE, gui_delta, -1, w(), h()); restartS = true; } restart = false; } /* Clear display */ glClear(GL_COLOR_BUFFER_BIT); if(linkVisualization) { for (i=0;i<m.agents;i++) { link(i); } } /* Draws all Agents */ for(i=0; i<m.agents;i++) { drawAgents(i,MIN(w(),h())); } /* Simulation Step */ m.step(); /* Compute Regions */ computeRegions(); g1->redraw(); g2->redraw(); g3->redraw(); }
void renderScene(void) { update(); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); glViewport(0,0, field_width, field_height); // Draw quad to the screen in the corner glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboId); setupMatrices(0); int pass = number_of_passes; while (pass-- > 0) { // Swap source and destination src = 1-src; dest = 1-dest; // Draw to the source to update agent positions glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + src); drawBorder(); drawAgents(); // Draw mouse "agent" drawMouse(); // Draw the shader to destination texture glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + dest); //glClear(GL_COLOR_BUFFER_BIT); //Using the field shader glUseProgramObjectARB(fieldShaderId); glUniform1iARB(fieldUniform, 7); glActiveTextureARB(GL_TEXTURE7); glBindTexture(GL_TEXTURE_2D, fieldTexIds[src]); drawFullScreenFieldQuad(); glUseProgramObjectARB(0); glBindTexture(GL_TEXTURE_2D, 0); } setupMatrices(1); glViewport(0,0, window_width, window_height); // Draw quad to the screen glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glClear( GL_COLOR_BUFFER_BIT); if (showField) { glActiveTextureARB(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, fieldTexIds[dest]); glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glEnable( GL_TEXTURE_2D ); drawFullScreenWindowQuad(); glDisable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D, 0); } if (showField != 1) { float multx = window_width * 0.002; float multy = window_height * 0.002; glPointSize(5); int i; glColor3f(1,1,1); glBegin(GL_POINTS); for (i=0; i < maxAgents; i++) { if (agents[i].active) { glVertex2f(agents[i].pos[0] * multx + 2, window_height - agents[i].pos[1] * multy - 2); } } glEnd(); glPointSize(0.5); } glutSwapBuffers(); if (vfgl_DrawCallback) vfgl_DrawCallback(); }