/*###################################################################################################
  #Objet: Camera.hpp                                                                                #
  #Auteur: Thibault Podevin                                                                         #
  #But: Donner un point de vue dans la map et contient le buffer pour dessiner les lignes           #
  #Date: 17-12-2012                                                                                 #
  ###################################################################################################*/
#ifndef CAMERA_HPP_INCLUDED
#define CAMERA_HPP_INCLUDED


#include "point.hpp"
#include "shell.hpp"
#include <stack>

#include "pile.h"

using namespace std;

class camera : public point
{
    float _a,//angle de rotation a,b,c
          _b,
          _c,
          _r;//radius

    void _moveShell(shell &s);
    void _moveShell(shell &s, point p);
public:

    shell _temp;

    //Structure qui contient les coordones de lignes a dessiner et leur couleur
    struct draw
    {
        float _p1X, _p1Y, _p2X, _p2Y;
        unsigned char _r,_g,_b;

        draw()                      //constructeur par defaut
        {
            _p1X = 0;
            _p1Y = 0;
            _p2X = 0;
            _p2Y = 0;
            _r = 0;
            _g = 0;
            _b = 0;
        }

        draw(float x1,float y1, float x2, float y2, unsigned char r, unsigned char g, unsigned char b)//constructeur avec parametres
        {
            _p1X = x1;
            _p1Y = y1;
            _p2X = x2;
            _p2Y = y2;
            _r = r;
            _g = g;
            _b = b;
        }
    };

    //Buffer de l'engine
    pile<draw> _stkLigne;


    camera();
    camera(float, float, float);
    camera(float, float, float, float); //constructeur avec radius

    //Change les parametres de l'angle de la camere
    void turnX(float angle);
    void turnY(float angle);
    void turnZ(float angle);

    void rot(shell &s);                 //effectue les changement d'angle

    //Deplace la camera
    void moveX(float X);
    void moveY(float Y);
    void moveZ(float Z);

    void moveTo(const point &p);    //Permet de setter la position de la camera avec un point

    void setRadius(float R);

    //Ajoute des Shell a afficher a l'ecran
    void addShell(const shell &s);

    //Les differentes methode qui utilise le buffer
    const draw& currentLine();      //top du buffer
    void unmountBuffer();           //pop du buffer
    bool bufferEmpty();             //test de contnu du buffer
};

#endif // CAMERA_HPP_INCLUDED
