BRL-CAD
|
Sphere data structure and function declarations. Provides spherical data structures for texture mapping. More...
Files | |
file | spm.h |
Data Structures | |
struct | bn_spm_map_t |
Macros | |
#define | BN_SPM_MAP_NULL (bn_spm_map_t *)0 |
#define | BN_CK_SPM_MAP(_p) BU_CKMAG(_p, BN_SPM_MAGIC, "bn_spm_map_t") |
Functions | |
bn_spm_map_t * | bn_spm_init (int N, int elsize) |
Return a sphere map structure initialized for N points around the equator. More... | |
void | bn_spm_free (bn_spm_map_t *mp) |
Free the storage associated with a sphere structure. More... | |
void | bn_spm_read (register bn_spm_map_t *mapp, register unsigned char *valp, double u, double v) |
Read the value of the pixel at the given normalized (u, v) coordinates. It does NOT check the sanity of the coords. More... | |
void | bn_spm_write (register bn_spm_map_t *mapp, register unsigned char *valp, double u, double v) |
Write the value of the pixel at the given normalized (u, v) coordinates. It does NOT check the sanity of the coords. More... | |
char * | bn_spm_get (register bn_spm_map_t *mapp, double u, double v) |
Return a pointer to the storage element indexed by (u, v) coordinates. It does NOT check the sanity of the coords. More... | |
int | bn_spm_load (bn_spm_map_t *mapp, char *filename) |
Read a saved sphere map from a file ("-" for stdin) into the given map structure. This does not check for conformity of size, etc. More... | |
int | bn_spm_save (bn_spm_map_t *mapp, char *filename) |
Write a loaded sphere map to the given file ("-" for stdout). Returns -1 on error, else 0. More... | |
int | bn_spm_pix_load (bn_spm_map_t *mapp, char *filename, int nx, int ny) |
Load an 'nx' by 'ny' pix file and filter it into the given sphere structure. More... | |
int | bn_spm_pix_save (bn_spm_map_t *mapp, char *filename, int nx, int ny) |
Save a sphere structure as an 'nx' by 'ny' pix file. More... | |
void | bn_spm_dump (bn_spm_map_t *mp, int verbose) |
Display a sphere structure on stderr. Used for debugging. More... | |
Sphere data structure and function declarations. Provides spherical data structures for texture mapping.
#define BN_SPM_MAP_NULL (bn_spm_map_t *)0 |
#define BN_CK_SPM_MAP | ( | _p | ) | BU_CKMAG(_p, BN_SPM_MAGIC, "bn_spm_map_t") |
bn_spm_map_t * bn_spm_init | ( | int | N, |
int | elsize | ||
) |
Return a sphere map structure initialized for N points around the equator.
Malloc the storage and fill in the pointers. This code leaves a ring of "triangular" pixels at the poles. An alternative would be to have the pole region map to a single pixel.
Returns BN_SPM_NULL on error.
void bn_spm_free | ( | bn_spm_map_t * | mp | ) |
Free the storage associated with a sphere structure.
void bn_spm_read | ( | register bn_spm_map_t * | mapp, |
register unsigned char * | valp, | ||
double | u, | ||
double | v | ||
) |
Read the value of the pixel at the given normalized (u, v) coordinates. It does NOT check the sanity of the coords.
0.0 <= u < 1.0 Left to Right
0.0 <= v < 1.0 Bottom to Top
void bn_spm_write | ( | register bn_spm_map_t * | mapp, |
register unsigned char * | valp, | ||
double | u, | ||
double | v | ||
) |
Write the value of the pixel at the given normalized (u, v) coordinates. It does NOT check the sanity of the coords.
0.0 <= u < 1.0 Left to Right
0.0 <= v < 1.0 Bottom to Top
char * bn_spm_get | ( | register bn_spm_map_t * | mapp, |
double | u, | ||
double | v | ||
) |
Return a pointer to the storage element indexed by (u, v) coordinates. It does NOT check the sanity of the coords.
0.0 <= u < 1.0 Left to Right
0.0 <= v < 1.0 Bottom to Top
int bn_spm_load | ( | bn_spm_map_t * | mapp, |
char * | filename | ||
) |
Read a saved sphere map from a file ("-" for stdin) into the given map structure. This does not check for conformity of size, etc.
int bn_spm_save | ( | bn_spm_map_t * | mapp, |
char * | filename | ||
) |
Write a loaded sphere map to the given file ("-" for stdout). Returns -1 on error, else 0.
int bn_spm_pix_load | ( | bn_spm_map_t * | mapp, |
char * | filename, | ||
int | nx, | ||
int | ny | ||
) |
Load an 'nx' by 'ny' pix file and filter it into the given sphere structure.
int bn_spm_pix_save | ( | bn_spm_map_t * | mapp, |
char * | filename, | ||
int | nx, | ||
int | ny | ||
) |
Save a sphere structure as an 'nx' by 'ny' pix file.
void bn_spm_dump | ( | bn_spm_map_t * | mp, |
int | verbose | ||
) |
Display a sphere structure on stderr. Used for debugging.