Skip to content

Commit

Permalink
Merge pull request #24 from Face-1/feature/FilterElevation
Browse files Browse the repository at this point in the history
elevmgr: added clbkFilterElevation
  • Loading branch information
mschweiger committed Aug 4, 2021
2 parents 67f2b57 + 147ff7b commit b2ca18e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Orbitersdk/include/GraphicsAPI.h
Expand Up @@ -1353,6 +1353,23 @@ class OAPIFUNC GraphicsClient: public Module {
bool ElevationGrid (ELEVHANDLE emgr, int ilat, int ilng, int lvl,
int pilat, int pilng, int plvl, INT16 *pelev, INT16 *elev, double *emean=0) const;

/**
* \brief Filter elevation grid data
* \param hPlanet object handle of the planet the data belongs to
* \param ilat patch latitude index
* \param ilng patch longitude index
* \param lvl patch resolution level
* \param elev_res elevation level resolution
* \param elev pointer to array with elevation grid data
* \default None.
* \note Clients that manipulate elevation file data in memory (e.g. for flattening
* features) for visuals should overload this method in order to manipulate the
* terrain collision data in the same way. As soon as the internal collision tile
* is loaded in the core, the callback is invoked.
*/
virtual bool clbkFilterElevation(OBJHANDLE hPlanet, int ilat, int ilng, int lvl, double elev_res, INT16* elev) { return false; }
// @}

protected:
/** \brief Launchpad video tab indicator
*
Expand Down
2 changes: 2 additions & 0 deletions Src/Orbiter/elevmgr.cpp
Expand Up @@ -311,6 +311,8 @@ double ElevationManager::Elevation (double lat, double lng, int reqlvl, std::vec
t->lngmin = (double)ilng/(double)nlng*Pi2 - Pi;
t->lngmax = (double)(ilng+1)/(double)nlng*Pi2 - Pi;
// still need to store emin and emax
auto gc = g_pOrbiter->GetGraphicsClient();
if (gc) gc->clbkFilterElevation((OBJHANDLE)cbody, ilat, ilng, lvl, elev_res, t->data);
break;
}
}
Expand Down

0 comments on commit b2ca18e

Please sign in to comment.