Inherits Frame.
Inherited by ManipulatedFrame.
Spinning parameters | |
| Quaternion | spinningQuaternion () const |
| Vec | rotationCenter () const |
| bool | rotatesAroundCenter () const |
| bool | orientationIsFrozen () const |
| void | setSpinningQuaternion (const Quaternion &q) |
| void | setRotationCenter (const Vec ¢er) |
| void | setRotateAroundCenter (const bool rac=true) |
| void | freezeOrientation (const bool fo=true) |
Timer configuration | |
| bool | isSpinning () const |
| int | updateInterval () const |
| virtual void | startSpinning (const int msecs=-1) |
| virtual void | stopSpinning () |
| void | setUpdateInterval (const int msecs) |
Signals | |
| void | spinned () |
Public Methods | |
| SpinningFrame () | |
| virtual | ~SpinningFrame () |
| virtual QDomElement | domElement (const QString &name, QDomDocument &doc) const |
| virtual void | initFromDOMElement (const QDomElement &de) |
Protected Slots | |
| void | updateFrame () |
A SpinningFrame is useful to animate some objects of the scene :
init()
{
sf = new SpinningFrame();
// Rotation around the Z axis, with a increment of 0.04 radian.
sf->setSpinningQuaternion(Quaternion(Vec(0,0,1), 0.04));
sf->startSpinning();
}
draw()
{
glPushMatrix();
glMultMatrixd(sf->matrix());
// Draw your object here.
glPopMatrix();
}
When rotatesAroundCenter() is true, the SpinningFrame will rotate around the rotationCenter() (defined in the world coordinate system). Use setRotateAroundCenter() and setRotationCenter() to change these values.
Additionally, when rotatesAroundCenter() is true, you can freeze the Frame orientation using freezeOrientation(). The Frame will then describe circles around the rotationCenter(), but its orientation will remain unchanged.
See the spinningFrame example for an illustration.
The spinningQuaternion() axis is always defined in the SpinningFrame coordinate system. You may want to use Frame::transformOfFrom() to convert this axis from an other Frame.
A mouse ManipulatedFrame derives from this class and it can spin when the mouse button is released while moving quickly enough. The manipulated object can hence have a continuous spinning (note that the Camera is one of these objects as it is attached to a ManipulatedFrame).
When spinning, the SpinningFrame emits a spinned() signal, which is connected to all the viewer's updateGL() functions. See the spinned() documentation for details.
when the SpinningFrame is created (see QGLViewer::connectSignalToAllViewers()), so that the display is automatically updated.
This signal connection technique is actually used for all the Frames that may be updated in your application. The ManipulatedFrame::manipulated() and the KeyFrameInterpolator::interpolated() signals are also connected to all the viewers' updateGL() functions when they are created.
In certain cases, this automatic display update may generate too many updates. Simply disconnect the signal to prevent this:
QGLViewer::disconnectSignalToAllViewers(mySpinningFrame, SIGNAL(spinned()));
|
|
Constructor sets default values : isSpinning() is |
|
|
Virtual destructor. Empty. |
|
||||||||||||
|
Creates an XML QDomElement that represents the SpinningFrame. Add to Frame::domElement() the SpinningFrame specific informations. Use initFromDOMElement() to restore the SpinningFrame state from the resulting domElement. Reimplemented from Frame. Reimplemented in ManipulatedCameraFrame, and ManipulatedFrame. |
|
|
|
|
|
Restore the SpinningFrame state from a QDomElement created by domElement(). See also Frame::initFromDOMElement(). Reimplemented from Frame. Reimplemented in ManipulatedCameraFrame, and ManipulatedFrame. |
|
|
|
|
|
|
|
|
|
|
|
Current spinning rotation center. Set using setRotationCenter(). See the Detailed Description section for more explanations. |
|
|
|
|
|
Defines the current rotationCenter(). This value will be used only when rotatesAroundCenter() is |
|
|
Defines the current spinningQuaternion(). |
|
|
Defines the update interval, defined in milliseconds. Default value is 40. Get current value from updateInterval().
|
|
|
This signal is emitted whenever the frame is spinning. Connect this signal to any object that must be notified. Note that when a SpinningFrame is created, this signal is automatically connected to all the viewers' updateGL() functions (see QGLViewer::connectSignalToAllViewers()), so that the QGLViewers' displays are automatically updated. This signal connection technique is actually used for all the Frames that may be updated in your application. The ManipulatedFrame::manipulated() and the KeyFrameInterpolator::interpolated() signals are also connected to all the viewers' updateGL() functions when they are created. In certain cases, this automatic display update may generate too many updates. Simply disconnect one of the signals to prevent this:
QGLViewer::disconnectSignalToAllViewers( pointerToTheSpinningFrame, SIGNAL(spinned()) );
|
|
|
This is the incremental rotation that will be applied to the SpinningFrame orientation, every updateInterval() milliseconds, when the SpinningFrame isSpinning(). Default value is a null rotation. Use setSpinningQuaternion() to define this value. More complex rotation motion can be achieved using the rotationCenter() and freezeOrientation(). See the Detailed Description section. |
|
|
Starts the spinning of the frame. Use stopSpinning() to stop.
See the spinningFrame example for an illustration. |
|
|
Stops the spinning which was initiated with startSpinning(). |
|
|
Update the Frame orientation (and possibly position), according to the SpinningFrame parameters. Emits spinned(). |
|
|
Returns the current update interval of the SpinningFrame. See isSpinning() to know if the Frame is actually spinning. This value can be set with setUpdateInterval() or with startSpinning(). |
1.3-rc2