/*   EXTRAITS DE LA LICENCE
	Copyright CEA, contributeurs : Luc BILLARD, Damien
	CALISTE, Olivier D'Astier, laboratoire L_Sim, (2001-2006)
  
	Adresses mèl :
	BILLARD, non joignable par mèl ;
	CALISTE, damien P caliste AT cea P fr.
	D'ASTIER, dastier AT iie P cnam 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 and Damien
	CALISTE and Olivier D'Astier, laboratoire L_Sim, (2001-2006)

	E-mail addresses :
	BILLARD, not reachable any more ;
	CALISTE, damien P caliste AT cea P fr.
	D'ASTIER, dastier AT iie P cnam 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 RENDERINGSPIN_H
#define RENDERINGSPIN_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>

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

/**
 * initSpin:
 *
 * Create the whole method and initialise its values. 
 *
 * Returns: a @RenderingMethod pointer to the new method created.
 * Used by the core to register it.
 */
RenderingMethod* initSpin();

/**
 * These are keys for the storing of spin files in a VisuData object. 
 */
enum
  {
    FILE_KIND_POSITION,
    FILE_KIND_SPIN
  };

/**
 * rspin_get_number_of_shapes:
 *
 * Pouet
 *
 * Return value: the number of different shapes that can be used to draw spins
 */
int rspin_get_number_of_shapes();

/**
 * rspin_shape_name_to_number:
 * @name: the name of the shape
 *
 * Return value: the number of the shape named @name
 */
int rspin_shape_name_to_number(const char *name);

/**
 * rspin_shape_number_to_name:
 * @n: the number of the shape you want the name
 *
 * Return value: the name of the shape number @n
 */
const char* rspin_shape_number_to_name(int n);

/**
 * returnOneF:
 *
 * Return value: the incredible value of 1.0f
 */
float returnOneF();

/** 
 * rspin_global_resource_get:
 * @key: the name of the resource
 *
 * Return value: a pointer to the location where the value for the given global 
 * resource is stored.
 */
gpointer rspin_global_resource_get(const char* key);

/**
 * rspin_get_element_resource:
 * @ele: a @VisuElement
 * @property: the property to get
 * 
 * Gives read access to the storage of the given @property for the given @ele.
 * If properties of @ele weren't allocated, allocates space for them.
 * 
 * Return value: the location of the value of the given @property or NULL if @ele seems invalid.
 **/
const void * rspin_get_element_resource(VisuElement *ele, const char* property);

/**
 * rspin_set_element_resources_f:
 * @ele: the element to update
 * @new_value: the new value
 * @property: the property of the element @ele to update
 *
 * This is the function to call whenever it is needed to update a 
 * spin element resource which is a float. If @ele didn't exist before the call of the function,
 * his properties are created.
 *
 */
void rspin_set_element_resources_f(VisuElement *ele, float new_value, const char* property);

/**
 * rspin_set_element_resources_d:
 * @ele: the element to update
 * @new_value: the new value
 * @property: the property of the element @ele to update
 *
 * This is the function to call whenever it is needed to update a 
 * spin element resource which is an int. If @ele didn't exist before the call of the function,
 * his properties are created.
 *
 */
void rspin_set_element_resources_d(VisuElement *ele, int new_value, const char* property);

/**
 * rspin_createShapeSpin:
 * @view: a #OpenGLView object that contains the geometric caracteristic for
 *        the rendering ;
 * @ele: a visu element.
 *
 * Creates the shape to be drawed by opengl for the @ele VisuElement.
 * Keep in mind that it does NOT redraw the scene. You must explicitly
 * send a redraw signal for that task to be done.
 */
void rspin_createShapeSpin(OpenGLView *view, VisuElement* ele);

/**
 * rspin_placeNodeSpin
 * @node: a visu node
 * @ele: the element matching the @node
 *
 * Apply a particular drawing treatment (coloration) on the given @node 
 * according to its orientation and current set module parameters.
 */
void rspin_placeNodeSpin(VisuData *visuData, VisuNode *node, VisuElement* ele);

#endif
