/* ------------------------------------------------------------------
 * GEM - Graphics Environment for Multimedia
 *
 * SPDX-FileCopyrightText: © 1997, Mark Danks and the GEM contributors
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * ------------------------------------------------------------------
 */

#ifndef _INCLUDE__GEM_PIXES_PIX_COORDINATE_H_
#define _INCLUDE__GEM_PIXES_PIX_COORDINATE_H_

#include "Base/GemBase.h"

class TexCoord;

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    pix_coordinate

KEYWORDS
    pix

DESCRIPTION

    sets the texture coordinates

    Inlet for a list - "coords"
    "coords" - The texture coordinate list

-----------------------------------------------------------------*/
class GEM_EXTERN pix_coordinate : public GemBase
{
  CPPEXTERN_HEADER(pix_coordinate, GemBase);

public:

  //////////
  // Constructor
  pix_coordinate();

protected:

  //////////
  // Destructor
  virtual ~pix_coordinate();

  //////////
  // Do the rendering
  virtual void    render(GemState *state);

  //////////
  // Turn back off texture mapping
  virtual void    postrender(GemState *state);

  //////////
  // The texture coordinates
  TexCoord        *m_coords;
  // a place-holder, in case we want to scale the coords (for rectangle textures)
  TexCoord        *m_rectcoords;

  //////////
  // The number
  int             m_numCoords;

  int             m_oldTexType;

  //////////
  // this is what we get from upstream
  TexCoord        *m_oldTexCoords;
  int             m_oldNumCoords;

  //////////
  // Set the texture coordinates
  void            coordsMess(int argc, t_atom *argv);

private:

  //////////
  // Static member functions
  static void     coordsMessCallback(void *data, t_symbol*, int argc,
                                     t_atom *argv);
};

#endif  // for header file
