BRL-CAD
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

Sphere data structure and function declarations. Provides spherical data structures for texture mapping. More...

Collaboration diagram for Spherical Maps:

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_tbn_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...
 

Detailed Description

Sphere data structure and function declarations. Provides spherical data structures for texture mapping.

Macro Definition Documentation

◆ BN_SPM_MAP_NULL

#define BN_SPM_MAP_NULL   (bn_spm_map_t *)0

Definition at line 44 of file spm.h.

◆ BN_CK_SPM_MAP

#define BN_CK_SPM_MAP (   _p)    BU_CKMAG(_p, BN_SPM_MAGIC, "bn_spm_map_t")

Definition at line 45 of file spm.h.

Function Documentation

◆ bn_spm_init()

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.

◆ bn_spm_free()

void bn_spm_free ( bn_spm_map_t mp)

Free the storage associated with a sphere structure.

◆ bn_spm_read()

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

◆ bn_spm_write()

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

◆ bn_spm_get()

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

◆ bn_spm_load()

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.

Returns
-1 on error, else 0.

◆ bn_spm_save()

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.

◆ bn_spm_pix_load()

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.

Returns
-1 on error, else 0.

◆ bn_spm_pix_save()

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.

Returns
-1 on error, else 0.

◆ bn_spm_dump()

void bn_spm_dump ( bn_spm_map_t mp,
int  verbose 
)

Display a sphere structure on stderr. Used for debugging.