![]() |
![]() |
![]() |
V_Sim API - Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
Surfaces; struct SurfacesOrder_struct; typedef SurfacesOrder; #define VISU_ERROR_ISOSURFACES GQuark isosurfacesGet_quark (void
); #define ISOSURFACES_PROPERTY_POTENTIAL gboolean isosurfacesGet_drawIntra (void
); gboolean isosurfacesSet_drawIntra (gboolean status
); Surfaces* isosurfacesNew (int bufferSize
); void isosurfacesAllocate (Surfaces *surf
,int nsurf
,int npolys
,int npoints
); void isosurfacesAddSurfaces (Surfaces *surf
,int nsurf
,int npolys
,int npoints
); void isosurfacesFree (Surfaces *surf
); gboolean isosurfacesLoad_file (const char *file
,Surfaces **surf
,GError **error
); void isoSurfacesSet_fitToBox (VisuData *data
,Surfaces *surf
); SurfacesOrder* isosurfacesOrder_new (void
); void isosurfacesOrder_free (SurfacesOrder *order
); int isosurfacesGet_nbSurfaces (Surfaces *surf
); const gchar* isosurfacesGet_surfaceName (Surfaces *surf
,int surf_index
); gboolean isosurfacesGet_surfaceRendered (Surfaces *surf
,int surf_index
); VisuSurfacesResources* isosurfacesGet_surfaceResource (Surfaces *surf
,int surf_index
); void isosurfacesSet_surfaceResource (Surfaces *surf
,int surf_index
,VisuSurfacesResources *res
); int isosurfacesGet_surfaceId (Surfaces *surf
,int i
); int* isosurfacesGet_surfaceSortedById (Surfaces *surf
); int isosurfacesGet_newId (Surfaces *surf
); int isosurfacesGet_surfacePosition (Surfaces *surf
,int id
); void isosurfacesOrder_polygons (SurfacesOrder *order
,Surfaces *surf[]
); void isosurfacesDraw_surfaces (int openGLId
,Surfaces *surf[]
,SurfacesOrder *order
); void isosurfacesDuplicate (int totalList
,int simpleBlockList
,VisuData *dataObj
,gboolean reorder
); void isosurfacesSet_box (Surfaces *surf
,double box[6]
); double* isosurfacesGet_box (Surfaces *surf
); float* isosurfacesGet_floatProperty (Surfaces *surf
,const gchar *name
); float* isosurfacesAdd_floatProperty (Surfaces *surf
,const gchar *name
); gboolean isosurfacesGet_floatPropertyValue (Surfaces *surf
,int idSurf
,const gchar *name
,float *value
); gboolean isosurfacesHide (Surfaces *surf
,Plane **planes
); gboolean isosurfacesRemove (Surfaces *surf
,int idSurf
); void isosurfacesCheck_consistency (Surfaces *surf
); void isosurfacesInit (void
); void isosurfacesSet_showAll (Surfaces *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.
typedef struct { /* Number of different surfaces. */ int nsurf; SurfacesPoints basePoints; SurfacesPoints volatilePlanes; /* The description of the box where surfaces are drawn. */ double local_box[6]; /* Resources for each surfaces. */ VisuSurfacesResources **resources; /* Id for each surfaces. */ int *ids; /* Table to add properties to surfaces. */ GHashTable *properties; } Surfaces;
This structure stores surfaces. Several surfaces are stored in a single structure for improved performences.
number of surfaces encoded in this structure ; | |
SurfacesPoints |
the geometric description of surfaces. |
SurfacesPoints |
a storage for volatile polygons, . |
the description of the box where surfaces are drawn ; | |
VisuSurfacesResources ** |
for each surface points on a VisuSurfacesResources ; |
gives a list of ids used to index surfaces ; | |
GHashTable * |
an hashtable of properties. |
struct SurfacesOrder_struct;
An opaque structure to store the order of drawn polygons when surfaces are involved.
typedef struct SurfacesOrder_struct SurfacesOrder;
Short name to adress SurfacesOrder_struct objects.
GQuark isosurfacesGet_quark (void
);
Internal routine for error handling.
Returns : |
the GQuark associated to errors related to surface files. |
#define ISOSURFACES_PROPERTY_POTENTIAL "potential_values"
Flag used in an ASCII surf file to give informations on the value the surface is built from.
gboolean isosurfacesGet_drawIntra (void
);
Retrieve if the interiors of surfaces are drawn with a colour inverse or not.
Returns : |
TRUE if the interior is painted in colour inverse. |
gboolean isosurfacesSet_drawIntra (gboolean status
);
Set if the interiors of surfaces are drawn with a colour inverse or not.
|
a boolean. |
Returns : |
TRUE if calling routine should redraw the surfaces with
isosurfacesDraw_surfaces() .
|
Surfaces* isosurfacesNew (int 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 Surfaces structure. |
void isosurfacesAllocate (Surfaces *surf
,int nsurf
,int npolys
,int npoints
);
Allocate internal arrays to store surfaces having the given description.
|
a Surfaces structure ; |
|
the number of surfaces to store ; |
|
the number of polygons (in total) ; |
|
the total number of vertices. |
void isosurfacesAddSurfaces (Surfaces *surf
,int nsurf
,int npolys
,int npoints
);
Change the allocation of internal arrays to store the additional surfaces with the given description.
|
a Surfaces structure ; |
|
the number of surfaces to add ; |
|
the number of polygons to add ; |
|
the number of vertices to add. |
void isosurfacesFree (Surfaces *surf
);
Free all memory associated to the given surfaces.
|
a Surfaces structure. |
gboolean isosurfacesLoad_file (const char *file
,Surfaces **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) ; |
|
a location to store errors. |
Returns : |
TRUE in case of success, FALSE otherwise. Even in case of success
error may have been set.
|
void isoSurfacesSet_fitToBox (VisuData *data
,Surfaces *surf
);
This method changes the position of all vertices in the structure
to match the box description given in data
.
|
a VisuData object ; |
|
a set of surfaces. |
SurfacesOrder* isosurfacesOrder_new (void
);
Create an object to hold the order in which the surfaces must be
drawn. See isosurfacesOrder_polygons()
to set this object.
Returns : |
a newly created SurfacesOrder object without any values. |
void isosurfacesOrder_free (SurfacesOrder *order
);
Free memory used by a SurfacesOrder object.
|
the object to be freed. |
int isosurfacesGet_nbSurfaces (Surfaces *surf
);
Retrieves th number of surfaces stired in a given surf
object.
|
the surface object. |
Returns : |
number of surfaces. |
const gchar* isosurfacesGet_surfaceName (Surfaces *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.
|
gboolean isosurfacesGet_surfaceRendered (Surfaces *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* isosurfacesGet_surfaceResource (Surfaces *surf
,int surf_index
);
This returns for the given surf_index
its resource information.
|
the surface object ; |
|
the number of the surface. |
Returns : |
the resource of the surface or NULL, if surf_index is invalid.
|
void isosurfacesSet_surfaceResource (Surfaces *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. |
int isosurfacesGet_surfaceId (Surfaces *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.
|
int* isosurfacesGet_surfaceSortedById (Surfaces *surf
);
This returns the surface numbers sorted using their ids.
|
the surface object. |
Returns : |
a newly allocated array with surface numbers. |
int isosurfacesGet_newId (Surfaces *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 isosurfacesGet_surfacePosition (Surfaces *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.
|
void isosurfacesOrder_polygons (SurfacesOrder *order
,Surfaces *surf[]
);
Re-orders the polygons in back to front order. This function should be called everytime a redraw is needed.
|
the description of the polygons order ; |
|
an array of Surfaces object, must be NULL terminated. |
void isosurfacesDraw_surfaces (int openGLId
,Surfaces *surf[]
,SurfacesOrder *order
);
Rebuild each visible surface's list. The order in which to draw the surfaces
is given in the order
argument. If the resource 'isosurfaces_drawIntra' is TRUE
then, the interior of the surfaces is drawn as color inverse.
|
an id for the OpenGL list ; |
|
an array of Surfaces object, must be NULL terminated. |
|
a SurfacesOrder object. |
void isosurfacesDuplicate (int totalList
,int simpleBlockList
,VisuData *dataObj
,gboolean reorder
);
Duplicate the list simpleBlockList
using the extension of the
given dataObj
.
|
an OpenGL identifier for the global list to create ; |
|
an OpenGL identifier for the list with the surfaces in the primitive cell ; |
|
the corresponding VisuData object ; |
|
if TRUE the blocks are drawn from back to front. |
void isosurfacesSet_box (Surfaces *surf
,double box[6]
);
Copy the given box
to the box of surfaces.
|
a Surfaces object ; |
|
a box definition in reduced coordinates. |
double* isosurfacesGet_box (Surfaces *surf
);
Get the box of the surfaces.
|
a Surfaces object. |
Returns : |
6 floats, private, read-only. |
float* isosurfacesGet_floatProperty (Surfaces *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 Surfaces object ; |
|
the name of the property to look for. |
Returns : |
a table with the values if the property is found, NULL otherwise. |
float* isosurfacesAdd_floatProperty (Surfaces *surf
,const gchar *name
);
Some properties can be associated to the surfaces stored in surf
.
This method is add a new property.
|
a Surfaces object ; |
|
the name of the property to add. |
Returns : |
a newly allocated array that can be populated. |
gboolean isosurfacesGet_floatPropertyValue (Surfaces *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 Surfaces 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 isosurfacesHide (Surfaces *surf
,Plane **planes
);
Change the visibility of polygons stored in surf
, following the masking
scheme defined by the given list of planes
(see Plane).
|
a Surfaces object ; |
|
an array of planes (NULL terminated). |
Returns : |
TRUE if the surfaces should be rebuilt (see isosurfacesDraw_surfaces() ).
|
gboolean isosurfacesRemove (Surfaces *surf
,int idSurf
);
Remove from memory all polygons from the given surface.
|
a Surfaces object ; |
|
the id of the surf to remove. |
Returns : |
TRUE if the surface list is reduced to zero (and surf
to be freed).
|
void isosurfacesCheck_consistency (Surfaces *surf
);
Check if all arrays in the structures are consistent (without overflow).
|
a Surfaces object. |
void isosurfacesInit (void
);
Method used to initialised the surface handling, should not be called.