mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-08 04:20:14 -05:00
Renamed ChunkLodGlobe to ChunkedLogGlobe and made DistanceSwitch not a renderable
This commit is contained in:
@@ -30,7 +30,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/globemesh.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmapglobe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmappyramid.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunklodglobe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunkedlodglobe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunknode.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunkindex.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunk.h
|
||||
@@ -64,7 +64,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/globemesh.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmapglobe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmappyramid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunklodglobe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunkedlodglobe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunknode.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunkindex.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/globes/chunk.cpp
|
||||
|
||||
@@ -64,7 +64,6 @@ void GlobeBrowsingModule::internalInitialize() {
|
||||
|
||||
fRenderable->registerClass<RenderableGlobe>("RenderableGlobe");
|
||||
fRenderable->registerClass<GlobeMesh>("GlobeMesh");
|
||||
fRenderable->registerClass<DistanceSwitch>("DistanceSwitch");
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
|
||||
#include <modules/globebrowsing/globes/chunk.h>
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Chunk::Chunk(ChunkLodGlobe* owner, const ChunkIndex& chunkIndex)
|
||||
Chunk::Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex)
|
||||
: _owner(owner)
|
||||
, _surfacePatch(chunkIndex)
|
||||
, _index(chunkIndex)
|
||||
@@ -51,7 +51,7 @@ namespace openspace {
|
||||
return _surfacePatch;
|
||||
}
|
||||
|
||||
ChunkLodGlobe* const Chunk::owner() const {
|
||||
ChunkedLodGlobe* const Chunk::owner() const {
|
||||
return _owner;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace openspace {
|
||||
_surfacePatch = GeodeticPatch(index);
|
||||
}
|
||||
|
||||
void Chunk::setOwner(ChunkLodGlobe* newOwner) {
|
||||
void Chunk::setOwner(ChunkedLodGlobe* newOwner) {
|
||||
_owner = newOwner;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ChunkLodGlobe;
|
||||
class ChunkedLodGlobe;
|
||||
|
||||
|
||||
class Chunk {
|
||||
@@ -50,22 +50,22 @@ namespace openspace {
|
||||
WANT_SPLIT,
|
||||
};
|
||||
|
||||
Chunk(ChunkLodGlobe* owner, const ChunkIndex& chunkIndex);
|
||||
Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex);
|
||||
|
||||
/// Updates chunk internally and returns a desired level
|
||||
Status update(const RenderData& data);
|
||||
|
||||
const GeodeticPatch& surfacePatch() const;
|
||||
ChunkLodGlobe* const owner() const;
|
||||
ChunkedLodGlobe* const owner() const;
|
||||
const ChunkIndex index() const;
|
||||
bool isVisible() const;
|
||||
|
||||
void setIndex(const ChunkIndex& index);
|
||||
void setOwner(ChunkLodGlobe* newOwner);
|
||||
void setOwner(ChunkedLodGlobe* newOwner);
|
||||
|
||||
|
||||
private:
|
||||
ChunkLodGlobe* _owner;
|
||||
ChunkedLodGlobe* _owner;
|
||||
ChunkIndex _index;
|
||||
bool _isVisible;
|
||||
GeodeticPatch _surfacePatch;
|
||||
|
||||
+14
-16
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
|
||||
#include <modules/globebrowsing/meshes/basicgrid.h>
|
||||
|
||||
@@ -44,14 +44,14 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
const GeodeticPatch ChunkLodGlobe::LEFT_HEMISPHERE = GeodeticPatch(0, -M_PI/2, M_PI/2, M_PI/2);
|
||||
const GeodeticPatch ChunkLodGlobe::RIGHT_HEMISPHERE = GeodeticPatch(0, M_PI/2, M_PI/2, M_PI/2);
|
||||
const GeodeticPatch ChunkedLodGlobe::LEFT_HEMISPHERE = GeodeticPatch(0, -M_PI/2, M_PI/2, M_PI/2);
|
||||
const GeodeticPatch ChunkedLodGlobe::RIGHT_HEMISPHERE = GeodeticPatch(0, M_PI/2, M_PI/2, M_PI/2);
|
||||
|
||||
const ChunkIndex ChunkLodGlobe::LEFT_HEMISPHERE_INDEX = ChunkIndex(0, 0, 1);
|
||||
const ChunkIndex ChunkLodGlobe::RIGHT_HEMISPHERE_INDEX = ChunkIndex(1, 0, 1);
|
||||
const ChunkIndex ChunkedLodGlobe::LEFT_HEMISPHERE_INDEX = ChunkIndex(0, 0, 1);
|
||||
const ChunkIndex ChunkedLodGlobe::RIGHT_HEMISPHERE_INDEX = ChunkIndex(1, 0, 1);
|
||||
|
||||
|
||||
ChunkLodGlobe::ChunkLodGlobe(
|
||||
ChunkedLodGlobe::ChunkedLodGlobe(
|
||||
const Ellipsoid& ellipsoid,
|
||||
std::shared_ptr<TileProviderManager> tileProviderManager)
|
||||
: _ellipsoid(ellipsoid)
|
||||
@@ -70,33 +70,31 @@ namespace openspace {
|
||||
_patchRenderer.reset(new ChunkRenderer(geometry, tileProviderManager));
|
||||
}
|
||||
|
||||
ChunkLodGlobe::~ChunkLodGlobe() {
|
||||
ChunkedLodGlobe::~ChunkedLodGlobe() {
|
||||
|
||||
}
|
||||
|
||||
bool ChunkLodGlobe::initialize() {
|
||||
bool ChunkedLodGlobe::initialize() {
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool ChunkLodGlobe::deinitialize() {
|
||||
bool ChunkedLodGlobe::deinitialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChunkLodGlobe::isReady() const {
|
||||
bool ChunkedLodGlobe::isReady() const {
|
||||
bool ready = true;
|
||||
return ready;
|
||||
}
|
||||
|
||||
ChunkRenderer& ChunkLodGlobe::getPatchRenderer() const{
|
||||
ChunkRenderer& ChunkedLodGlobe::getPatchRenderer() const{
|
||||
return *_patchRenderer;
|
||||
}
|
||||
|
||||
void ChunkLodGlobe::render(const RenderData& data){
|
||||
void ChunkedLodGlobe::render(const RenderData& data){
|
||||
minDistToCamera = INFINITY;
|
||||
ChunkNode::renderedPatches = 0;
|
||||
|
||||
|
||||
|
||||
_leftRoot->render(data);
|
||||
_rightRoot->render(data);
|
||||
|
||||
@@ -110,11 +108,11 @@ namespace openspace {
|
||||
//LDEBUG(ChunkNode::renderedPatches << " / " << ChunkNode::instanceCount << " chunks rendered");
|
||||
}
|
||||
|
||||
void ChunkLodGlobe::update(const UpdateData& data) {
|
||||
void ChunkedLodGlobe::update(const UpdateData& data) {
|
||||
_patchRenderer->update();
|
||||
}
|
||||
|
||||
const Ellipsoid& ChunkLodGlobe::ellipsoid() const
|
||||
const Ellipsoid& ChunkedLodGlobe::ellipsoid() const
|
||||
{
|
||||
return _ellipsoid;
|
||||
}
|
||||
+13
-5
@@ -51,13 +51,13 @@ namespace ghoul {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ChunkLodGlobe :
|
||||
public Renderable, public std::enable_shared_from_this<ChunkLodGlobe>{
|
||||
class ChunkedLodGlobe :
|
||||
public Renderable, public std::enable_shared_from_this<ChunkedLodGlobe>{
|
||||
public:
|
||||
ChunkLodGlobe(
|
||||
ChunkedLodGlobe(
|
||||
const Ellipsoid& ellipsoid,
|
||||
std::shared_ptr<TileProviderManager> tileProviderManager);
|
||||
~ChunkLodGlobe();
|
||||
virtual ~ChunkedLodGlobe();
|
||||
|
||||
ChunkRenderer& getPatchRenderer() const;
|
||||
|
||||
@@ -76,7 +76,13 @@ namespace openspace {
|
||||
const int minSplitDepth;
|
||||
const int maxSplitDepth;
|
||||
|
||||
private:
|
||||
RenderData* getSavedRenderData() const {
|
||||
return _savedRenderData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Covers all negative longitudes
|
||||
std::unique_ptr<ChunkNode> _leftRoot;
|
||||
@@ -94,6 +100,8 @@ namespace openspace {
|
||||
static const ChunkIndex RIGHT_HEMISPHERE_INDEX;
|
||||
|
||||
const Ellipsoid& _ellipsoid;
|
||||
|
||||
RenderData* _savedRenderData;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
#include <modules/globebrowsing/rendering/culling.h>
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
// forward declaration
|
||||
namespace openspace {
|
||||
class ChunkLodGlobe;
|
||||
class ChunkedLodGlobe;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace openspace {
|
||||
class GlobeMesh : public Renderable {
|
||||
public:
|
||||
GlobeMesh();
|
||||
~GlobeMesh();
|
||||
virtual ~GlobeMesh();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <modules/globebrowsing/globes/globemesh.h>
|
||||
#include <modules/globebrowsing/globes/clipmapglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -51,8 +51,7 @@ namespace openspace {
|
||||
|
||||
|
||||
RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
: DistanceSwitch()
|
||||
, _tileProviderManager(std::shared_ptr<TileProviderManager>(new TileProviderManager))
|
||||
: _tileProviderManager(std::shared_ptr<TileProviderManager>(new TileProviderManager))
|
||||
{
|
||||
// Read the radii in to its own dictionary
|
||||
Vec3 radii;
|
||||
@@ -99,17 +98,34 @@ namespace openspace {
|
||||
|
||||
//addSwitchValue(std::shared_ptr<ClipMapGlobe>(
|
||||
// new ClipMapGlobe(_ellipsoid, _tileProviderManager)), 1e8);
|
||||
addSwitchValue(std::shared_ptr<ChunkLodGlobe>(
|
||||
new ChunkLodGlobe(_ellipsoid, _tileProviderManager)), 1e9);
|
||||
addSwitchValue(std::shared_ptr<GlobeMesh>(new GlobeMesh()), 1e10);
|
||||
_distanceSwitch.addSwitchValue(std::shared_ptr<ChunkedLodGlobe>(
|
||||
new ChunkedLodGlobe(_ellipsoid, _tileProviderManager)), 1e9);
|
||||
_distanceSwitch.addSwitchValue(std::shared_ptr<GlobeMesh>(new GlobeMesh()), 1e10);
|
||||
}
|
||||
|
||||
RenderableGlobe::~RenderableGlobe() {
|
||||
|
||||
}
|
||||
|
||||
bool RenderableGlobe::initialize() {
|
||||
return _distanceSwitch.initialize();
|
||||
}
|
||||
|
||||
bool RenderableGlobe::deinitialize() {
|
||||
return _distanceSwitch.deinitialize();
|
||||
}
|
||||
|
||||
bool RenderableGlobe::isReady() const {
|
||||
return _distanceSwitch.isReady();
|
||||
}
|
||||
|
||||
void RenderableGlobe::render(const RenderData& data) {
|
||||
_distanceSwitch.render(data);
|
||||
}
|
||||
|
||||
void RenderableGlobe::update(const UpdateData& data) {
|
||||
_time = data.time;
|
||||
DistanceSwitch::update(data);
|
||||
_distanceSwitch.update(data);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -49,11 +49,16 @@ namespace opengl {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class RenderableGlobe : public DistanceSwitch {
|
||||
class RenderableGlobe : public Renderable {
|
||||
public:
|
||||
RenderableGlobe(const ghoul::Dictionary& dictionary);
|
||||
~RenderableGlobe();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
@@ -66,6 +71,9 @@ private:
|
||||
//std::vector<std::string> _colorTextureKeys;
|
||||
|
||||
std::shared_ptr<TileProviderManager> _tileProviderManager;
|
||||
|
||||
|
||||
DistanceSwitch _distanceSwitch;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -41,21 +41,21 @@ namespace openspace {
|
||||
Selects a specific Renderable to be used for rendering, based on distance to the
|
||||
camera
|
||||
*/
|
||||
class DistanceSwitch : public Renderable {
|
||||
class DistanceSwitch {
|
||||
public:
|
||||
DistanceSwitch();
|
||||
virtual ~DistanceSwitch();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
bool isReady() const override;
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
bool isReady() const;
|
||||
|
||||
/**
|
||||
Picks the first Renderable with the associated maxDistance greater than the
|
||||
current distance to the camera
|
||||
*/
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
void render(const RenderData& data);
|
||||
void update(const UpdateData& data);
|
||||
|
||||
/**
|
||||
Adds a new renderable (first argument) which may be rendered only if the distance
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
|
||||
std::vector<std::shared_ptr<Renderable>> _renderables;
|
||||
std::vector <double> _maxDistances;
|
||||
std::vector<double> _maxDistances;
|
||||
|
||||
};
|
||||
} // openspace
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace openspace {
|
||||
|
||||
LRUCache<HashKey, std::shared_ptr<Texture>> _tileCache;
|
||||
|
||||
const std::string _filePath;
|
||||
const std::string _filePath;
|
||||
|
||||
static bool hasInitializedGDAL;
|
||||
GDALDataset* _gdalDataSet;
|
||||
|
||||
@@ -38,13 +38,27 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class LonLatPatch;
|
||||
using namespace glm;
|
||||
|
||||
|
||||
|
||||
|
||||
class FrustumCuller {
|
||||
public:
|
||||
|
||||
enum PointTestResult : int {
|
||||
Inside = 0,
|
||||
Above,
|
||||
AboveRight,
|
||||
Right,
|
||||
BelowRight,
|
||||
Below,
|
||||
BelowLeft,
|
||||
Left,
|
||||
AboveLeft
|
||||
};
|
||||
|
||||
|
||||
FrustumCuller();
|
||||
~FrustumCuller();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user