mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-21 20:39:08 -06:00
Minimum camera height above surface is now configurable.
This commit is contained in:
@@ -30,9 +30,11 @@ return {
|
||||
Body = "EARTH",
|
||||
--Radii = {6378137.0, 6378137.0, 6356752.314245}, -- Earth's radii
|
||||
Radii = {3396190.0, 3396190.0, 3376200.0}, -- Mars' radii
|
||||
CameraMinHeight = 1000,
|
||||
InteractionDepthBelowEllipsoid = 10000, -- Useful when having negative height map values
|
||||
SegmentsPerPatch = 64,
|
||||
TextureInitData = {
|
||||
ColorTextureMinimumSize = 1024,
|
||||
ColorTextureMinimumSize = 512,
|
||||
OverlayMinimumSize = 2048,
|
||||
HeightMapMinimumSize = 64,
|
||||
},
|
||||
@@ -57,6 +59,11 @@ return {
|
||||
Name = "ESRI Imagery World 2D",
|
||||
FilePath = "map_service_configs/ESRI_Imagery_World_2D.wms",
|
||||
Enabled = false,
|
||||
},
|
||||
{
|
||||
Name = "MARS_Viking_MDIM21",
|
||||
FilePath = "map_service_configs/MARS_Viking_MDIM21.xml",
|
||||
Enabled = true,
|
||||
},
|
||||
},
|
||||
GrayScaleOverlays = {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<YOrigin>bottom</YOrigin>
|
||||
<BlockSizeX>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
</DataWindow>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
|
||||
@@ -43,6 +43,8 @@ namespace {
|
||||
// Keys for the dictionary
|
||||
const std::string keyFrame = "Frame";
|
||||
const std::string keyRadii = "Radii";
|
||||
const std::string keyInteractionDepthBelowEllipsoid = "InteractionDepthBelowEllipsoid";
|
||||
const std::string keyCameraMinHeight = "CameraMinHeight";
|
||||
const std::string keySegmentsPerPatch = "SegmentsPerPatch";
|
||||
const std::string keyTextureInitData = "TextureInitData";
|
||||
const std::string keyTextures = "Textures";
|
||||
@@ -57,14 +59,13 @@ namespace openspace {
|
||||
|
||||
RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
: _saveOrThrowCamera(properties::BoolProperty("saveOrThrowCamera", "saveOrThrowCamera"))
|
||||
, _cameraMinHeight(properties::FloatProperty("cameraMinHeight", "cameraMinHeight", 100.0f, 0.0f, 1000.0f))
|
||||
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 5.0f, 1.0f, 50.0f))
|
||||
, debugSelection(ReferencedBoolSelection("Debug", "Debug"))
|
||||
, atmosphereEnabled(properties::BoolProperty(" Atmosphere", " Atmosphere", false))
|
||||
{
|
||||
setName("RenderableGlobe");
|
||||
|
||||
|
||||
|
||||
dictionary.getValue(keyFrame, _frame);
|
||||
|
||||
// Read the radii in to its own dictionary
|
||||
@@ -78,6 +79,11 @@ namespace openspace {
|
||||
dictionary.getValue(keySegmentsPerPatch, patchSegmentsd);
|
||||
int patchSegments = patchSegmentsd;
|
||||
|
||||
dictionary.getValue(keyInteractionDepthBelowEllipsoid, _interactionDepthBelowEllipsoid);
|
||||
float cameraMinHeight;
|
||||
dictionary.getValue(keyCameraMinHeight, cameraMinHeight);
|
||||
_cameraMinHeight.set(cameraMinHeight);
|
||||
|
||||
// Init tile provider manager
|
||||
ghoul::Dictionary textureInitDataDictionary;
|
||||
ghoul::Dictionary texturesDictionary;
|
||||
@@ -123,6 +129,7 @@ namespace openspace {
|
||||
addProperty(atmosphereEnabled);
|
||||
addProperty(_saveOrThrowCamera);
|
||||
addProperty(lodScaleFactor);
|
||||
addProperty(_cameraMinHeight);
|
||||
}
|
||||
|
||||
RenderableGlobe::~RenderableGlobe() {
|
||||
@@ -244,6 +251,14 @@ namespace openspace {
|
||||
return height;
|
||||
}
|
||||
|
||||
double RenderableGlobe::interactionDepthBelowEllipsoid() {
|
||||
return _interactionDepthBelowEllipsoid;
|
||||
}
|
||||
|
||||
float RenderableGlobe::cameraMinHeight() {
|
||||
return _cameraMinHeight.value();
|
||||
}
|
||||
|
||||
std::shared_ptr<ChunkedLodGlobe> RenderableGlobe::chunkedLodGlobe() {
|
||||
return _chunkedLodGlobe;
|
||||
}
|
||||
|
||||
@@ -113,24 +113,23 @@ public:
|
||||
glm::dvec3 projectOnEllipsoid(glm::dvec3 position);
|
||||
const Ellipsoid& ellipsoid();
|
||||
float getHeight(glm::dvec3 position);
|
||||
float cameraMinHeight();
|
||||
double interactionDepthBelowEllipsoid();
|
||||
std::shared_ptr<ChunkedLodGlobe> chunkedLodGlobe();
|
||||
|
||||
|
||||
// Properties
|
||||
properties::FloatProperty lodScaleFactor;
|
||||
|
||||
std::vector<std::unique_ptr<ReferencedBoolSelection>> _categorySelections;
|
||||
|
||||
properties::BoolProperty atmosphereEnabled;
|
||||
|
||||
ReferencedBoolSelection debugSelection;
|
||||
|
||||
properties::BoolProperty _saveOrThrowCamera;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
double _interactionDepthBelowEllipsoid;
|
||||
|
||||
std::string _frame;
|
||||
double _time;
|
||||
@@ -142,6 +141,8 @@ private:
|
||||
|
||||
|
||||
DistanceSwitch _distanceSwitch;
|
||||
|
||||
properties::FloatProperty _cameraMinHeight;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -224,6 +224,7 @@ vec4 calculateGrayScaleOverlay(
|
||||
|
||||
// HSL blending
|
||||
vec3 hslCurrent = rgb2hsl(currentColor.rgb);
|
||||
hslCurrent.y = hslCurrent.z > 0.7 ? 0 : hslCurrent.y;
|
||||
vec3 hslNew = vec3(hslCurrent.x, hslCurrent.y, colorGrayScale.r);
|
||||
vec3 rgbNew = hsl2rgb(hslNew);
|
||||
*/
|
||||
|
||||
@@ -55,7 +55,8 @@ namespace openspace {
|
||||
|
||||
if (i == LayeredTextures::ColorTextures ||
|
||||
i == LayeredTextures::NightTextures ||
|
||||
i == LayeredTextures::WaterMasks) {
|
||||
i == LayeredTextures::WaterMasks ||
|
||||
i == LayeredTextures::GrayScaleOverlays) {
|
||||
initData.minimumPixelSize = textureInitDictionary.value<double>("ColorTextureMinimumSize");
|
||||
}
|
||||
else if (i == LayeredTextures::Overlays) {
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace openspace {
|
||||
if (!GdalHasBeenInitialized) {
|
||||
GDALAllRegister();
|
||||
CPLSetConfigOption("GDAL_DATA", absPath("${MODULE_GLOBEBROWSING}/gdal_data").c_str());
|
||||
|
||||
|
||||
GdalHasBeenInitialized = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -341,8 +341,8 @@ void GlobeBrowsingInteractionMode::updateCameraStateFromMouseStates(Camera& came
|
||||
if (_focusNode && _globe) {
|
||||
// Declare variables to use in interaction calculations
|
||||
// Shrink interaction ellipsoid to enable interaction below height = 0
|
||||
double ellipsoidShrinkTerm = 10000.0;
|
||||
double minHeightAboveGround = 100.0;
|
||||
double ellipsoidShrinkTerm = _globe->interactionDepthBelowEllipsoid();
|
||||
double minHeightAboveGround = _globe->cameraMinHeight();
|
||||
|
||||
glm::dvec3 centerPos = _focusNode->worldPosition().dvec3();
|
||||
glm::dvec3 camPos = camera.positionVec3();
|
||||
|
||||
Reference in New Issue
Block a user