![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Signals |
#define VISU_ERROR_ISOSURFACES #define VISU_SURFACES_PROPERTY_POTENTIAL struct VisuSurfaces; VisuSurfacesClass; void visu_surfaces_add (VisuSurfaces *surf
,guint nsurf
,guint npolys
,guint npoints
); float * visu_surfaces_addPropertyFloat (VisuSurfaces *surf
,const gchar *name
); void visu_surfaces_allocate (VisuSurfaces *surf
,guint nsurf
,guint npolys
,guint npoints
); void visu_surfaces_checkConsistency (VisuSurfaces *surf
); GQuark visu_surfaces_getErrorQuark (void
); int visu_surfaces_getId (VisuSurfaces *surf
,int i
); guint visu_surfaces_getN (VisuSurfaces *surf
); const gchar * visu_surfaces_getName (VisuSurfaces *surf
,int surf_index
); int visu_surfaces_getNewId (VisuSurfaces *surf
); int visu_surfaces_getPosition (VisuSurfaces *surf
,int id
); float * visu_surfaces_getPropertyFloat (VisuSurfaces *surf
,const gchar *name
); gboolean visu_surfaces_getPropertyValueFloat (VisuSurfaces *surf
,int idSurf
,const gchar *name
,float *value
); gboolean visu_surfaces_getRendered (VisuSurfaces *surf
,int surf_index
); VisuSurfacesResources * visu_surfaces_getResource (VisuSurfaces *surf
,guint i
); VisuSurfacesResources * visu_surfaces_getResourceById (VisuSurfaces *surf
,int surf_index
); int * visu_surfaces_getSortedById (VisuSurfaces *surf
); gboolean visu_surfaces_hide (VisuSurfaces *surf
,VisuPlane **planes
); gboolean visu_surfaces_loadFile (const char *file
,VisuSurfaces **surf
,GError **error
); VisuSurfaces * visu_surfaces_new (guint bufferSize
); gboolean visu_surfaces_remove (VisuSurfaces *surf
,int idSurf
); gboolean visu_surfaces_setColorAndMaterial (VisuSurfaces *surf
,int surf_index
,ToolColor *color
,float material[VISU_GL_LIGHT_MATERIAL_N_VALUES]
); gboolean visu_surfaces_setRendered (VisuSurfaces *surf
,int surf_index
,gboolean status
); void visu_surfaces_setResource (VisuSurfaces *surf
,int surf_index
,VisuSurfacesResources *res
); void visu_surfaces_setShowAll (VisuSurfaces *surf
,gboolean show
);
Originally written by Luc Billard for his Visualize program. This module allows loading of .surf files to draw scalar fields on top of the current display scene. .surf files are text files which specs are the following :
1st line is arbitrary
2nd line must contain 3 real (float) values: dxx dyx dyy
3rd line must contain 3 real (float) values: dzx dzy dzz
4th line must contain 3 positive integers which represents respectively the number of surfaces, the total number of polys, and the total number of points
Then, for each of these surfaces :
next line must contain the name of the surface : it is a string which should match the pattern surface_*
next line must contain 2 positive integer values: the number of polys (num_polys) and the number of points (num_points) used by the surface
each of the following num_polys lines must match the pattern [n i_1 i_2 i_3 ... i_n] where n is the number of vertices in the poly (n >= 3) and [i_1 i_2 i_3 ... i_n] are the numbering of these vertices (vertices numbered from 1 to num_points)
each of the following num_points lines must contain 6 real values for the successive (1 to num_points) points : [x y z nx ny nz], where x y z are the coordinates of the point and nx ny nz are the coordinates of the unit normal at the point
It is the responsibility of the user to guarantee that dxx, dyx, dyy, dzx, dzy, dzz match the one currently loaded in V_Sim's current context. Though if you use panelSurfaces you can ask to resize the surfaces so that they fit in the current loaded box.
#define VISU_ERROR_ISOSURFACES visu_surfaces_getErrorQuark()
Internal function for error handling.
#define VISU_SURFACES_PROPERTY_POTENTIAL "potential_values"
Flag used in an ASCII surf file to give informations on the value the surface is built from.
void visu_surfaces_add (VisuSurfaces *surf
,guint nsurf
,guint npolys
,guint npoints
);
Change the allocation of internal arrays to store the additional surfaces with the given description.
|
a VisuSurfaces structure ; |
|
the number of surfaces to add ; |
|
the number of polygons to add ; |
|
the number of vertices to add. |
float * visu_surfaces_addPropertyFloat (VisuSurfaces *surf
,const gchar *name
);
Some properties can be associated to the surfaces stored in surf
.
This method is add a new property.
|
a VisuSurfaces object ; |
|
the name of the property to add. |
Returns : |
a newly allocated array that can be populated. |
void visu_surfaces_allocate (VisuSurfaces *surf
,guint nsurf
,guint npolys
,guint npoints
);
Allocate internal arrays to store surfaces having the given description.
|
a VisuSurfaces structure ; |
|
the number of surfaces to store ; |
|
the number of polygons (in total) ; |
|
the total number of vertices. |
void visu_surfaces_checkConsistency (VisuSurfaces *surf
);
Check if all arrays in the structures are consistent (without overflow).
|
a VisuSurfaces object. |
GQuark visu_surfaces_getErrorQuark (void
);
Internal routine for error handling.
Returns : |
the GQuark associated to errors related to surface files. |
int visu_surfaces_getId (VisuSurfaces *surf
,int i
);
This returns for the given i
its id information.
|
the surface object ; |
|
the number of the surface. |
Returns : |
the id of the surface or 0, if i is invalid. |
guint visu_surfaces_getN (VisuSurfaces *surf
);
Retrieves th number of surfaces stired in a given surf
object.
|
the surface object. |
Returns : |
number of surfaces. |
const gchar * visu_surfaces_getName (VisuSurfaces *surf
,int surf_index
);
This returns for the given surf_index
its name
(1 <= surf_index <= surfaces_number)
|
the surface object ; |
|
the number of the surface. |
Returns : |
the name of the surface or empty name or NULL, if surf_index is invalid. |
int visu_surfaces_getNewId (VisuSurfaces *surf
);
This returns a unique id to create a new surface.
|
the surface object. |
Returns : |
a value suitable to create a new surface in this set of surfaces. |
int visu_surfaces_getPosition (VisuSurfaces *surf
,int id
);
This returns for the given id
its number.
|
the surface object ; |
|
the id of the surface. |
Returns : |
the number of the surface or 0, if id is invalid. |
float * visu_surfaces_getPropertyFloat (VisuSurfaces *surf
,const gchar *name
);
Some properties can be associated to the surfaces stored in surf
.
This method is used to retrieve floating point values properties.
|
a VisuSurfaces object ; |
|
the name of the property to look for. |
Returns : |
a table with the values if the property is found, NULL otherwise. |
gboolean visu_surfaces_getPropertyValueFloat (VisuSurfaces *surf
,int idSurf
,const gchar *name
,float *value
);
This method retrieves a float value stored as a property called name
for
the surface defined by its number idSurf
.
|
a VisuSurfaces object ; |
|
a surface number ; |
|
the name of the property to get the value from ; |
|
a location to store the value. |
Returns : |
TRUE if a value is indeed found. |
gboolean visu_surfaces_getRendered (VisuSurfaces *surf
,int surf_index
);
This returns for the given surf_index
its visibility.
|
the surface object ; |
|
the number of the surface. |
Returns : |
the visibility of the surface or FALSE, if surf_index is invalid. |
VisuSurfacesResources * visu_surfaces_getResource (VisuSurfaces *surf
,guint i
);
This returns the resource of the ith stored surface. If the surface
is known by its id, use visu_surfaces_getResourceById()
instead.
|
the surface object ; |
|
the ith stored surface. |
Returns : |
the resource of the surface or NULL, if
i is invalid. [transfer none]
|
Since 3.7
VisuSurfacesResources * visu_surfaces_getResourceById (VisuSurfaces *surf
,int surf_index
);
This returns for the given surf_index
its resource information.
|
the surface object ; |
|
the id of the surface. |
Returns : |
the resource of the surface or NULL, if
surf_index is invalid. [transfer none]
|
int * visu_surfaces_getSortedById (VisuSurfaces *surf
);
This returns the surface numbers sorted using their ids.
|
the surface object. |
Returns : |
a newly allocated array with surface numbers. |
gboolean visu_surfaces_hide (VisuSurfaces *surf
,VisuPlane **planes
);
Change the visibility of polygons stored in surf
, following the masking
scheme defined by the given list of planes
(see VisuPlane).
|
a VisuSurfaces object ; |
|
an array of planes (NULL terminated). |
Returns : |
TRUE if the surfaces visibility status have been changed. |
gboolean visu_surfaces_loadFile (const char *file
,VisuSurfaces **surf
,GError **error
);
This loads a surface file and set default material properties for it. See surf file specifications.
|
target file to load ; |
|
a set of surfaces (location) ;. [out][transfer full] |
|
a location to store errors. |
Returns : |
TRUE in case of success, FALSE otherwise. Even in case of success
error may have been set. [skip]
|
VisuSurfaces * visu_surfaces_new (guint bufferSize
);
Create a new (with unallocated internal arrays) structure to store surfaces. The buffer size is used to store other values than the position and the normal on each point.
|
an integer. |
Returns : |
a newly allocated VisuSurfaces structure. |
gboolean visu_surfaces_remove (VisuSurfaces *surf
,int idSurf
);
Remove from memory all polygons from the given surface.
|
a VisuSurfaces object ; |
|
the id of the surf to remove. |
Returns : |
TRUE if the surface list is reduced to zero (and surf
to be freed). |
gboolean visu_surfaces_setColorAndMaterial (VisuSurfaces *surf
,int surf_index
,ToolColor *color
,float material[VISU_GL_LIGHT_MATERIAL_N_VALUES]
);
Update the color and material property of given surface.
|
the surface object ; |
|
the number of the surface. |
|
a ToolColor object. [transfer none] |
|
the material values. [array fixed-size=5] |
Returns : |
TRUE if the values are differents. |
Since 3.7
gboolean visu_surfaces_setRendered (VisuSurfaces *surf
,int surf_index
,gboolean status
);
Change the visibility status of surface surf_index
.
|
the surface object ; |
|
the number of the surface. |
|
a boolean. |
Returns : |
TRUE if the visibility has been indeed changed. |
Since 3.7
void visu_surfaces_setResource (VisuSurfaces *surf
,int surf_index
,VisuSurfacesResources *res
);
This method is used to change the resource of a surface.
|
the surface object ; |
|
the number of the surface ; |
|
the new resource. |
void visu_surfaces_setShowAll (VisuSurfaces *surf
,gboolean show
);
Shows or hides all surfaces and check their "draw" status in the panel accordingly.
|
a VisuSurfaces object ; |
|
TRUE to show all surfaces, FALSE to hide them. |
"added"
signalvoid user_function (VisuSurfaces *surf,
gpointer user_data) : No Hooks
Gets emitted when a new surface is added to the object.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
Since 3.7
"masked"
signalvoid user_function (VisuSurfaces *surf,
gpointer user_data) : No Hooks
Gets emitted when a surface is shown or hidden by a plane.
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
Since 3.7
"removed"
signalvoid user_function (VisuSurfaces *surf,
guint idSurf,
gpointer user_data) : No Hooks
Gets emitted when a surface is removed from the object.
|
the object which received the signal. |
|
the id of the surface that has been removed. |
|
user data set when the signal handler was connected. |
Since 3.7
"rendering"
signalvoid user_function (VisuSurfaces *surf,
guint idSurf,
gpointer user_data) : No Hooks
Gets emitted when a rendering property of a surface is modified.
|
the object which received the signal. |
|
the id of the surface that has been modified. |
|
user data set when the signal handler was connected. |
Since 3.7