trackball.h Example File demos/boxes/trackball.h
#ifndef TRACKBALL_H
#define TRACKBALL_H
#include <QtGui>
#include "vector.h"
class TrackBall
{
public:
enum TrackMode
{
Plane,
Sphere,
};
TrackBall(TrackMode mode = Sphere);
TrackBall(float angularVelocity, const gfx::Vector3f& axis, TrackMode mode = Sphere);
void push(const QPointF& p, const gfx::Quaternionf &transformation);
void move(const QPointF& p, const gfx::Quaternionf &transformation);
void release(const QPointF& p, const gfx::Quaternionf &transformation);
void start();
void stop();
gfx::Quaternionf rotation() const;
private:
gfx::Quaternionf m_rotation;
gfx::Vector3f m_axis;
float m_angularVelocity;
QPointF m_lastPos;
QTime m_lastTime;
bool m_paused;
bool m_pressed;
TrackMode m_mode;
};
#endif
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) |
Trademarks |
Qt 4.5.2 |
|