[Interest] [Qt3D] QAxisActionHandler axis value bounds
Sean Harmer
sean.harmer at kdab.com
Mon Dec 14 16:50:01 CET 2015
Hi,
On Monday 14 Dec 2015 17:36:55 Nye wrote:
> Hello Sean,
> Thanks, that mostly clears things up. Only one additional question:
> How are they normalized, to the window/opengl surface size that I have
> passed to the aspect engine?
It's normalised to the [1,1] based purely upon sensitivity rather than pixel
size of the surface. The respective code is in mousecontroller.cpp, in the
function updateMouseEvents():
m_mouseState.xAxis = m_sensitivity * (e.screenPos().x() - m_previousPos.x());
m_mouseState.yAxis = m_sensitivity * (m_previousPos.y() - e.screenPos().y());
The xAxis and yAxis values are later clamped to [-1, 1].
So setting the sensitivity to 0.1 means you have to move 10 pixels in a frame
to get an axis value of magnitude 1.
Of course once you have the axis value you can scale or transform it how you
like.
Cheers,
Sean
>
> Kind regards.
>
> On Mon, Dec 14, 2015 at 3:11 PM, Sean Harmer <sean.harmer at kdab.com> wrote:
> > On Monday 14 Dec 2015 12:30:40 Nye wrote:
> > > Hello,
> > > I understood (by trial and error) that in the axisValueChanged signal I
> >
> > get
> >
> > > a relative offset. I incorrectly assumed it was an absolute value. Is it
> > > scaled or bound somehow, in example to the screen resolution, or is the
> > > value absolute (I'm using it with a mouse device)? Additionally, I'd
> > > like
> > > to know what is the measurement used, does it come in pixels, or some
> > > arbitrary units?
> >
> > The values are normalised units [-1, 1]. How these are mapped from pixel
> > offsets reported by the windowing system is controlled by the sensitivity
> > property on the MouseController.
> >
> > Cheers,
> >
> > Sean
> >
> > --
> > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > KDAB (UK) Ltd, a KDAB Group company
> > Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> > Mobile: +44 (0)7545 140604
> > KDAB - Qt Experts
--
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts
More information about the Interest
mailing list