Skip to content

Commit

Permalink
Addd LookAt::transform(..) and set(..) methods
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Feb 21, 2019
1 parent 46c79cc commit 8f1f42c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/vsg/viewer/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ namespace vsg
up = normalize(cross(side, look));
}

void transform(const dmat4& matrix)
{
up = normalize(matrix * (eye + up) - matrix * eye);
center = matrix * center;
eye = matrix * eye;
}

void set(const dmat4& matrix)
{
up = normalize(matrix * (dvec3(0.0, 0.0, 0.0) + dvec3(0.0, 1.0, 0.0)) - matrix * dvec3(0.0, 0.0, 0.0));
center = matrix * dvec3(0.0, 0.0, -1.0);
eye = matrix * dvec3(0.0, 0.0, 0.0);
}

void get(mat4& matrix) const override { matrix = lookAt(eye, center, up); }
void get(dmat4& matrix) const override { matrix = lookAt(eye, center, up); }

Expand Down

0 comments on commit 8f1f42c

Please sign in to comment.