sphore 0.0.1
SPH openGL rendering engine
|
The public header for the sphore library. More...
Go to the source code of this file.
Defines | |
#define | SRE_FLOAT_TINY 2.e-38 |
Typedefs | |
typedef unsigned int | SREdataID |
A numeric identifier accossiated with data sets. | |
Enumerations | |
enum | SREbool { SRE_FALSE = 0, SRE_TRUE } |
A simple Boolean enum. More... | |
enum | SREdeviceType { SRE_DEVICE_INVALID, SRE_DEVICE_GLUT_WINDOW } |
Avaliable devices. More... | |
Functions | |
SREbool | SRE_open_device (SREdeviceType type) |
Creates a new SRE device. | |
void | SRE_close_device () |
frees the memory associated with the open device. | |
void | SRE_start_warnings (void) |
Warnings will be printed to stderr. | |
void | SRE_stop_warnings (void) |
Warnings will not be printed to stderr. | |
void | SRE_enter_main_loop (void) |
Enters the main interactive loop. | |
void | SRE_set_device_size (unsigned int width, unsigned int height) |
Adds the given data to the currently selected device. | |
void | SRE_get_device_size (unsigned int *width, unsigned int *height) |
Gets the size of the current device. | |
SREbool | SRE_device_open (void) |
void | SRE_plot_points (unsigned int n, float *x, float *y, float *z) |
Add data to be drawn as points. | |
SREbool | SRE_set_camera_position (float x, float y, float z) |
Set the absolute position of the camera (i.e. in the same coordinate system as the data). | |
SREbool | SRE_translate_camera (float x, float y, float z) |
Translates the camera by the vector provided. | |
SREbool | SRE_set_colour (float red, float green, float blue) |
Sets the colour to be used for subsequent calls to SRE_plot_points and SRE_plot_line. | |
void | SRE_render_column_int (unsigned int n, float *x, float *y, float *z, float *h, float *weight, float *data, float data_min, float data_max) |
Renders the given SPH data by performing column integrals through the data. | |
SREbool | SRE_set_viewing_volume (float width, float height, float depth) |
Set the volume in front of the camera in which data is to be rendered. | |
void | SRE_get_viewing_volume (float *width, float *height, float *depth) |
Get the current viewing volume. | |
void | SRE_plot_line (int n, float *x, float *y, float *z) |
Plots the line consisting of straight segments connecting the given control points. | |
SREbool | SRE_read_binary (char *name, int *nparticles, int *ncolumns, float ***data, int **types) |
void | SRE_set_colour_ramp (int n, float *controlPoints, float *red, float *green, float *blue) |
The public header for the sphore library.
All funtions, enums, struct etc. that need to be available externally to the sphore library should be declared here!
#define SRE_FLOAT_TINY 2.e-38 |
typedef unsigned int SREdataID |
A numeric identifier accossiated with data sets.
enum SREbool |
enum SREdeviceType |
void SRE_close_device | ( | ) |
frees the memory associated with the open device.
Need to free lists of data!
SREbool SRE_device_open | ( | void | ) |
Query if a device is currently open.
void SRE_enter_main_loop | ( | void | ) |
Enters the main interactive loop.
void SRE_get_device_size | ( | unsigned int * | width, |
unsigned int * | height | ||
) |
Gets the size of the current device.
[out] | width | Gets set to the width of the device in pixels. |
[out] | height | Gets set to the height of the device in pixels. |
SREdataID SRE_add_data (unsigned int n, float *x, float *y, float *z, float *h, float *data) { if (device_open == SRE_FALSE) { print_warning ("SRE_add_data", "No device open."); return SRE_DATA_ID_INVALID; } data_t *new_data = data_create (n, x, y, z, h, data); return (SREdataID) list_add_first (current_device->data, new_data); } SREbool SRE_remove_data (SREdataID id) { if (device_open == SRE_FALSE) { print_warning ("SRE_add_data", "No device open."); return SRE_FALSE; }
return list_remove_data (current_device->data, id, data_destroy); } SREbool SRE_use_data (SREdataID id) { if (device_open == SRE_FALSE) return SRE_FALSE;
find the data list_iterator_t *it = list_iterator_create (current_device->data); if (list_iterator_find (it, id) == SRE_FALSE) { Not found list_iterator_destroy (it); return SRE_FALSE; }
Update the current plots data pointer plot_set_data (device_get_current_plot (current_device), list_iterator_get_data (it)); return SRE_TRUE; }
void SRE_get_viewing_volume | ( | float * | width, |
float * | height, | ||
float * | depth | ||
) |
Get the current viewing volume.
[out] | width | Gets set to the width of the viewing volume. |
[out] | height | Gets set to the height of the viewing volume. |
[out] | depth | Gets set to the depth of the viewing volume. |
SREbool SRE_open_device | ( | SREdeviceType | type | ) |
Creates a new SRE device.
Currently sphore only supports a single device open at a time. If you try to open a second device the call will be ignored.
[in] | type | The type of device to be opened. |
void SRE_plot_line | ( | int | n, |
float * | x, | ||
float * | y, | ||
float * | z | ||
) |
Plots the line consisting of straight segments connecting the given control points.
[in] | n | The number of control points. |
[in] | x | The x coordinates of the control points. |
[in] | y | The y coordinates of the control points. |
[in] | z | The z coordinates of the control points. |
void SRE_plot_points | ( | unsigned int | n, |
float * | x, | ||
float * | y, | ||
float * | z | ||
) |
Add data to be drawn as points.
The colour of the points is determined by the most recent call to SRE_set_colour.
[in] | n | The number of points |
[in] | x | The x coordinate of each point. |
[in] | y | The y coordinate of each point. |
[in] | z | The z coordinate of each point. |
SREbool SRE_read_binary | ( | char * | name, |
int * | nparticles, | ||
int * | ncolumns, | ||
float *** | data, | ||
int ** | types | ||
) |
void SRE_render_column_int | ( | unsigned int | n, |
float * | x, | ||
float * | y, | ||
float * | z, | ||
float * | h, | ||
float * | weight, | ||
float * | data, | ||
float | data_min, | ||
float | data_max | ||
) |
Renders the given SPH data by performing column integrals through the data.
[in] | n | The number of particles. |
[in] | x | The x coordinates of the particles. |
[in] | y | The y coordinates of the particles. |
[in] | z | The z coordinates of the particles. |
[in] | h | The smoothing lengths of the particle. |
[in] | weight | The 'weight' of the particles - should be pmass / (rho*h^3). |
[in] | data | The value of the quantity being smoothed at each particle. |
[in] | data_min | The value of data that will be assigned the lowest position on the colour ramp. |
[in] | data_max | The value of data that will be assigned the highest position on the colour ramp. |
SREbool SRE_set_camera_position | ( | float | x, |
float | y, | ||
float | z | ||
) |
Set the absolute position of the camera (i.e. in the same coordinate system as the data).
[in] | x | The x coordinate of the camera. |
[in] | y | The y coordinate of the camera. |
[in] | z | The z coordinate of the camera. |
SREbool SRE_set_colour | ( | float | red, |
float | green, | ||
float | blue | ||
) |
Sets the colour to be used for subsequent calls to SRE_plot_points and SRE_plot_line.
[in] | red | The red component of the colour. |
[in] | green | The green component of the colour. |
[in] | blue | The blue component of the colour. |
void SRE_set_colour_ramp | ( | int | n, |
float * | controlPoints, | ||
float * | red, | ||
float * | green, | ||
float * | blue | ||
) |
void SRE_set_device_size | ( | unsigned int | width, |
unsigned int | height | ||
) |
Adds the given data to the currently selected device.
Makes a copy of the data, so your original copy can be destroyed.
[in] | n | the number of points. |
[in] | x | the x coordinantes of the points. |
[in] | y | the y coordinantes of the points. |
[in] | z | the z coordinantes of the points. |
[in] | h | the smoothing length of the particles. |
[in] | data | the value of the data at each point. |
[in] | id | The id of the data to be deleted. |
[in] | id | The id of the data to use. |
[in] | width | The new width of the device in pixels. |
[in] | height | The new height of the device in pixels. |
SREbool SRE_set_viewing_volume | ( | float | width, |
float | height, | ||
float | depth | ||
) |
Set the volume in front of the camera in which data is to be rendered.
[in] | width | The new width for the volume. |
[in] | height | The new height for the volume. |
[in] | depth | The new depth for the viewing volume. |
void SRE_start_warnings | ( | void | ) |
Warnings will be printed to stderr.
void SRE_stop_warnings | ( | void | ) |
Warnings will not be printed to stderr.
SREbool SRE_translate_camera | ( | float | x, |
float | y, | ||
float | z | ||
) |
Translates the camera by the vector provided.
The translation is in the frame of reference of the camera.
[in] | x | The x coordinate of the translation. |
[in] | y | The y coordinate of the translation. |
[in] | z | The z coordinate of the translation. |