![]() |
VR-Forces Developer's Guide
|
Query helper that computes the signed distance (in metres) from a geographic point to the nearest matching polygon or raster boundary.
Each call to querySignedDistance() evaluates elevation conditions, raster sampling, and feature layer proximity in sequence. For FeatureSource layers, spatial bounds queries are issued against per-tile caches populated by background feature-fetch threads. For PolygonizedRaster mode, GDAL is used to polygonize raster tiles on background threads; results are cached per tile and evicted when the observer moves more than ~1 degree from the tile centre. Both caches are protected by internal mutexes.
Public Member Functions | |
| DtProceduralSoundscapeQuery (osgEarth::MapNode *mapNode) | |
| virtual double | querySignedDistance (const DtProceduralSoundscapeChannel &channel, double lon_deg, double lat_deg, double hat_m) const |
| DtProceduralSoundscapeQuery (const DtProceduralSoundscapeQuery &)=delete | |
| DtProceduralSoundscapeQuery & | operator= (const DtProceduralSoundscapeQuery &)=delete |
| std::string | getRasterStatus (const DtProceduralSoundscapeChannel &channel) const |
| DtPolygonCacheStats | getPolygonCacheStats () const |
| DtPolygonCacheStats | getFeatureTileCacheStats () const |
Protected Member Functions | |
| virtual double | evaluateElevationConditions (const DtProceduralSoundscapeChannel &channel, osgEarth::Map *map, double lon_deg, double lat_deg) const |
| virtual double | evaluateFeatureDistance (const DtProceduralSoundscapeChannel &channel, osgEarth::Map *map, double lon_deg, double lat_deg) const |
| virtual double | evaluateRasterDistance (const DtProceduralSoundscapeChannel &channel, osgEarth::Map *map, double lon_deg, double lat_deg) const |
| virtual double | evaluateRasterPolygonDistance (const DtProceduralSoundscapeChannel &channel, osgEarth::Map *map, double lon_deg, double lat_deg) const |
Protected Attributes | |
| osg::observer_ptr < osgEarth::MapNode > | myMapNode |
| const osgEarth::SpatialReference * | myWgs84Srs {nullptr} |
| std::shared_ptr < DtPolygonCacheData > | myPolygonCache |
| std::shared_ptr < DtFeatureTileCacheData > | myFeatureTileCache |
| std::shared_ptr < DtElevationSampleCache > | myElevationSampleCache |
|
explicit |
Construct with the osgEarth MapNode that owns the feature layers.
| mapNode | Must remain valid for the lifetime of this object. |
|
delete |
Copy not allowed.
|
virtual |
Query the signed distance from (lon_deg, lat_deg) to the nearest polygon in the FeatureSource layer described by channel.
| channel | Channel configuration (layer name, attribute filter, query radius). |
| lon_deg | Observer longitude in decimal degrees (WGS84). |
| lat_deg | Observer latitude in decimal degrees (WGS84). |
| hat_m | Observer height above the rendered terrain mesh in metres, as returned by DtObserver::heightAboveTerrain(). Negative means on or below the terrain surface. When this value exceeds channel.fadeDistanceMeters the channel is silenced, preventing ambient sounds while the observer is airborne. Using the scene intersection avoids the bathymetry artefact that affects the osgEarth ElevationPool (deep ocean floors). |
|
delete |
| std::string makVrv::DtProceduralSoundscapeQuery::getRasterStatus | ( | const DtProceduralSoundscapeChannel & | channel | ) | const |
Return a short human-readable status string for the raster source of channel, for use in debug overlays.
Returns an empty string when the channel has no raster source. Otherwise returns one of:
| DtPolygonCacheStats makVrv::DtProceduralSoundscapeQuery::getPolygonCacheStats | ( | ) | const |
Capture a snapshot of the polygon tile cache for debug/profiling display. Thread-safe: takes the cache mutex briefly.
| DtPolygonCacheStats makVrv::DtProceduralSoundscapeQuery::getFeatureTileCacheStats | ( | ) | const |
Capture a snapshot of the feature tile cache for debug/profiling display. Thread-safe: takes the cache mutex briefly.
|
protectedvirtual |
Evaluate each DtElevationCondition against the terrain MSL elevation sampled from the osgEarth ElevationPool.
Returns 0.0 (unconstrained) when elevationConditions is empty - no pool query is performed in that case.
hat_m is NOT a parameter here. It is applied as a universal final constraint in querySignedDistance so that it gates every return path (elevation, raster, and feature distance) consistently, including the case where a feature polygon returns a very negative signed distance while the observer is airborne.
|
protectedvirtual |
Query the feature source for the minimum signed distance from the observer to any polygon that passes all attributeFilters.
|
protectedvirtual |
Sample an osgEarth ImageLayer and return a signed distance in metres.
Handles both SDF and Classification modes of DtRasterSource.
|
protectedvirtual |
Polygonise a raster ImageLayer at LOD 10 on a background thread and return the signed distance from the observer to the nearest matching polygon once the cache is populated.
Returns DBL_MAX (silent) while the background GDALPolygonize job is pending. Results are cached per tile and evicted when the observer moves more than ~1 degree from the tile centre.
|
protected |
|
protected |
WGS84 SpatialReference pointer, cached at construction to avoid per-call registry mutex contention. The osgEarth registry keeps the object alive for the process lifetime, so the raw pointer is stable.
|
mutableprotected |
Shared cache for polygonised raster tiles (render thread + worker threads).
|
mutableprotected |
Shared cache for fetched feature tile geometry (render thread + worker threads).
|
mutableprotected |
Per-channel async elevation sample cache (render thread reads, background threads write). Eliminates all main-thread getSample() cost.