cleap  0.3.2
A gpu-based library for handling and processing 3D meshes.
Macros | Typedefs | Functions
cleap.h File Reference

Go to the source code of this file.

Macros

#define CLEAP_SUCCESS   1
 
#define CLEAP_FAILURE   -1
 
#define CLEAP_MODE_2D   2
 
#define CLEAP_MODE_3D   3
 
#define CLEAP_TRUE   1
 
#define CLEAP_FALSE   0
 

Typedefs

typedef int CLEAP_RESULT
 
typedef struct _cleap_mesh cleap_mesh
 

Functions

CLEAP_RESULT cleap_init ()
 
CLEAP_RESULT cleap_init_no_render ()
 
CLEAP_RESULT cleap_end ()
 
cleap_meshcleap_load_mesh (const char *filename)
 
CLEAP_RESULT cleap_sync_mesh (cleap_mesh *m)
 
CLEAP_RESULT cleap_clear_mesh (cleap_mesh *m)
 
CLEAP_RESULT cleap_save_mesh (cleap_mesh *m, const char *filename)
 
CLEAP_RESULT cleap_save_mesh_no_sync (cleap_mesh *m, const char *filename)
 
CLEAP_RESULT cleap_paint_mesh (cleap_mesh *m, float r, float g, float b, float a)
 
int cleap_get_vertex_count (cleap_mesh *m)
 
int cleap_get_edge_count (cleap_mesh *m)
 
int cleap_get_face_count (cleap_mesh *m)
 
void cleap_print_mesh (cleap_mesh *m)
 
float cleap_get_bsphere_x (cleap_mesh *m)
 
float cleap_get_bsphere_y (cleap_mesh *m)
 
float cleap_get_bsphere_z (cleap_mesh *m)
 
float cleap_get_bsphere_r (cleap_mesh *m)
 
int cleap_mesh_is_wireframe (cleap_mesh *m)
 
int cleap_mesh_is_solid (cleap_mesh *m)
 
void cleap_mesh_set_wireframe (cleap_mesh *m, int w)
 
void cleap_mesh_set_solid (cleap_mesh *m, int s)
 
CLEAP_RESULT cleap_render_mesh (cleap_mesh *m)
 
CLEAP_RESULT cleap_delaunay_transformation (cleap_mesh *m, int mode)
 
int cleap_delaunay_transformation_interactive (cleap_mesh *m, int mode)
 

Macro Definition Documentation

#define CLEAP_FAILURE   -1

macro status for for failure.

#define CLEAP_FALSE   0

macro value for boolean false.

#define CLEAP_MODE_2D   2

macro value for 2D mode.

#define CLEAP_MODE_3D   3

macro value for 3D mode.

#define CLEAP_SUCCESS   1

macro status for for success.

#define CLEAP_TRUE   1

macro value for boolean true.

Typedef Documentation

typedef struct _cleap_mesh cleap_mesh

cleap mesh. It is the library's main structure. This structure hides all internals to the user and the library provides functions for all operations. An application should use pointers to this struct in order to handle one or multiple meshes simultaneusly and correctly.

typedef int CLEAP_RESULT

cleap status result for many functionalities. values can be CLEAP_SUCCESS, CLEAP_FAILURE.

Function Documentation

CLEAP_RESULT cleap_clear_mesh ( cleap_mesh m)

Deletes and frees all host and device memory used for passed mesh.

Parameters
ma pointer of type cleap_mesh.
Returns
CLEAP_SUCCESS if all was freed succesfully, otherwise CLEAP_FAILURE .
CLEAP_RESULT cleap_delaunay_transformation ( cleap_mesh m,
int  mode 
)

Transforms the mesh into a Delaunay one, via the iterative MDT method.

Parameters
ma pointer of type cleap_mesh.
modedimensional mode; CLEAP_MODE_2D or CLEAP_MODE_3D.
Returns
CLEAP_SUCCESS if succesful, otherwise CLEAP_FAILURE.
int cleap_delaunay_transformation_interactive ( cleap_mesh m,
int  mode 
)

Performs one iteration of the MDT method. Educational purposes.

Parameters
ma pointer of type cleap_mesh.
modedimensional mode; CLEAP_MODE_2D or CLEAP_MODE_3D.
Returns
CLEAP_SUCCESS if succesful, otherwise CLEAP_FAILURE.
CLEAP_RESULT cleap_end ( )

Ends cleap => destroys OpenGL context too.

Returns
CLEAP_SUCCESS If finalization was succesful.
float cleap_get_bsphere_r ( cleap_mesh m)

Gets the radius of the mesh's bounding sphere.

Parameters
ma pointer of type cleap_mesh.
Returns
float >= 0.
float cleap_get_bsphere_x ( cleap_mesh m)

Gets the x coordinate of the center of the mesh's bounding sphere.

Parameters
ma pointer of type cleap_mesh.
Returns
float.
float cleap_get_bsphere_y ( cleap_mesh m)

Gets the y coordinate of the center of the mesh's bounding sphere.

Parameters
ma pointer of type cleap_mesh.
Returns
float.
float cleap_get_bsphere_z ( cleap_mesh m)

Gets the z coordinate of the center of the mesh's bounding sphere.

Parameters
ma pointer of type cleap_mesh.
Returns
float.
int cleap_get_edge_count ( cleap_mesh m)

Gets the number of edges the mesh has.

Parameters
ma pointer of type cleap_mesh.
Returns
int >= 0.
int cleap_get_face_count ( cleap_mesh m)

Gets the number of faces the mesh has.

Parameters
ma pointer of type cleap_mesh.
Returns
int >= 0.
int cleap_get_vertex_count ( cleap_mesh m)

Gets the number of vertices the mesh has.

Parameters
ma pointer of type cleap_mesh.
Returns
int >= 0.
CLEAP_RESULT cleap_init ( )

Initializes cleap. By default chosses the highest GFlop GPU.

Returns
CLEAP_SUCCESS if initialization was succesful.
CLEAP_RESULT cleap_init_no_render ( )

Initializes cleap, creates a dummy OpenGL context and initializes glew. This mode is for applications that only process and dont render anything.

Returns
CLEAP_SUCCESS If initialization was succesful.
cleap_mesh* cleap_load_mesh ( const char *  filename)

Loads an OFF mesh from he given filename and creates a cleap_mesh instance from it.

Parameters
filenamethe full or relative path to the file. For example: "/home/me/meshes/sphere.off".
Returns
cleap_mesh* with it's status = CLEAP_SUCCESS inside, otherwise it will have status = CLEAP_FAILURE or just be null.
int cleap_mesh_is_solid ( cleap_mesh m)

Informs if the mesh is on solid mode or not.

Parameters
ma pointer of type cleap_mesh.
Returns
1 if the mesh is on solid mode, otherwise 0.
int cleap_mesh_is_wireframe ( cleap_mesh m)

Informs if the mesh is on wireframe mode or not.

Parameters
ma pointer of type cleap_mesh.
Returns
1 if the mesh is on wireframe mode, otherwise 0.
void cleap_mesh_set_solid ( cleap_mesh m,
int  s 
)

Sets the mesh's solid mode to enabled or disabled.

Parameters
ma pointer of type cleap_mesh.
sthe solid mode, 1 or 0.
void cleap_mesh_set_wireframe ( cleap_mesh m,
int  w 
)

Sets the mesh's wireframe mode to enabled or disabled.

Parameters
ma pointer of type cleap_mesh.
wthe wireframe mode, 1 or 0.
CLEAP_RESULT cleap_paint_mesh ( cleap_mesh m,
float  r,
float  g,
float  b,
float  a 
)

Paints the mesh with the desired r, g, b, a

Parameters
ma pointer of type cleap_mesh.
rthe red color value.
gthe green color value.
bthe blue color value.
athe alpha transparency value. [solid, transparent] <=> [1.0f, 0.0f].
Returns
CLEAP_SUCCESS if mesh was painted succesfully, otherwise CLEAP_FAILURE .
void cleap_print_mesh ( cleap_mesh m)

Prints the mesh vertex, edge and face data.

Parameters
ma pointer of type cleap_mesh.
CLEAP_RESULT cleap_render_mesh ( cleap_mesh m)

Render the given mesh with OpenGL buffers.

Parameters
ma pointer of type cleap_mesh. 0.
Returns
CLEAP_SUCCESS if succesful, otherwise CLEAP_FAILURE.
CLEAP_RESULT cleap_save_mesh ( cleap_mesh m,
const char *  filename 
)

Saves the mesh into the desired path. The mesh is automatically synced before saving.

Parameters
ma pointer of type cleap_mesh.
filenamethe desired name of the file.
Returns
CLEAP_SUCCESS if mesh was saved succesfully, otherwise CLEAP_FAILURE .
CLEAP_RESULT cleap_save_mesh_no_sync ( cleap_mesh m,
const char *  filename 
)

Saves the mesh into the desired path, without any synchronization.

Parameters
ma pointer of type cleap_mesh.
filenamethe desired name of the file.
Returns
CLEAP_SUCCESS if mesh was saved succesfully, otherwise CLEAP_FAILURE .
CLEAP_RESULT cleap_sync_mesh ( cleap_mesh m)

Synchronizes mesh's host and device data assuming that device has the latest changes.

Parameters
ma pointer of type cleap_mesh.
Returns
CLEAP_SUCCESS if synchronization was succesful, otherwise it returns CLEAP_FAILURE.