#ifndef __CUBEMAP_H
#define __CUBEMAP_H

#include "maths_defs.h"
#include "Vector3.h"
#include "Structures.h"
#include "Png.h"
#include <iostream>
#include <fstream>
#include <string>
typedef Vector3 Color;

class Cubemap
{
    Color **tab;
    unsigned sizeX,sizeY;
    PNGImage pngImage;

  protected:
    Color readTexture(const real& u, const real& v);

  public:
    Cubemap(unsigned _sizeX=512, unsigned _sizeY=512)
     : sizeX(_sizeX),sizeY(_sizeY)
    {
    }

    Cubemap(const std::string& _n)
    {
      Init(_n);
    }

    Color Read(const Ray& );
    bool  Init(const std::string& n);

    ~Cubemap()
    {
      for (unsigned i=0;i<sizeY;i++)
          delete [] tab[i];
      delete tab;
    }
};



#endif

