[Interest] Qt3D: A custom camera controller
Volker Enderlein
volker.enderlein at ifm-chemnitz.de
Wed Feb 6 09:25:19 CET 2019
Am 29.01.2019 um 12:07 schrieb Volker Enderlein:
> Hi all,
>
> I implemented a custom camera controller (implementing the
> ExaminerViewer camera handling from OpenInventor) and don't know how
> to select the linearSpeed and the lookSpeed values dependent on the
> size of the scene as my scenegraph can be changed at runtime. I came
> up with a solution but it is not working as expected.
>
> auto heightAngle = theCamera->fieldOfView() / 180.0f *
> static_cast<float>(M_PI);
> auto focalDist = theCamera->viewVector().length();
> auto height = 2.0f * focalDist * std::tan(heightAngle / 2.0f);
> height = height < 1.0f ? 1.0f : height;
> auto width = height / theCamera->aspectRatio();
> // NDC (left, right, bottom, top) (-1, 1, -1, 1)
> // MagnificationFactor: max(height, width)/linearSpeed()
> auto linearSpeedMagnificationFactor = std::max(height,
> width)/linearSpeed();
>
> Are there any examples/experiences implementing custom camera
> controllers?
>
> Thanks in advance,
>
> Cheers, Volker
>
Nevermind, I figured out how to do pixel exact displacement without
using the linearSpeed or lookSpeed.
Cheers, Volker
--
More information about the Interest
mailing list