// render ecef geometry void miniview::render_ecef_geometry(double) { // render plain globe for z-values: static miniglobe globe; static const int gltess = 32; static const double glscale = 0.999; static const double glzscale = 1.05; globe.settess(gltess); globe.setscale(1.0); globe.setdynscale(glscale); globe.setZscale(glzscale); disableRGBAwriting(); globe.render(); enableRGBAwriting(); initstate(); // render ecef z-axis: linewidth(2); enablelinesmooth(); static const miniv3d zacolor(0.25, 0.25, 0.5); color(zacolor); renderline(miniv3d(0.0, 0.0, -1.1*getorbradius()), miniv3d(0.0, 0.0, -getorbradius())); renderline(miniv3d(0.0, 0.0, getorbradius()), miniv3d(0.0, 0.0, 1.1*getorbradius())); // render equator: linewidth(1); disableZwriting(); static const int eqlines = 100; static const miniv3d eqcolor(0.25, 0.25, 0.25); color(eqcolor); for (int i=0; i<=eqlines; i++) { minicoord c(miniv3d((double)i/eqlines*360*3600, 0.0, 0.0),minicoord::MINICOORD_LLH); c.convert2(minicoord::MINICOORD_ECEF); static minicoord c0; if (i>0) renderline(c0.vec, c.vec); c0 = c; } enableZwriting(); disablelinesmooth(); exitstate(); }
void * trender(void * a) { referenceUnusedParameter(a); for(;;) { Sleep(1); pthread_mutex_lock(&mrenderline); if(rendernextline < 0 || rendernextline >= h) { pthread_mutex_unlock(&mrenderline); continue; } else { pthread_mutex_lock(&mrenderworking); renderworking++; pthread_mutex_unlock(&mrenderworking); for(;;) { int line = rendernextline; if(rendernextline < 0 || rendernextline >= h) { pthread_mutex_unlock(&mrenderline); break; } rendernextline++; pthread_mutex_unlock(&mrenderline); renderline(line); pthread_mutex_lock(&mrenderline); } } pthread_mutex_lock(&mrenderworking); renderworking--; pthread_mutex_unlock(&mrenderworking); } }
// signpost rendering method void minipointrndr_signpost::render(minipointdata *vpoint,int pass) { const int maxinfo=1000; static char info[maxinfo]; float range; float sheight,ssize; float sturn,syon; float salpha; // mark waypoint with a post if (pass==1) { sheight=GLOBAL->signpostheight; if (vpoint->opts!=NULL) if (vpoint->opts->signpostheight>0.0f) sheight=vpoint->opts->signpostheight*SCALEELEV; renderline(vpoint->x,vpoint->height,-vpoint->y,vpoint->x,vpoint->height+sheight,-vpoint->y); } // label waypoint within range else if (pass==2) { // calculate maximum range range=GLOBAL->signpostrange; if (vpoint->opts!=NULL) if (vpoint->opts->signpostrange>0.0f) range=vpoint->opts->signpostrange*SCALEELEV; // check distance if (POINTS->getdistance2(EX,EZ,EY,vpoint)>fsqr(range)) return; // get global waypoint parameters ssize=GLOBAL->signpostsize; sheight=GLOBAL->signpostheight; sturn=GLOBAL->signpostturn; syon=GLOBAL->signpostincline; salpha=GLOBAL->signpostalpha; // get optional waypoint parameters if (vpoint->opts!=NULL) { if (vpoint->opts->signpostsize>0.0f) ssize=vpoint->opts->signpostsize*SCALEELEV; if (vpoint->opts->signpostheight>0.0f) sheight=vpoint->opts->signpostheight*SCALEELEV; if (vpoint->opts->signpostnoauto) { sturn=vpoint->opts->signpostturn; syon=vpoint->opts->signpostincline; } if (vpoint->opts->signpostalpha>0.0f) salpha=vpoint->opts->signpostalpha; } // compile label information of waypoint within range if (vpoint==NEAREST) { if (vpoint->zone==0) snprintf(info,maxinfo,"\n %s \n\n Lat=%s Lon=%s \n Elev=%s \n", vpoint->desc, vpoint->latitude,vpoint->longitude, vpoint->elevation); else snprintf(info,maxinfo,"\n %s \n\n %s East=%s North=%s \n Elev=%s \n", vpoint->desc, vpoint->system,vpoint->longitude,vpoint->latitude, vpoint->elevation); salpha=1.0f; } else snprintf(info,maxinfo,"\n %s \n",vpoint->desc); // label waypoint within range mtxpush(); mtxtranslate(0.0f,sheight,0.0f); mtxtranslate(vpoint->x,vpoint->height,-vpoint->y); mtxrotate(-sturn,0.0f,1.0f,0.0f); mtxrotate(syon,1.0f,0.0f,0.0f); mtxscale(2.0f*ssize,2.0f*ssize,2.0f*ssize); mtxtranslate(-0.5f,0.0f,0.0f); minitext::drawstring(1.0f,240.0f,0.5f,0.5f,1.0f,info,1.0f,salpha); mtxpop(); // report render size and offset vpoint->size=0.0f; vpoint->offset=sheight; } }