/// This file is part of the X3DToolKit library
/// Copyright (C) 2002-2004  Yannick Le Goc (legoc@imag.fr)

/// http://artis.imag.fr/Members/Yannick.Legoc/X3D/

/// This library is free software; you can redistribute it and/or
/// modify it under the terms of the GNU Lesser General Public
/// License as published by the Free Software Foundation; either
/// version 2.1 of the License, or (at your option) any later version.

/// This library is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
/// Lesser General Public License for more details.

/// You should have received a copy of the GNU Lesser General Public
/// License along with this library; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#ifndef X3DTK_GL_RENDERERSTATEVARIABLES_H
#define X3DTK_GL_RENDERERSTATEVARIABLES_H

#include "StateVariables.h"
#include "GL_X3DShapeNode.h"

#include <list>
#include <vector>

namespace X3DTK {
namespace GL {

/*! \brief Class declared in <b><X3DTK/GL/renderer.h></b> providing StateVariables
 *  of the GL::Renderer processor.
 *
 *  \ingroup GL
 */
 
class RendererStateVariables : public StateVariables
{
public:
  /// Constructor.
  RendererStateVariables();
  /// Destructor.
  virtual ~RendererStateVariables();
  
  /// Initializes the selection. x and y are the screen coordinates.
  void initSelect(double x, double y);
  /// Finishes the selection.
  void finishSelect();
  
  /*// Pushes the transformation matrix.
  void pushMatrix(const MFFloat &transformation);
  // Pops the transformation matrix.
  void popMatrix(); */
  /// Stores the shape. Returns the integer identifier of the shape.
  void storeShape(X3DShapeNode *S);
  /// Gets the current id.
  inline int getCurrentId() const {return _shapeVector.size() - 1;};
  /// Sets the selection mode.
  void setSelectionMode(bool value);
  
  /// Returns the selected shape.
  inline X3DShapeNode *getShape() const {return _shape;};
  /// Gets the selection mode.
  inline bool getSelectionMode() const {return _selectionMode;};

private:
  //std::list<MFFloat> _matrixStack;
  //std::vector<MFFloat> _matrixVector;
  std::vector<X3DShapeNode *> _shapeVector;
  bool _selectionMode;
  X3DShapeNode *_shape;
  GLuint _hits[32768];
};

}
}

#endif
