[Development] Qt3D. How to change the speed of camera motion?

Dmitrii Volosnykh dmitrii.volosnykh at gmail.com
Wed Apr 3 14:48:01 CEST 2013


Hi,

first of all, I realize that Qt3D is a premature module and targeted
for 5.2 release. Anyway, it is already a wealthy piece of work that
can be used for some cases.

The default settings regarding motion of camera are not suitable for
me (i.e. panning using mouse is way too slow).

Looking in sources, I've found that such user interaction is done via
QGLView::wheel(), pan(), and rotate(). So, it would be possible to,
for example, accelerate camera motion by multiplying parameters of
these functions before actually calling them. Unforunately, all of
them are private to QGLView.

To try it other way, it could be possible to tweak viewDelta() to
return its value multiplied by a factor or pass tweaked arguments to
base class's version of veiwDelta(). Despite viewDelta() is protected
and visible from derived class (while being used only inside QGLView
and nowhere else), it is not virtual, hence can not be reimplemented.
Even if it would, its reimplementaion would affect all of the wheel(),
pan, and rotate() methods. I am not sure that this is always a good
idea.

To achieve my goal anyhow, I had to make a verbose copy of pan()
method in my derived class. Thanks to the fact that viewDelta() is
protected, else this work around would not do the job.

Another disadvantage is that, as for me, I can not find a way to
preserve internal logic in QGLView::mouseMoveEvent() regarding private
panning-relative data (such as startPan, lastPan, panModifiers, etc.).
This means that I have to reinvent the wheel and code all that stuff
in order to call pan() with tweaked parameters from my
reimplementation of mouseMoveEvent(). Of course, that looks very ugly
and frustrates me.

Cloning of pan() method in derived class is directly avoidable by
making QGLVew::pan() be protected. And the issue with reimplementing
mouseMoveEvent() is, probably, solvable by making pan(), wheel(),
rotate() methods being virtual. Maybe, Method viewDelta() is also
could be virtual in order to allow change behaviour of all three
methods in one place.

Another solutions is probably in exposing through QGLView's interface
some properties like panFactor, wheelFactor, rotateFactor. Maybe, this
is the most easiest way to achive the primary task that discoverd
issued being discussed: to change the speed of camera motion. In this
case, all access qualifiers and absense of 'virtual' modifier can
remain unchanged.

Regards,
Dmitrii.



More information about the Development mailing list