#ifndef _TEXTUREMAP_
#define _TEXTUREMAP_

#include <math.h>
#include <iostream.h>
#include <Inventor/SbColor.h>

#define DEFAULT_S 360
#define DEFAULT_T 180

class TextureMap {
public:
  enum filter_t {
    BOX,
    TENT,
    QUADRATIC,
    CUBIC,
    QUARTIC
  };

  filter_t       filter;
  int            filterRadius;

                 TextureMap  ();
                 TextureMap  (SbVec2s s, int nc);
                ~TextureMap  ();

  void           drawSTDot   (float phi, float theta, SbColor color);
  unsigned char *getValue    (SbVec2s &s, int &nc);
  void           setTexture  (SbColor color);
  void           reset       ();

private:
  unsigned char *image;
  float         *totals;
  float         *imgfloats;
  SbVec2s        size;
  int            components;

  void           setPixel    (float s, float t, SbColor color, float weight);
  float          box         (float dist, float rad);
  float          tent        (float dist, float rad);
  float          quadratic   (float dist, float rad);
  float          cubic       (float dist, float rad);
  float          quartic     (float dist, float rad);
};

#endif // _TEXTUREMAP_
