/*****************************************************************************
 * $LastChangedDate: 2011-04-23 21:07:07 -0400 (Sat, 23 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   RotationList is a sequence of matrix rotations.
 *//*
 * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef OBJECT_ROTATION_LIST_HH
#define OBJECT_ROTATION_LIST_HH 1

#include <list>
#include <fstream>
#include "math/types_trig.hh"
#include "math/matrix.hh"
using namespace math;

namespace object {

class RotationList;
class Object;

////////////////////////////////////////////////////////////////////////////////
/// @brief RotationList is a sequence of matrix rotations.
///
/// RotationList is useful to set the initial orientation of a 3D model.
/// RotationLists are defined in .conf files (Conf members).
///
/// Example of a rotation list defined in a .conf file:
/// AircraftRotationList  YY -90.0 XX 90.0 YY 8.5
///
/// Also RotationList can be applied to a general matrix
/// (isn't limited to Object) by using RotationList::Apply(Matrix&).
///
class RotationList
{
public:
    /// @brief Defines a rotation (axis and radian).
    ///
    class Rotation
    {
    friend class RotationList;
    public:
        Rotation( const uint axis, const Degree degree );
    private:
        uint    mAxis;
        Radian  mRadian;
    };

public:
            RotationList( void );
            ~RotationList();
    void    Clear( void ) { mRotationList.clear(); }
    void    Parse( std::ifstream& strm );
    void    AddRotation( const Rotation& rotation );
    void    Apply( Object& object ) const;
    void    Apply( Matrix& m ) const;

private:
    std::list<Rotation>  mRotationList;
};

} // namespace object

#endif // OBJECT_ROTATION_LIST_HH
