Using log2 for calculating desired split level, but have to fake earth radius in ChunkLodGlobe

This commit is contained in:
Erik Broberg
2016-04-11 20:52:08 -04:00
parent 459633c0d3
commit 0784fe22f8
4 changed files with 18 additions and 9 deletions
@@ -55,9 +55,9 @@ namespace openspace {
ChunkLodGlobe::ChunkLodGlobe(const ghoul::Dictionary& dictionary)
: _leftRoot(new ChunkNode(*this, LEFT_HEMISPHERE))
, _rightRoot(new ChunkNode(*this, RIGHT_HEMISPHERE))
, globeRadius(6.3e6)
, globeRadius(1.6*6.3e6)
, minSplitDepth(1)
, maxSplitDepth(7)
, maxSplitDepth(15)
, _rotation("rotation", "Rotation", 0, 0, 360)
{
std::string name;
@@ -25,6 +25,7 @@
#include <modules/globebrowsing/rendering/patchrenderer.h>
// open space includes
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
@@ -103,10 +104,12 @@ namespace openspace {
// TODO : Model transform should be fetched as a matrix directly.
mat4 modelTransform = translate(mat4(1), data.position.vec3());
mat4 modelViewProjectionTransform = data.camera.projectionMatrix()
* viewTransform * modelTransform;
LatLon swCorner = patch.southWestCorner();
_programObject->setUniform("modelViewProjectionTransform", data.camera.projectionMatrix() * viewTransform * modelTransform);
_programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
_programObject->setUniform("minLatLon", vec2(swCorner.lat, swCorner.lon));
_programObject->setUniform("latLonScalingFactor", 2.0f * vec2(patch.halfSize.lat, patch.halfSize.lon));
_programObject->setUniform("globeRadius", float(radius));
@@ -70,6 +70,8 @@ namespace openspace {
// Mainly for debugging purposes @AA
addProperty(_rotation);
setBoundingSphere(pss(6.0e4, 0));
//addSwitchValue(std::shared_ptr<ClipMapGlobe>(new ClipMapGlobe(dictionary)), 1e9);
addSwitchValue(std::shared_ptr<ChunkLodGlobe>(new ChunkLodGlobe(dictionary)), 1e9);
addSwitchValue(std::shared_ptr<GlobeMesh>(new GlobeMesh(dictionary)), 1e10);