mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 13:08:49 -05:00
Enabling 'Freeze camera used for chunk culling' from GUI. Helpful for culling debugging
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <modules/globebrowsing/globes/globemesh.h>
|
||||
#include <modules/globebrowsing/globes/clipmapglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -52,7 +51,15 @@ namespace openspace {
|
||||
|
||||
RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
: _tileProviderManager(std::shared_ptr<TileProviderManager>(new TileProviderManager))
|
||||
, _saveOrThrowCamera(properties::BoolProperty("saveOrThrowCamera", "saveOrThrowCamera"))
|
||||
{
|
||||
|
||||
setName("RenderableGlobe");
|
||||
addProperty(_saveOrThrowCamera);
|
||||
|
||||
|
||||
|
||||
|
||||
// Read the radii in to its own dictionary
|
||||
Vec3 radii;
|
||||
dictionary.getValue(keyRadii, radii);
|
||||
@@ -98,8 +105,11 @@ namespace openspace {
|
||||
|
||||
//addSwitchValue(std::shared_ptr<ClipMapGlobe>(
|
||||
// new ClipMapGlobe(_ellipsoid, _tileProviderManager)), 1e8);
|
||||
_distanceSwitch.addSwitchValue(std::shared_ptr<ChunkedLodGlobe>(
|
||||
new ChunkedLodGlobe(_ellipsoid, _tileProviderManager)), 1e9);
|
||||
|
||||
_chunkedLodGlobe = std::shared_ptr<ChunkedLodGlobe>(
|
||||
new ChunkedLodGlobe(_ellipsoid, _tileProviderManager));
|
||||
|
||||
_distanceSwitch.addSwitchValue(_chunkedLodGlobe, 1e9);
|
||||
_distanceSwitch.addSwitchValue(std::shared_ptr<GlobeMesh>(new GlobeMesh()), 1e10);
|
||||
}
|
||||
|
||||
@@ -120,6 +130,18 @@ namespace openspace {
|
||||
}
|
||||
|
||||
void RenderableGlobe::render(const RenderData& data) {
|
||||
if (_saveOrThrowCamera.value()) {
|
||||
_saveOrThrowCamera.setValue(false);
|
||||
|
||||
if (_chunkedLodGlobe->getSavedCamera() == nullptr) { // save camera
|
||||
LDEBUG("Saving snapshot of camera!");
|
||||
_chunkedLodGlobe->setSaveCamera(new Camera(data.camera));
|
||||
}
|
||||
else { // throw camera
|
||||
LDEBUG("Throwing away saved camera!");
|
||||
_chunkedLodGlobe->setSaveCamera(nullptr);
|
||||
}
|
||||
}
|
||||
_distanceSwitch.render(data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user