Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elevmgr: added clbkFilterElevation #24

Merged
merged 1 commit into from Aug 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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