| 102 | } |
| 103 | |
| 104 | void rotateOrbit (float dtheta, float dphi) |
| 105 | { |
| 106 | if (handedness == RIGHT_HANDED) dtheta *= -1.0f; |
| 107 | const Vec3fa up1 = normalize(up); |
| 108 | Vec3fa view1 = normalize(to-from); |
| 109 | view1 = xfmVector(AffineSpace3fa::rotate(up1, dtheta), view1); |
| 110 | const float phi = acosf(dot(view1, up1)); |
| 111 | const float dphi2 = phi - clamp(phi-dphi, 0.001f*float(pi), 0.999f*float(pi)); |
| 112 | view1 = xfmVector(AffineSpace3fa::rotate(cross(view1, up1), dphi2), view1); |
| 113 | from = to - length(to-from) * view1; |
| 114 | } |
| 115 | |
| 116 | void dolly (float ds) |
| 117 | { |