![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
visu_elementsvisu_elements — defines methods to create and acccess to VisuElement. |
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
);
"ElementMaterialChanged" :No Recursion
"ElementNew" :No Recursion
"ElementPlaneChanged" :No Recursion
"ElementRenderingChanged" :No Recursion
"ElementVisibilityChanged" :No Recursion
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()
.
typedef struct _VisuElementClass VisuElementClass;
An opaque structure representing the class of VisuElement objects.
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.
|
a pointer to a valid VisuElement . |
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] |
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.
|
an element. |
Returns : |
the OpenGL identifier of the specified VisuElement. |
const gchar * visu_element_getName (const VisuElement *ele
);
This routines returns the name of the given ele
.
|
a VisuElement object. |
Returns : |
a string owned by V_Sim. |
Since 3.7
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...
|
a VisuElement object. |
Returns : |
TRUE if ele is indeed physical. |
Since 3.7
gboolean visu_element_getRendered (VisuElement *element
);
This gets the value of the private attribute 'rendered' for the specified VisuElement.
|
a VisuElement object. |
Returns : |
the value of attribute 'rendered'. |
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.
|
a VisuElement object. |
Returns : |
TRUE if nodes are masked by planes. |
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. |
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()
.
|
a string. |
Returns : |
the found VisuElement or NULL. [transfer none] |
Since 3.6
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.
|
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] |
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.
|
a string that identify the VisuElement (in UTF8) ; |
|
a location to store a boolean. [out caller-allocates] |
Returns : |
a VisuElement associated to this name . [transfer none]
|
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.
|
the element of which the color must be changed ; |
|
the new color given by a {red, green, blue} array ;. [in][array fixed-size=4] |
|
the new values to define the lighting. [in][array fixed-size=5] |
Returns : |
> 0 if values for ele have changed. |
gint visu_element_setAllMaterialValues (VisuElement *ele
,float material[5]
);
It saves the values of material in the specified VisuElement.
|
the element of which the color must be changed, |
|
the new values to define the lighting. [in][array fixed-size=5] |
Returns : |
> 0 if values for ele have changed. |
gint visu_element_setAllRGBValues (VisuElement *ele
,float rgb[4]
);
It saves the values of rgb in the specified VisuElement.
|
the element of which the color must be changed, |
|
the new color given by a {red, green, blue} array. [in][array fixed-size=4] |
Returns : |
> 0 if values for ele have changed. |
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.
|
the element of which the color must be changed, |
|
the component to change, |
|
the new value of the specified component. |
Returns : |
> 0 if values for ele have changed. |
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.
|
the element of which the color must be changed, |
|
the component to change, 0 for red, 1 for green and 2 for blue, |
|
the value for one of the red, green or blue component. |
Returns : |
> 0 if values for ele have changed. |
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.
|
a VisuElement object ; |
|
TRUE or FALSE. |
Returns : |
TRUE if values for ele have changed. |
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.
|
a VisuElement object ; |
|
TRUE or FALSE. |
Returns : |
TRUE if values for ele have changed. |
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.
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.
"ElementMaterialChanged"
signalvoid user_function (VisuElement *element,
gpointer user_data) : No Recursion
Gets emitted when the material or color properties of a VisuElement are modified.
|
the object which emit the signal ; |
|
user data set when the signal handler was connected. |
Since 3.6
"ElementNew"
signalvoid user_function (VisuElement *element,
gpointer user_data) : No Recursion
A new element is available.
|
the object emitting the signal. |
|
user data set when the signal handler was connected. |
Since 3.6
"ElementPlaneChanged"
signalvoid user_function (VisuElement *element,
gpointer user_data) : No Recursion
Gets emitted when the property of masking by plane is modified.
|
the object which emit the signal ; |
|
user data set when the signal handler was connected. |
Since 3.6
"ElementRenderingChanged"
signalvoid 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.
|
the object which emit the signal ; |
|
user data set when the signal handler was connected. |
Since 3.7
"ElementVisibilityChanged"
signalvoid user_function (VisuElement *element,
gpointer user_data) : No Recursion
Gets emitted when one of the rendered VisuElement is made visible or hidden.
|
the object which emit the signal ; |
|
user data set when the signal handler was connected. |
Since 3.6