/* ------------------------------------------------------------------
 * 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_IMAGEINPLACE_H_
#define _INCLUDE__GEM_PIXES_PIX_IMAGEINPLACE_H_

#include "Pixes/pix_multiimage.h"
#include "Gem/GemGL.h"

/*-----------------------------------------------------------------
-------------------------------------------------------------------
CLASS
    pix_imageInPlace

    Load multiple images into a pix block and texture immediately

KEYWORDS
    pix

DESCRIPTION

    You can select which file by giving a number.

-----------------------------------------------------------------*/
class GEM_EXTERN pix_imageInPlace : public pix_multiimage
{
  CPPEXTERN_HEADER(pix_imageInPlace, pix_multiimage);

public:

  //////////
  // Constructor
  pix_imageInPlace(t_symbol* filename, t_floatarg baseImage,
                   t_floatarg topImage, t_floatarg skipRate);

protected:

  //////////
  // Destructor
  virtual ~pix_imageInPlace();

  ////////
  // extension check
  virtual bool isRunnable(void);

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

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

  //////////
  virtual void    startRendering();

  //////////
  virtual void    stopRendering();

  //////////
  // When a preload is received
  virtual void    preloadMess(t_symbol* filename, int baseImage,
                              int topImage, int skipRate);

  //////////
  // When a download is received
  virtual void    downloadMess();
  bool m_wantDownload;

  //////////
  // When a purge is received
  virtual void    purgeMess();

  //////////
  // quality message
  virtual void    textureQuality(int type);

  //////////
  // repeat message
  virtual void    repeatMess(int type);

  //////////
  int                             mInPreload;
  GLuint          m_textureQuality, m_repeat;

private:

  //////////
  // static member functions
  static void     preloadMessCallback(void *data, t_symbol* filename,
                                      t_float baseImage, t_float topImage, t_float skipRate);
};

#endif  // for header file
