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

/*-----------------------------------------------------------------

  A world_light

  -----------------------------------------------------------------*/

#ifndef _INCLUDE__GEM_NONGEOS_WORLD_LIGHT_H_
#define _INCLUDE__GEM_NONGEOS_WORLD_LIGHT_H_

#include "Gem/GemConfig.h"
#include "Base/GemBase.h"
#include "Gem/GemGL.h"

/*-----------------------------------------------------------------
  -------------------------------------------------------------------
  CLASS
  world_light

  Creates a world_light - position is at infinity (can be rotated)

  DESCRIPTION

  Inlet for a list - "clrlist"

  "clrlist" - Determines color
  "int" - On/off state

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

public:

  //////////
  // Constructor
  world_light(t_floatarg lightNum);

protected:

  //////////
  // Destructor
  virtual ~world_light();

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

  //////////
  // show some representation of the light
  virtual void    renderDebug();

  //////////
  // Turn on/off the debugging object
  void            debugMess(int state);

  //////////
  // Turn the light on or off
  void            lightOnOffMess(int state);

  //////////
  // Set the light's color
  void            lightColorMess(GLfloat red, GLfloat green, GLfloat blue,
                                 GLfloat alpha);
  void            lightColorMess(t_symbol*, int, t_atom*);

  //////////
  // If you care about the start of rendering
  virtual void    startRendering();

  //////////
  // If you care about the stop of rendering
  virtual void    stopRendering();

  //-----------------------------------
  // GROUP:   Member variables
  //-----------------------------------

  //////////
  // The light color
  GLfloat         m_color[4];

  //////////
  // The position
  GLfloat         m_position[4];

  //////////
  // If a change occurred
  int             m_change;

  //////////
  // The on/off state of the light
  int             m_on;

  //////////
  // The on/off state for debugging
  int             m_debug;

  //////////
  // The light number with reference to OpenGL
  GLenum          m_light;

#ifdef GEM_HAVE_GLU
  //////////
  GLUquadricObj   *m_thing;
#endif
};

#endif  // for header file
