Solve merge conflict.

This commit is contained in:
Kalle Bladin
2016-04-15 17:22:59 -04:00
12 changed files with 242 additions and 105 deletions
@@ -69,9 +69,7 @@ namespace openspace {
}
}
void PatchRenderer::setFrustrumCuller(std::shared_ptr<FrustrumCuller> fc) {
_frustrumCuller = fc;
}
//////////////////////////////////////////////////////////////////////////////////////
// LATLON PATCH RENDERER //
@@ -105,17 +103,6 @@ namespace openspace {
mat4 modelViewProjectionTransform = data.camera.projectionMatrix()
* viewTransform * modelTransform;
// View frustrum culling
if (_frustrumCuller != nullptr) {
//LatLon center = patch.center;
//vec3 centerPoint = radius * center.asUnitCartesian();
if (!_frustrumCuller->isVisible(patch, radius, modelViewProjectionTransform)) {
// dont render the patch
return;
}
}
// Get the textures that should be used for rendering
glm::ivec3 tileIndex = tileSet.getTileIndex(patch);
LatLonPatch tilePatch = tileSet.getTilePositionAndScale(tileIndex);
@@ -130,7 +117,7 @@ namespace openspace {
LatLon swCorner = patch.southWestCorner();
_programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
_programObject->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
_programObject->setUniform("lonLatScalingFactor", 2.0f * vec2(patch.halfSize.toLonLatVec2()));
_programObject->setUniform("lonLatScalingFactor", 2.0f * vec2(patch.halfSize().toLonLatVec2()));
_programObject->setUniform("globeRadius", float(radius));
glEnable(GL_DEPTH_TEST);
@@ -174,18 +161,19 @@ namespace openspace {
// Snap patch position
int segmentsPerPatch = 32;
LatLon halfSize = patch.halfSize();
LatLon stepSize = LatLon(
patch.halfSize.lat * 2 / segmentsPerPatch,
patch.halfSize.lon * 2 / segmentsPerPatch);
halfSize.lat * 2 / segmentsPerPatch,
halfSize.lon * 2 / segmentsPerPatch);
ivec2 patchesToCoverGlobe = ivec2(
M_PI / (patch.halfSize.lat * 2) + 0.5,
M_PI * 2 / (patch.halfSize.lon * 2) + 0.5);
M_PI / (halfSize.lat * 2) + 0.5,
M_PI * 2 / (halfSize.lon * 2) + 0.5);
ivec2 intSnapCoord = ivec2(
patch.center.lat / (M_PI * 2) * segmentsPerPatch * patchesToCoverGlobe.y,
patch.center.lon / (M_PI) * segmentsPerPatch * patchesToCoverGlobe.x);
patch.center().lat / (M_PI * 2) * segmentsPerPatch * patchesToCoverGlobe.y,
patch.center().lon / (M_PI) * segmentsPerPatch * patchesToCoverGlobe.x);
LatLon swCorner = LatLon(
stepSize.lat * intSnapCoord.x - patch.halfSize.lat,
stepSize.lon * intSnapCoord.y - patch.halfSize.lon);
stepSize.lat * intSnapCoord.x - halfSize.lat,
stepSize.lon * intSnapCoord.y - halfSize.lon);
ivec2 contraction = ivec2(intSnapCoord.y % 2, intSnapCoord.x % 2);
@@ -207,7 +195,7 @@ namespace openspace {
_programObject->setUniform("modelViewProjectionTransform", data.camera.projectionMatrix() * viewTransform * modelTransform);
_programObject->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
_programObject->setUniform("lonLatScalingFactor", 2.0f * vec2(patch.halfSize.toLonLatVec2()));
_programObject->setUniform("lonLatScalingFactor", 2.0f * vec2(halfSize.toLonLatVec2()));
_programObject->setUniform("globeRadius", float(radius));
_programObject->setUniform("contraction", contraction);