Lat lon patch follows camera and gets projected to a sphere.

This commit is contained in:
kbladin
2016-04-05 18:09:29 -04:00
parent 506c624a73
commit f9a98a2d2a
5 changed files with 17 additions and 17 deletions

View File

@@ -56,7 +56,7 @@ namespace openspace {
: _grid(
xRes,
yRes,
Geometry::Positions::Yes,
Geometry::Positions::No,
Geometry::TextureCoordinates::Yes,
Geometry::Normals::No)
, _programObject(nullptr)
@@ -108,7 +108,7 @@ namespace openspace {
_programObject->activate();
// TODO : Not sure if double precision will be needed for all these calculations
// Using doubles in case.
// Using doubles in case but might slow things down.
// TODO : Need to get the radius of the globe
double r = 6e6;
@@ -149,7 +149,9 @@ namespace openspace {
glm::dvec3 camDir = glm::normalize(position - camPos);
glm::dvec3 camUp = glm::dvec3(0,1,0);// data.camera.lookUpVector();
// Get camera transform matrix (double precision)
glm::dmat4 viewTransform = glm::lookAt(camPos, camPos + camDir, camUp);
glm::dmat4 viewTransform = glm::inverse(glm::translate(glm::dmat4(1.0), camPos));
//glm::dmat4 viewTransform = glm::lookAt(camPos, camPos + camDir, camUp);
viewTransform = glm::dmat4( data.camera.viewRotationMatrix()) * viewTransform;
// Transform control points to camera space
p00 = glm::dvec3(viewTransform * glm::dvec4(p00, 1.0));
p10 = glm::dvec3(viewTransform * glm::dvec4(p10, 1.0));