void roadmap_bar_draw_top_bar (BOOL draw_bg) { int width; if (!bar_initialized) return; if ( gHideTopBar ) return; width = roadmap_canvas_width (); if (TopBarObjectTable.draw_bg && draw_bg){ RoadMapGuiPoint BarLocation; BarLocation.y = 0; BarLocation.x = 0; //if ( TopBarFullBg ) //{ // roadmap_canvas_draw_image (TopBarFullBg, &BarLocation, 0, 2 ); //} //else //{ // drawBarBGImage( TOP_BAR_IMAGE, &BarLocation ); //} } draw_objects(&TopBarObjectTable); }
void draw_scene(void){ clear_window(); change_observer(); draw_axis(); draw_objects(); glutSwapBuffers(); }
void my_display() { // clear all pixels, reset depth glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); //setup the camera (1st person? 3rd person?) if(firstPersonView == 0) { gluLookAt(10,10,75,10,10,20,0,1,0); }else { gluLookAt(my_cam.pos[0],my_cam.pos[1], my_cam.pos[2], my_cam.at[0],my_cam.at[1],my_cam.at[2], my_cam.up[0], my_cam.up[1], my_cam.up[2]); } //update the flashlight to follow the person glLightfv(GL_LIGHT0, GL_POSITION, my_cam.at); glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, my_cam.dir); //draw the objects draw_axes(); draw_objects(); // this buffer is ready glutSwapBuffers(); }
void CLevelGraph::render () { if (psAI_Flags.test(aiDrawGameGraph)) { // if (psHUD_Flags.test(HUD_DRAW)) draw_game_graph (); } if (!bDebug && !psAI_Flags.test(aiMotion)) return; if (bDebug && psAI_Flags.test(aiDebug)) draw_nodes (); draw_restrictions (); if (psAI_Flags.test(aiCover)) draw_covers (); if (!psHUD_Flags.test(HUD_DRAW)) return; if (psAI_Flags.test(aiMotion)) draw_objects (); #ifdef DEBUG draw_debug_node (); #endif }
void roadmap_bar_draw_bottom_bar (BOOL draw_bg) { int i; int num_images; int image_width, image_height; int screen_width, screen_height; screen_width = roadmap_canvas_width (); screen_height = roadmap_canvas_height(); if (!bar_initialized) return; if (gHideBottomBar) return; image_width = roadmap_canvas_image_width(BottomBarBgImage); image_height = roadmap_canvas_image_height(BottomBarBgImage); if (BottomBarObjectTable.draw_bg && draw_bg){ num_images = screen_width / image_width; for (i = 0; i < num_images; i++){ RoadMapGuiPoint BarLocation; BarLocation.y = screen_height - image_height; BarLocation.x = i * image_width; roadmap_canvas_draw_image (BottomBarBgImage, &BarLocation, 0, IMAGE_NORMAL); } } draw_objects(&BottomBarObjectTable); }
void roadmap_bar_draw_top_bar (BOOL draw_bg) { int i; int num_images; static int image_width = -1; int width; width = roadmap_canvas_width (); if (!bar_initialized) return; if ( gHideTopBar ) return; if (TopBarObjectTable.draw_bg && draw_bg){ if (image_width == -1) image_width = roadmap_canvas_image_width(TopBarBgImage); num_images = width / image_width + 1; for (i = 0; i < num_images; i++){ RoadMapGuiPoint BarLocation; BarLocation.y = 0; BarLocation.x = i * image_width; roadmap_canvas_draw_image (TopBarBgImage, &BarLocation, 0,IMAGE_NORMAL); } } draw_objects(&TopBarObjectTable); }
int main(int argc, char** argv) { if (argc != 2) { fprintf(stderr, "Usage: %s [imagepath]\n", argv[0]); return -1; } const char* imagepath = argv[1]; cv::Mat m = cv::imread(imagepath, CV_LOAD_IMAGE_COLOR); if (m.empty()) { fprintf(stderr, "cv::imread %s failed\n", imagepath); return -1; } std::vector<Object> objects; long time = getTimeUsec(); detect_mobilenetv2(m, objects); time = getTimeUsec() - time; printf("detection time: %ld ms\n",time/1000); draw_objects(m, objects); return 0; }
void roadmap_bar_draw_bottom_bar (BOOL draw_bg) { int image_width, image_height; int screen_width, screen_height; if (!bar_initialized) return; if (gHideBottomBar) return; screen_width = roadmap_canvas_width (); screen_height = roadmap_canvas_height(); image_width = BottomBarBgImageSize.width; image_height = BottomBarBgImageSize.height; if (BottomBarObjectTable.draw_bg && draw_bg){ RoadMapGuiPoint BarLocation; BarLocation.y = screen_height - image_height; BarLocation.x = 0; if ( BottomBarFullBg ) { roadmap_canvas_draw_image (BottomBarFullBg, &BarLocation, 0, IMAGE_NORMAL); } else { drawBarBGImage( BOTTOM_BAR_IMAGE, &BarLocation ); } } draw_objects(&BottomBarObjectTable); }
//-------------------------------------------------------------- void testApp::draw(){ ofSetRectMode(OF_RECTMODE_CORNER); ofRect(boxArray[1].min.x,boxArray[1].min.y,400,400); ofSetColor(0,0,0); char infoString[255]; sprintf(infoString,"w: %i h: %i fps: %f", ofGetWidth(),ofGetHeight(), ofGetFrameRate()); arial.drawString(infoString, 20, 20); draw_objects(); draw_ground(); }
static unsigned long kaleidescope_draw (Display *dpy, Window window, void *closure) { GLOBAL *g = (GLOBAL *) closure; if (g->done_once) propigate_objects(g); else g->done_once = 1; draw_objects (g); return g->delay; }
void draw_scene(t_draw *draw, t_scene *scene) { // Edit Mode if(scene->edit_mode) draw->edit_mode = 1; else draw->edit_mode = 0; // Objects draw_lights(draw,scene); draw_objects(draw,scene); draw_axis_world(draw); }
UINT32 ssrj_state::screen_update_ssrj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_tilemap1->set_scrollx(0, 0xff-m_scrollram[2] ); m_tilemap1->set_scrolly(0, m_scrollram[0] ); m_tilemap1->draw(bitmap, cliprect, 0, 0); draw_objects(bitmap, cliprect); m_tilemap2->draw(bitmap, cliprect, 0, 0); if (m_scrollram[0x101] == 0xb) m_tilemap4->draw(bitmap, cliprect, 0, 0);/* hack to display 4th tilemap */ return 0; }
// loop for drawing objects void game_loop_objects(GLFWwindow* win, const int option, const Shader& shad) { while (!glfwWindowShouldClose(win)) { glfwPollEvents(); glClearColor(0.2, 0.2, 0.2, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); draw_objects(shad, option); glfwSwapBuffers(win); } }
/** * draw_all * The master draw function that draws everything. */ void draw_all(Game* game) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); draw_hud(game); draw_objects(game); draw_zoom_square(game, game->screen_width); glFlush(); glutSwapBuffers(); }
void renderer::render() { game* g = game::instance(); gamemap* m = g->map(); int y, x, xpx, ypx; // SDL_SetRenderDrawColor(renderer_, 0, 0, 0, 255); // SDL_RenderClear(renderer_); // draw_tile(0, 0, 0); for (y=0, ypx=0; y < m->height(); ++y, ypx += TILE_SIZE) { for (x=0, xpx=0; x < m->width(); ++x, xpx += TILE_SIZE) { draw_tile(m->get(x, y) == '.' ? ID_WALL : ID_BACKGROUND, xpx, ypx); } } // Items draw_objects(m->items()); // Zombies draw_objects(m->zombies()); // Exits draw_objects(m->exits()); // Elevators draw_objects(m->elevators()); // Specials draw_objects(m->specials()); // Fireballs draw_objects(m->fireballs()); // Player draw(m->getplayer()); SDL_RenderPresent(renderer_); }
static int mouse(Objects * objects, int ax, int ay, int box) { int first; int stat; int x, y, button; Objects *obj; first = !active; active = 1; if (first) use_mouse_msg(); if (box) { x = ax + 20; y = ay + 20; } stat = 0; replot = 1; while (stat == 0) { if (replot) { replot = 0; draw_objects(objects); } if (box) Mouse_box_anchored(ax, ay, &x, &y, &button); else Mouse_pointer(&x, &y, &button); if (!(obj = find(objects, x, y))) continue; switch (obj->type) { case MENU_OBJECT: case OTHER_OBJECT: stat = (*obj->handler) (x, y, button); break; case OPTION_OBJECT: select_option(objects, obj); draw_option_boxes(objects); break; } } /* if we are first call, mark not active * indicate that objects above use must be replotted. */ if (first) active = 0; Menu_msg(""); return stat; }
enum piglit_result do_blit_test(void) { GLuint buff[64] = {0}; glSelectBuffer(64, buff); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); glClearColor(0.5, 0.5, 0.5, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glRenderMode(GL_SELECT); draw_objects(); return validate_select_buffer(buff) ? PIGLIT_PASS : PIGLIT_FAIL; }
void my_display() { // clear all pixels, reset depth glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT ); //Camera view cam->CreateView(); draw_axes(); //draw the objects draw_objects(); // this buffer is ready glutSwapBuffers(); }
void my_display() { // clear all pixels, reset depth glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); //setup the camera (1st person? 3rd person?) gluLookAt(my_cam.pos[0],my_cam.pos[1], my_cam.pos[2], my_cam.at[0],my_cam.at[1],my_cam.at[2], my_cam.up[0], my_cam.up[1], my_cam.up[2]); //update the flashlight to follow the person //draw the objects draw_axes(); draw_objects(); // this buffer is ready glutSwapBuffers(); }
void HaloRefImage::update() { // render the scene and read pixels to main memory // and/or texture memory if (!need_update()) return; static bool debug = Config::get_var_bool("DEBUG_HALO_UPDATE",false); err_adv(debug, "HaloRefImage::update: updating..."); check_resize(); glPushAttrib( GL_LINE_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT | GL_VIEWPORT | // XXX - not needed GL_COLOR_BUFFER_BIT | // XXX - not needed GL_TEXTURE_BIT // XXX - not needed ); // XXX - remove this: assert(_view && _view == VIEW::peek()); // set up lights _view->setup_lights(); // set default state // XXX - check glLineWidth(1.0); // GL_LINE_BIT glDepthMask(GL_TRUE); // GL_DEPTH_BUFFER_BIT glDepthFunc(GL_LESS); // GL_DEPTH_BUFFER_BIT glEnable(GL_DEPTH_TEST); // GL_DEPTH_BUFFER_BIT glDisable(GL_NORMALIZE); // GL_ENABLE_BIT glDisable(GL_BLEND); // GL_ENABLE_BIT glEnable(GL_CULL_FACE); // GL_ENABLE_BIT glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); glEnable(GL_COLOR_MATERIAL); // GL_ENABLE_BIT glShadeModel(GL_SMOOTH); // GL_LIGHTING_BIT // set viewport to ref image size: glViewport(0,0,_width,_height); // GL_VIEWPORT_BIT draw_objects(_view->drawn()); // copy image to main memory or texture memory // (or both) as requested: if (_update_main_mem) { if (use_fbos) glBindFramebuffer(GL_READ_FRAMEBUFFER, _fbo); else glReadBuffer(GL_AUX0); //because the image is constructed in aux0 copy_to_ram(); if (use_fbos) glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); else glReadBuffer(GL_BACK); } if (_update_tex_mem) copy_to_tex_aux(); //copies from aux0 // clear update flags until next update request is made: _update_main_mem = _update_tex_mem = false; glPopAttrib(); // restore viewport to window size: int w, h; _view->get_size(w,h); glViewport(0,0,w,h); }
static void draw_scene(void) { GLfloat dist = 20.0; GLfloat eyex, eyey, eyez; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); eyex = dist * cos(yrot * DEG2RAD) * cos(xrot * DEG2RAD); eyez = dist * sin(yrot * DEG2RAD) * cos(xrot * DEG2RAD); eyey = dist * sin(xrot * DEG2RAD); /* view from top */ glPushMatrix(); gluLookAt(eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glLightfv(GL_LIGHT0, GL_POSITION, light_pos); /* draw table into stencil planes */ glEnable(GL_STENCIL_TEST); #ifdef USE_ZBUFFER glDisable(GL_DEPTH_TEST); #endif glStencilFunc(GL_ALWAYS, 1, 0xffffffff); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); draw_table(); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); #ifdef USE_ZBUFFER glEnable(GL_DEPTH_TEST); #endif /* render view from below (reflected viewport) */ /* only draw where stencil==1 */ if (eyey > 0.0) { glPushMatrix(); glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glScalef(1.0, -1.0, 1.0); /* Reposition light in reflected space. */ glLightfv(GL_LIGHT0, GL_POSITION, light_pos); draw_objects(eyex, eyey, eyez); glPopMatrix(); /* Restore light's original unreflected position. */ glLightfv(GL_LIGHT0, GL_POSITION, light_pos); } glDisable(GL_STENCIL_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); #ifdef USE_TEXTURE glEnable(GL_TEXTURE_2D); #endif draw_table(); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); /* view from top */ glPushMatrix(); draw_objects(eyex, eyey, eyez); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); }
void CLevelGraph::draw_game_graph () { if (!Level().CurrentEntity()) return; // Fvector camera_position = Level().CurrentEntity()->Position(); // CGameFont *font = HUD().Font().pFontDI; const Fmatrix &xform = Level().CurrentEntity()->XFORM(); Fvector center = Fvector().set(0.f,5.f,0.f); Fvector bounds = Fvector().set(3.f,0.f,3.f); // draw back plane Fvector vertices[4]; xform.transform_tiny (vertices[0], Fvector().set(center.x - bounds.x, center.y + bounds.y, center.z + bounds.z)); xform.transform_tiny (vertices[1], Fvector().set(center.x + bounds.x, center.y + bounds.y, center.z + bounds.z)); xform.transform_tiny (vertices[2], Fvector().set(center.x - bounds.x, center.y - bounds.y, center.z - bounds.z)); xform.transform_tiny (vertices[3], Fvector().set(center.x + bounds.x, center.y - bounds.y, center.z - bounds.z)); // u32 back_color = D3DCOLOR_XRGB(0,0,0); // RCache.dbg_DrawTRI (Fidentity,vertices[0],vertices[2],vertices[1],back_color); // RCache.dbg_DrawTRI (Fidentity,vertices[1],vertices[2],vertices[3],back_color); // draw vertices CGameGraph &graph = ai().game_graph(); update_current_info (); bool found = false; bool all = (m_current_level_id == -1); for (int i=0, n = (int)graph.header().vertex_count(); i<n; ++i) { if (!all) { if (graph.vertex(i)->level_id() != m_current_level_id) { if (found) break; continue; } found = true; } draw_vertex (i); if (psAI_Flags.test(aiDrawGameGraphStalkers)) draw_stalkers (i); if (psAI_Flags.test(aiDrawGameGraphObjects)) draw_objects (i); } /** for (int i=0; i<(int)ai().game_graph().header().vertex_count(); ++i) { Fvector t1 = ai().game_graph().vertex(i)->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(0,0,255)); CGameGraph::const_iterator I, E; ai().game_graph().begin (i,I,E); for ( ; I != E; ++I) { Fvector t2 = ai().game_graph().vertex((*I).vertex_id())->game_point(); t2.y += .6f; NORMALIZE_VECTOR(t2); Level().debug_renderer().draw_line(Fidentity,t1,t2,D3DCOLOR_XRGB(0,255,0)); } Fvector T; Fvector4 S; T.set (t1); //T.y+= 1.5f; T.y+= 1.5f/10.f; Device.mFullTransform.transform (S,T); //out of screen if (S.z < 0 || S.w < 0) continue; if (S.x < -1.f || S.x > 1.f || S.y<-1.f || S.x>1.f) continue; F->SetSizeI (0.05f/_sqrt(_abs(S.w))); F->SetColor(0xffffffff); F->OutI(S.x,-S.y,"%d",i); } { const xr_vector<u32> &path = map_point_path; if( path.size() ){ Fvector t1 = ai().game_graph().vertex(path.back())->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(0,0,255)); for (int i=(int)path.size() - 2; i>=0;--i) { Fvector t2 = ai().game_graph().vertex(path[i])->game_point(); t2.y += .6f; NORMALIZE_VECTOR(t2); Level().debug_renderer().draw_aabb(t2,.05f,.05f,.05f,D3DCOLOR_XRGB(0,0,255)); Level().debug_renderer().draw_line(Fidentity,t1,t2,D3DCOLOR_XRGB(0,0,255)); t1 = t2; } } } if (GameID() == GAME_SINGLE && ai().get_alife()) { { GameGraph::_LEVEL_ID J = ai().game_graph().vertex(ai().alife().graph().actor()->m_tGraphID)->level_id(); for (int i=0, n=(int)ai().game_graph().header().vertex_count(); i<n; ++i) { if (ai().game_graph().vertex(i)->level_id() != J) continue; Fvector t1 = ai().game_graph().vertex(i)->level_point(), t2 = ai().game_graph().vertex(i)->game_point(); t1.y += .6f; t2.y += .6f; NORMALIZE_VECTOR(t2); Level().debug_renderer().draw_aabb(t1,.5f,.5f,.5f,D3DCOLOR_XRGB(255,255,255)); //Level().debug_renderer().draw_line(Fidentity,t1,t2,D3DCOLOR_XRGB(255,255,255)); Fvector T; Fvector4 S; T.set (t1); //T.y+= 1.5f; T.y+= 1.5f; Device.mFullTransform.transform (S,T); //out of screen if (S.z < 0 || S.w < 0) continue; if (S.x < -1.f || S.x > 1.f || S.y<-1.f || S.x>1.f) continue; F->SetSizeI (0.1f/_sqrt(_abs(S.w))); F->SetColor(0xffffffff); F->OutI(S.x,-S.y,"%d",i); } } ALife::D_OBJECT_P_MAP::const_iterator I = ai().alife().objects().objects().begin(); ALife::D_OBJECT_P_MAP::const_iterator E = ai().alife().objects().objects().end(); for ( ; I != E; ++I) { { CSE_ALifeMonsterAbstract *tpALifeMonsterAbstract = smart_cast<CSE_ALifeMonsterAbstract *>((*I).second); if (tpALifeMonsterAbstract && tpALifeMonsterAbstract->m_bDirectControl && !tpALifeMonsterAbstract->m_bOnline) { CSE_ALifeHumanAbstract *tpALifeHuman = smart_cast<CSE_ALifeHumanAbstract *>(tpALifeMonsterAbstract); if (tpALifeHuman && tpALifeHuman->brain().movement().detail().path().size()) { Fvector t1 = ai().game_graph().vertex(tpALifeHuman->brain().movement().detail().path().back())->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(0,0,255)); for (int i=(int)tpALifeHuman->brain().movement().detail().path().size() - 2; i>=0;--i) { Fvector t2 = ai().game_graph().vertex(tpALifeHuman->brain().movement().detail().path()[i])->game_point(); t2.y += .6f; NORMALIZE_VECTOR(t2); Level().debug_renderer().draw_aabb(t2,.05f,.05f,.05f,D3DCOLOR_XRGB(0,0,255)); Level().debug_renderer().draw_line(Fidentity,t1,t2,D3DCOLOR_XRGB(0,0,255)); t1 = t2; } } if (tpALifeMonsterAbstract->m_fDistanceToPoint > EPS_L) { Fvector t1 = ai().game_graph().vertex(tpALifeMonsterAbstract->m_tGraphID)->game_point(); Fvector t2 = ai().game_graph().vertex(tpALifeMonsterAbstract->m_tNextGraphID)->game_point(); t2.sub(t1); t2.mul(tpALifeMonsterAbstract->m_fDistanceFromPoint/tpALifeMonsterAbstract->m_fDistanceToPoint); t1.add(t2); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(255,0,0)); } else { Fvector t1 = ai().game_graph().vertex((*I).second->m_tGraphID)->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(255,0,0)); } } else { CSE_ALifeInventoryItem *l_tpALifeInventoryItem = smart_cast<CSE_ALifeInventoryItem*>((*I).second); if (l_tpALifeInventoryItem && !l_tpALifeInventoryItem->attached()) { Fvector t1 = ai().game_graph().vertex((*I).second->m_tGraphID)->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(255,255,0)); } else { CSE_ALifeCreatureActor *tpALifeCreatureActor = smart_cast<CSE_ALifeCreatureActor*>((*I).second); if (tpALifeCreatureActor) { Fvector t1 = ai().game_graph().vertex((*I).second->m_tGraphID)->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(255,255,255)); } else { CSE_ALifeTrader *tpALifeTrader = smart_cast<CSE_ALifeTrader*>((*I).second); if (tpALifeTrader) { Fvector t1 = ai().game_graph().vertex((*I).second->m_tGraphID)->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(0,0,0)); } else { CSE_ALifeSmartZone *smart_zone = smart_cast<CSE_ALifeSmartZone*>((*I).second); if (smart_zone) { Fvector t1 = ai().game_graph().vertex((*I).second->m_tGraphID)->game_point(); t1.y += .6f; NORMALIZE_VECTOR(t1); Level().debug_renderer().draw_aabb(t1,.05f,.05f,.05f,D3DCOLOR_XRGB(255,0,0)); } } } } } } } } /**/ }