visu_elements

visu_elements — defines methods to create and acccess to VisuElement.

Synopsis

struct              VisuElement;
                    VisuElementClass;
void                visu_element_createMaterial         (VisuElement *ele);
const GList *       visu_element_getAllElements         (void);
int                 visu_element_getMaterialId          (VisuElement *ele);
const gchar *       visu_element_getName                (const VisuElement *ele);
gboolean            visu_element_getPhysical            (VisuElement *ele);
gboolean            visu_element_getRendered            (VisuElement *element);
gboolean            visu_element_getSensitiveToPlanes   (VisuElement *element);
gboolean            visu_element_getUpdateNodesOnMaterialChange
                                                        (void);
VisuElement *       visu_element_lookup                 (const gchar *name);
VisuElement *       visu_element_new                    (const char *key);
VisuElement *       visu_element_retrieveFromName       (const gchar *name,
                                                         gboolean *nw);
gint                visu_element_setAllColorValues      (VisuElement *ele,
                                                         float rgb[4],
                                                         float material[5]);
gint                visu_element_setAllMaterialValues   (VisuElement *ele,
                                                         float material[5]);
gint                visu_element_setAllRGBValues        (VisuElement *ele,
                                                         float rgb[4]);
gint                visu_element_setMaterialValue       (VisuElement *ele,
                                                         int material,
                                                         float value);
gint                visu_element_setRGBValue            (VisuElement *ele,
                                                         int rgb,
                                                         float value);
gboolean            visu_element_setRendered            (VisuElement *element,
                                                         gboolean rendered);
gboolean            visu_element_setSensitiveToPlanes   (VisuElement *element,
                                                         gboolean status);
void                visu_element_setUpdateNodesOnMaterialChange
                                                        (void);
void                visu_element_unsetUpdateNodesOnMaterialChange
                                                        (void);

Object Hierarchy

  GObject
   +----VisuElement

Signals

  "ElementMaterialChanged"                         : No Recursion
  "ElementNew"                                     : No Recursion
  "ElementPlaneChanged"                            : No Recursion
  "ElementRenderingChanged"                        : No Recursion
  "ElementVisibilityChanged"                       : No Recursion

Description

V_Sim is used to rendered at given position several object of the same kind. The VisuElement object is used to control that kind. Typically, it corresponds to chemical element. It can represent the silicon, the iron...

VisuElement are defined by their name and have some characteristic like their color or if they are rendered or not. The color characteristic is defined by an RGBA array and different value for the behavior of the light, as defined in OpenGL : diffusivity, shiningness, emissivity, specular and ambient. These values can be controlled with the following methods : visu_element_setAllColorValues(), visu_element_setAllRGBValues(), visu_element_setRGBValue(), visu_element_setAllMaterialValues() and visu_element_setMaterialValue().

If the OpenGL representation of one element is not dependent of its position, it is recommended to use the OpenGL list associated to each VisuElement that can be accessed by a call to visu_element_getMaterialId().

Details

struct VisuElement

struct VisuElement;

Structure to stores VisuElement objects.


VisuElementClass

typedef struct _VisuElementClass VisuElementClass;

An opaque structure representing the class of VisuElement objects.


visu_element_createMaterial ()

void                visu_element_createMaterial         (VisuElement *ele);

Create a list whose number is defined by ele->glMaterialId that stores the definition of light and color for this VisuElement. The previous OpenGL object list with the same identifier is deleted.

ele :

a pointer to a valid VisuElement.

visu_element_getAllElements ()

const GList *       visu_element_getAllElements         (void);

This method returns a list of all the registered VisuElement. The returned list is read-only.

Returns :

the list of all known VisuElement. [element-type VisuElement][transfer none]

visu_element_getMaterialId ()

int                 visu_element_getMaterialId          (VisuElement *ele);

This method is useful for the rendering method to get the OpenGl identifier of the material of the specified element.

ele :

an element.

Returns :

the OpenGL identifier of the specified VisuElement.

visu_element_getName ()

const gchar *       visu_element_getName                (const VisuElement *ele);

This routines returns the name of the given ele.

ele :

a VisuElement object.

Returns :

a string owned by V_Sim.

Since 3.7


visu_element_getPhysical ()

gboolean            visu_element_getPhysical            (VisuElement *ele);

This routine gets if ele is physical or not. A not physical element can be used for instance to represent specific points...

ele :

a VisuElement object.

Returns :

TRUE if ele is indeed physical.

Since 3.7


visu_element_getRendered ()

gboolean            visu_element_getRendered            (VisuElement *element);

This gets the value of the private attribute 'rendered' for the specified VisuElement.

element :

a VisuElement object.

Returns :

the value of attribute 'rendered'.

visu_element_getSensitiveToPlanes ()

gboolean            visu_element_getSensitiveToPlanes   (VisuElement *element);

This method is used to retrieve if nodes of the element are sensitive to the masking property of planes, or not.

element :

a VisuElement object.

Returns :

TRUE if nodes are masked by planes.

visu_element_getUpdateNodesOnMaterialChange ()

gboolean            visu_element_getUpdateNodesOnMaterialChange
                                                        (void);

Retrieve if one the VisuElement is sensitive to the material values. See visu_element_setUpdateNodesOnMaterialChange().

Returns :

TRUE if a VisuGlExtNodes object should rebuild its nodes when the material values are changed.

visu_element_lookup ()

VisuElement *       visu_element_lookup                 (const gchar *name);

Lookup for element name in the base. Do not create it if not found. To do this, use visu_element_retrieveFromName().

name :

a string.

Returns :

the found VisuElement or NULL. [transfer none]

Since 3.6


visu_element_new ()

VisuElement *       visu_element_new                    (const char *key);

Allocate a new visuElement with the specified name. Remember that names must be unique since they identify the element.

key :

the name of the new element to create.

Returns :

the newly created VisuElement or 0 if something goes wrong in the process (if the name already exist for example). [transfer none]

visu_element_retrieveFromName ()

VisuElement *       visu_element_retrieveFromName       (const gchar *name,
                                                         gboolean *nw);

Try to find a VisuElement already associated to that name or create a new one if none has been found. If nw is not NULL it is set to FALSE if name was found.

name :

a string that identify the VisuElement (in UTF8) ;

nw :

a location to store a boolean. [out caller-allocates]

Returns :

a VisuElement associated to this name. [transfer none]

visu_element_setAllColorValues ()

gint                visu_element_setAllColorValues      (VisuElement *ele,
                                                         float rgb[4],
                                                         float material[5]);

This method is used to set all the values that define the color and the lighting of the given element.

ele :

the element of which the color must be changed ;

rgb :

the new color given by a {red, green, blue} array ;. [in][array fixed-size=4]

material :

the new values to define the lighting. [in][array fixed-size=5]

Returns :

> 0 if values for ele have changed.

visu_element_setAllMaterialValues ()

gint                visu_element_setAllMaterialValues   (VisuElement *ele,
                                                         float material[5]);

It saves the values of material in the specified VisuElement.

ele :

the element of which the color must be changed,

material :

the new values to define the lighting. [in][array fixed-size=5]

Returns :

> 0 if values for ele have changed.

visu_element_setAllRGBValues ()

gint                visu_element_setAllRGBValues        (VisuElement *ele,
                                                         float rgb[4]);

It saves the values of rgb in the specified VisuElement.

ele :

the element of which the color must be changed,

rgb :

the new color given by a {red, green, blue} array. [in][array fixed-size=4]

Returns :

> 0 if values for ele have changed.

visu_element_setMaterialValue ()

gint                visu_element_setMaterialValue       (VisuElement *ele,
                                                         int material,
                                                         float value);

It saves the specific value of material (use the enum as the parameter material) in the specified VisuElement.

ele :

the element of which the color must be changed,

material :

the component to change,

value :

the new value of the specified component.

Returns :

> 0 if values for ele have changed.

visu_element_setRGBValue ()

gint                visu_element_setRGBValue            (VisuElement *ele,
                                                         int rgb,
                                                         float value);

It saves the specific value of rgb (0 for red, 1 for green and 2 for bluein the specified VisuElement.

ele :

the element of which the color must be changed,

rgb :

the component to change, 0 for red, 1 for green and 2 for blue,

value :

the value for one of the red, green or blue component.

Returns :

> 0 if values for ele have changed.

visu_element_setRendered ()

gboolean            visu_element_setRendered            (VisuElement *element,
                                                         gboolean rendered);

This method sets the private attribute 'rendered' to TRUE or FALSE for the specified visuElement. If FALSE, all the nodes of that VisuElement are not included in the nodes OpenGL list.

element :

a VisuElement object ;

rendered :

TRUE or FALSE.

Returns :

TRUE if values for ele have changed.

visu_element_setSensitiveToPlanes ()

gboolean            visu_element_setSensitiveToPlanes   (VisuElement *element,
                                                         gboolean status);

This method sets the private attribute 'sensitiveToPlanes' to TRUE or FALSE for the specified visuElement. If TRUE, all the nodes of that VisuElement are not sensitive to the masking property of planes.

element :

a VisuElement object ;

status :

TRUE or FALSE.

Returns :

TRUE if values for ele have changed.

visu_element_setUpdateNodesOnMaterialChange ()

void                visu_element_setUpdateNodesOnMaterialChange
                                                        (void);

If this method is called, whenever a change occurs to a VisuElement material description (color and light) the corresponding OpenGl list of nodes of the currentVisuData is rebuilt. This is usefull if the nodes can't use the list material because the color is node dependant for example. Use visu_element_unsetUpdateNodesOnMaterialChange() to return to the normal behavior.


visu_element_unsetUpdateNodesOnMaterialChange ()

void                visu_element_unsetUpdateNodesOnMaterialChange
                                                        (void);

If this method is called (and no other method has used visu_element_setUpdateNodesOnMaterialChange(), a changement in the material description only change the list of the material.

Signal Details

The "ElementMaterialChanged" signal

void                user_function                      (VisuElement *element,
                                                        gpointer     user_data)      : No Recursion

Gets emitted when the material or color properties of a VisuElement are modified.

element :

the object which emit the signal ;

user_data :

user data set when the signal handler was connected.

Since 3.6


The "ElementNew" signal

void                user_function                      (VisuElement *element,
                                                        gpointer     user_data)      : No Recursion

A new element is available.

element :

the object emitting the signal.

user_data :

user data set when the signal handler was connected.

Since 3.6


The "ElementPlaneChanged" signal

void                user_function                      (VisuElement *element,
                                                        gpointer     user_data)      : No Recursion

Gets emitted when the property of masking by plane is modified.

element :

the object which emit the signal ;

user_data :

user data set when the signal handler was connected.

Since 3.6


The "ElementRenderingChanged" signal

void                user_function                      (VisuElement *element,
                                                        gpointer     user_data)      : No Recursion

Gets emitted when the rendering characteristics of an element are changed, like their shape or specific colour. For a signal on generic colours (like the element colour), listen to VisuElement::ElementMaterialChanged signal instead.

element :

the object which emit the signal ;

user_data :

user data set when the signal handler was connected.

Since 3.7


The "ElementVisibilityChanged" signal

void                user_function                      (VisuElement *element,
                                                        gpointer     user_data)      : No Recursion

Gets emitted when one of the rendered VisuElement is made visible or hidden.

element :

the object which emit the signal ;

user_data :

user data set when the signal handler was connected.

Since 3.6