/*   EXTRAITS DE LA LICENCE
	Copyright CEA, contributeurs : Luc BILLARD et Damien
	CALISTE, laboratoire L_Sim, (2001-2006)
  
	Adresse mèl :
	BILLARD, non joignable par mèl ;
	CALISTE, damien P caliste AT cea P fr.

	Ce logiciel est un programme informatique servant à visualiser des
	structures atomiques dans un rendu pseudo-3D. 

	Ce logiciel est régi par la licence CeCILL soumise au droit français et
	respectant les principes de diffusion des logiciels libres. Vous pouvez
	utiliser, modifier et/ou redistribuer ce programme sous les conditions
	de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA 
	sur le site "http://www.cecill.info".

	Le fait que vous puissiez accéder à cet en-tête signifie que vous avez 
	pris connaissance de la licence CeCILL, et que vous en avez accepté les
	termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel).
*/

/*   LICENCE SUM UP
	Copyright CEA, contributors : Luc BILLARD et Damien
	CALISTE, laboratoire L_Sim, (2001-2006)

	E-mail address:
	BILLARD, not reachable any more ;
	CALISTE, damien P caliste AT cea P fr.

	This software is a computer program whose purpose is to visualize atomic
	configurations in 3D.

	This software is governed by the CeCILL  license under French law and
	abiding by the rules of distribution of free software.  You can  use, 
	modify and/ or redistribute the software under the terms of the CeCILL
	license as circulated by CEA, CNRS and INRIA at the following URL
	"http://www.cecill.info". 

	The fact that you are presently reading this means that you have had
	knowledge of the CeCILL license and that you accept its terms. You can
	find a copy of this licence shipped with this software at Documentation/licence.en.txt.
*/
#ifndef RENDERINGATOMIC_H
#define RENDERINGATOMIC_H

#include <GL/gl.h>
#include <GL/glu.h> 

#include <visu_rendering.h>
#include <visu_data.h>
#include <visu_object.h>
#include <visu_tools.h>

/* This method draws spheres to represent atoms.
   It introduces a new resource : the radius of
   the sphere. It can read data file either in d3
   format or in ascii format. */

/**
 * renderingAtomic_shapeId:
 *
 * This enum is used as identifier for shapes managed by the
 * attomic rendering method.
 */
enum renderingAtomic_shapeId
  {
    shapeSphere,
    shapeCube,
    nbShapes
  };
   
/**
 * initAtomic:
 *
 *Create the structure and initialise its values.
 *
 * Returns: a newly allocated rendering method.
 */
RenderingMethod* initAtomic();

/**
 * pointerOnRenderingAtomicMethod:
 *
 * This is a pointer to this rendering method.
 * It should be considered read-only.
 */
RenderingMethod *pointerOnRenderingAtomicMethod;


/***************/
/* OpenGL Part */
/***************/

/**
 * renderingAtomic_createShape:
 * @view: a #OpenGLView object that contains the geometric caracteristic for
 *        the rendering ;
 * @ele: a #VisuElement object.
 *
 * This function is used to create the OpenGL objects that
 * correspond to the @ele #VisuElement in the atomic rendering
 * method. It creates an OpenGL list whose number is stored in
 * @ele->openGLIdentifier. For the atomic method, elements are
 * represented by spheres.
 */
void renderingAtomic_createShape(OpenGLView *view, VisuElement *ele);
/**
 * renderingAtomic_positionShape:
 * @visuData: a #VisuData object ;
 * @node: a #VisuNode object ;
 * @ele: a #VisuElement.
 *
 * This method translates the given node to the right position. The @ele
 * parameter is the #VisuElement of the given node.
 */
void renderingAtomic_positionShape(VisuData *visuData, VisuNode *node, VisuElement* ele);

/***********************/
/* Different resources */
/***********************/
/**
 * renderingAtomicGet_radius:
 * @ele: a #VisuElement object.
 *
 * In the rendering atomic method, shapes are characterized by
 * a radius. This method gets it for the specified element. If this
 * element has no radius defined yet, the default value is
 * associated and returned.
 *
 * Returns: the radius of the specified element. A negative value if something
 *          goies wrong.
 */
float renderingAtomicGet_radius(VisuElement *ele);
/**
 * renderingAtomicGet_radiusDefault:
 *
 * This method gets the default radius of the rendering atomic method.
 *
 * Returns: the default value for radius resource.
 */
float renderingAtomicGet_radiusDefault();
/**
 * renderingAtomicSet_radius:
 * @ele: a #VisuElement object ;
 * @value: a positive floating point value.
 *
 * This change the radius value of element @ele to @value.
 *
 * Returns: 1 if a call to renderingAtomic_createShape() is required, 0 if not.
 */
int renderingAtomicSet_radius(VisuElement* ele, float value);

/**
 * renderingAtomicGet_shape:
 * @ele: a #VisuElement object.
 *
 * In the rendering atomic method, shapes are multiple.
 * This method gets it for the specified element. Shapes are
 * characterized by their id, corresponding to an integer value.
 * Use the enum #renderingAtomic_shapeId to associate an integer value
 * to a specific shape.
 *
 * Returns: the shape id of the element @ele.
 */
int renderingAtomicGet_shape(VisuElement *ele);
/**
 * renderingAtomicGet_shapeDefault:
 *
 * This method gets the default shape.
 *
 * Returns: the default shape id.
 */
int renderingAtomicGet_shapeDefault();
/**
 * renderingAtomicGet_shapeName:
 * @shape: an integer.
 *
 * This method does the corresponding between a shape id and
 * its name (a string value).
 *
 * Returns: the name associated to a shape.
 */
const char* renderingAtomicGet_shapeName(int shape);
/**
 * renderingAtomicGet_shapeNameDefault:
 *
 * This method is used to retrieve the default name for shapes.
 *
 * Returns: the name associated to the default shape.
 */
const char* renderingAtomicGet_shapeNameDefault();
/**
 * renderingAtomicSet_shape:
 * @ele: a #VisuElement object ;
 * @shape: an integer.
 *
 * This changes the shape of the element @ele to the shape defined by its id.
 *
 * Returns: 1 if a call to renderingAtomic_createShape() is required, 0 if not.
 */
int renderingAtomicSet_shape(VisuElement *ele, int shape);
/**
 * renderingAtomicSet_shapeFromName:
 * @ele: a #VisuElement object ;
 * @shape: a string.
 *
 * This method is equivalent to renderingAtomicSet_shape() but the shape is
 * defined by its name.
 *
 * Returns: 1 if a call to renderingAtomic_createShape() is required, 0 if not.
 */
int renderingAtomicSet_shapeFromName(VisuElement *ele, char* shape);
/**
 * renderingAtomicGet_allShapes:
 *
 * This methods retrieve the whole list of shape names used by V_Sim for example
 * in the resources file. These names are not translated. If internationalized
 * names are required, use renderingAtomicGet_allShapesI18n() instead.
 *
 * Returns: a pointer to a list of shape names (should not be modified or freed).
 */
const char** renderingAtomicGet_allShapes();
/**
 * renderingAtomicGet_allShapesI18n:
 *
 * This methods retrieve the whole list of shape names, translated strings.
 *
 * Returns: a pointer to a list of shape names (should not be modified or freed).
 */
const char** renderingAtomicGet_allShapesI18n();



#endif
